Couple of months ago1 I started to use Emacs as my secondary email client; the primary one remains Gmail’s web interface. Bringing my Gmail account to Emacs wasn’t as smooth sail as I hoped it to be, but I’m happy with the results so far.
I currently use a child-theme for this site1, its parent being twentysixteen. I keep modifying this theme on my local machine and push updates to my live site. But in parallel, I want to start building a completely new theme, based on the starting _s theme. I’m uncomfortable developing this new theme within the same local environment; I want, instead, to create a playground where I can experiment, knowing it’s completely isolated from my production environment.
Now that I moved to WordPress, I can finally set Emacs’ font to Input. Wait, what? what does an Emacs font has to do with WordPress?
When I shared my first impression on the Watch, it was all hail of fanfare. I had nothing bad to say about it, and even if I had, I ignored or minimized it.
Six months of daily use later, and I become annoyed with it. If it wasn’t too big of a statement, I would have gone back to my Polar RS-100.
Couple of months ago I bought the Apple Extended Keyboard from EBay. I fell in-love with it immediately, and enjoyed typing in it more than I do with my Wasd Code1.
To my disappointment, though, few days after I got it, several keys started to show signs of weakness. The ‘8’ key spouted multiple letters in every stroke. The ‘t’ worked sporadically, and the ‘.’ stopped responding altogether.
Here’s a small function I borrowed from this question on stack-overflow. It returns the full path of the file I currently edit in the buffer:
(defun show-file-name () "Show the full path file name in the minibuffer." (interactive) (message (buffer-file-name)) (kill-new (file-truename buffer-file-name)) ) (global-set-key "\C-cz" 'show-file-name)
You’ll note that this function is bind to
C-c z. So when typing it, you should see the path showing in the minibuffer. As a bonus, it stores the path in the kill ring, so
CMD-v works as well on my mac) will paste the value.
Table of Contents
Table of Contents
Comment\Uncomment a Line
M-;Insert or realign comment on current line; if the region is active, comment or uncomment the region instead (comment-dwim).
C-u M-;Kill comment on current line (comment-kill).
C-x ;Set comment column (comment-set-column).
M-jLike RET followed by inserting and aligning a comment (comment-indent-new-line). See Multi-Line Comments.
Mastering this command takes me one step further into Emacs, as it used to be one of those funcionalities that keeped drawing me back to Sublime Text.
Quick reload of init.el file
init.elfile, but most of the configuration in a more literal way, in an org config file.
When I make changes to Emacs settings, I need to reload the init file activate the changes. So far, I typed
C-x C-f to find the init file and then
M-x [RET] eval-buffer to reload it. Repeating this flow hundreds of times became annoying.
A quick inquery in IRC, and now I know that I can call
load-file and give it the name of the file I would like to load. Having a function to load a file, means that I can wrap it with my own function, and reload my init file with a customized keybind.
And with the help of this answer at stack-overflow, I came up with the following shortcut to reload my Emacs configuration:
(global-set-key (kbd "<f6>") (lambda() (interactive)(load-file "~/.emacs.d/init.el")))
New line bellow
C-e C-m – go to the end of the line, create a new line and move the point to that line.
C-e C-j – same as the command above, only that the point will indent if neccessery.
There is also a keybind for creating a new line above the current line, and move the point to that line –
Quick Open a specific file
Google’s first search result was EmacsWiki. Again, it proved to be a great source of information, had I wanted to confuse myself. So I passed. The second result was from Emacs tutorial, which again proved to be clear, concise and informative.
Here are the commands for storing a filename in and loading it from a register:
(set-register r '(file . name))
(set-register ?r '(file . "~/Dropbox/Notes/posts/pages/posts_drafts.org"))
To load this file, I should type
C-x r j r
In the code examples above,
r is the name of the register. It can be replaced with any character.
And to see what’s stored in a specific register:
M-x view-register RET r
r is the register I’m querying.
||Convert following word to lower case (downcase-word).|
||Convert following word to upper case (upcase-word).|
||Capitalize the following word (capitalize-word).|
||Convert region to lower case (downcase-region).|
||Convert region to upper case (upcase-region).|
Josh Stella wrote a delightful post about how he uses Emacs, not necessarily for development work. I found quite a few configuration tips, and already implemented few of them. One of those tweaks is using the Input font family. Visiting fontbureau made me want this font too!
I thought it will be as simple as
copy-paste (I’m still not used to the appropriate
kill-yank terminology) Josh’s configuration. It wasn’t – after reloading my init, the font didn’t pick up.
Few experimentations later, though, and it did work. First, I had to download and install the font in my mac, dahhh… Then, I had to modify the name of the font (Josh used
InputSerif; I had to change it to
Input). Here’s my configuration:
;; set up fonts for different OSes. OSX toggles to full screen. (setq myfont "Input") (cond ((string-equal system-name "ygilad.local") (set-face-attribute 'default nil :font myfont :height 144) (toggle-frame-fullscreen)))
Indeed, it looks beautiful. Here’s a screen grab of this post in Input:
There’s still one problem – this modification to my config broke the org-reader plugin, and I can’t export my org files to Pelican. Sadly, I’ll have to resort to the default font (Menlo), until I figure out a fix.
I’m sold on it. Yeah, it might be a hasty conclusion based on less than 24 hours with it, but the Watch is here to stay. Well, probably not the exact one I used, because I passed it over to my wife, trying to get her drinking the Kool-Aid as well.