Emacs, scripting and anything text oriented.
Kaushal Modi

Optimize your .git

I was reviewing what was occupying the maximum disk space using the ncdu command line utility. One of the top candidates was the git clone of org-mode. It was using 2.4GB of my disk space!

Surprised by that, I started looking around1 if there was a way to optimize the cloned git repositories i.e. the .git/ directories. And sure enough, there was a way.

Emacsclient on Windows

Using emacsclient instead of the emacs binary is a very useful technique to prevent loading emacs from scratch each time you open a new file. That technique is useful on Windows too. But for this to work on Windows, we need some more elisp and Windows environment variable configuration than just the below code,

(require 'server)
;; Start a server if (server-running-p) does not return t (e.g. if it
;; returns nil or :other)
(or (eq (server-running-p) t)
    (server-start))

Do Ediff as I mean

<2017-09-19 Tue>
Updated modi/ediff-dwim to the latest revision in my config.

In almost all of my ediff use cases, I would have windows open side-by-side in a frame, and then I would want to do a diff between the two using ediff-buffers.

But emacs doesn’t know that I obviously want to diff those two side-by-side buffers! So it always asks me to select the buffers to be diffed. The same problem is when using ediff-files too.

So I came up with the following helper function to pick the correct ediff command.

Elisp Meta Characters in String

The setup of outshine package for emacs requires the user to set the variable outline-minor-mode-prefix to "\M-#" before the outline-mode package (that ships with emacs) is loaded.

The best way to do this is via the Customize interface in emacs.

So I did M-x customize and set that variable’s value to "\M-#" and restarted emacs and that worked.

But then I was surprised to see that value being saved in the custom.el as '(outline-minor-mode-prefix "\243").