Emacs, scripting and anything text oriented.
Kaushal Modi

Installing rust toolchain

Lately, I have come to know of a command line search utility called [ripgrep][3], coded in rust, that is capable of faster code searches (at least for my use cases) than grep or [ag][4]. So I got interested in building the latest versions of rg (ripgrep binary name) directly from its github master branch rather than waiting for its [release binaries][5].

So came the need to install the rust toolchain on my machine. Luckily, installing that was super easy; here are the steps:

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 searching online 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

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