My WordPress Development Workflow

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.

 Continue reading My WordPress Development Workflow

Apple Watch – 6 Months Later. Not That Great.

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.

Continue reading Apple Watch – 6 Months Later. Not That Great.

Fixing My Apple Extended Keyboard II

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.

Continue reading Fixing My Apple Extended Keyboard II

Get The Current File’s Path in Emacs

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 C-y (CMD-v works as well on my mac) will paste the value.

My Post-Evernote Life

Few months ago I wrote about my decision to move away from Evernote. Recently, few readers1 emailed me to ask whether I actually stooped using Evernote, and if I did, what’s my alternative solution.

Continue reading My Post-Evernote Life

Bunch of Emacs Tweaks

Comment\Uncomment a Line

Few useful commands for commenting\uncommenting lines in emacs. Taken from the Emacs tutorial. Sure, I can go back to the manual, but I want to ducument and keep them here, for quicker referrence.

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).

C-M-j M-j Like RET followed by inserting and aligning a comment (comment-indent-new-line). See Multi-Line Comments.

M-x comment-region

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

I’m constantly customizing my emacs. I have an init.el file, 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

I wondered if there’s a command to creat a new line bellow the line my point is on. Here’s what I found in superuser:

C-e C-m – go to the end of the line, create a new line and move the point to that line.

or

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 – C-a C-o.

Quick Open a specific file

Now days I start most of my writing in my draft file. I need a quick way to access this file, whether I’m in Emacs or any other application. I know Emacs has the concept of registers, which are special memory slots, that can be accessed with a command. Those registers can store any type of data, such as strings, integers, files and paths.

It’s time to learn how to work with them. When thinking about it, there are other files that I would have liked to access quicker, such as the init.el or config.org.

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))

For example,

(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

Again, r is the register I’m querying.

Change cases

Keybinding Action
M-l Convert following word to lower case (downcase-word).
M-u Convert following word to upper case (upcase-word).
M-c Capitalize the following word (capitalize-word).
C-x C-l Convert region to lower case (downcase-region).
C-x C-u Convert region to upper case (upcase-region).

Changing the default font in Emacs

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: emacs_with_input_font.png

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.