Emacs, scripting and anything text oriented.
Kaushal Modi

Posts categorized in ‘elisp’ (7)

Narrowing the Author column in Magit

The Org and Worg git repos can be committed to only via ssh protocol (and not https), and for technical reasons, I cannot commit to those repos via ssh from my primary development machine. So I ended up with a flow that involves pushing commits to those repos using my Nexus 6p phone.

Magit is how I git, and I love to primarily work from the ∗magit-log∗ buffer (M-x magit-status, l b). But the default column widths were not optimal on a Nexus 6p 5.7" screen. And that’s what inspired this tweak, which looks great on a regular desktop monitor too.

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

How to save a function name in a variable in elisp?

I have a couple of theme packages installed on my emacs but I would like to assign a default theme.

I set the zenburn theme via a function zenburn. I set the leuven theme via another function leuven. But in my emacs startup I didn’t want to hard-code either of these function and thus arose the need to set a variable to one of these functions.