Emacs, scripting and anything text oriented.
Kaushal Modi

Posts categorized in ‘emacs’ (22)

Narrowing the Author column in Magit

<2018-08-11 Sat>
Update for the change in magit-log-format-margin signature (Magit 20180809.1716).

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.

Building Org Development version

<2018-02-20 Tue>
Refactor the code using more canonical methods.
<2018-01-03 Wed>
Update the Org repo links as per the announcement on Org mailing list on <2017-12-28 Thu>.

I am assuming that you already know what Org or org-mode is and that’s why you are here.

You would want to build Org from its development branch (master branch) to get the latest and greatest goodies plus bug fixes! Go through the ORG-NEWS file to read about the new features.

If you like what you see there, here are the steps for installing the development version of Org.

A Better less

I use emacs – with a server1 and client setup – so that I can quickly open new files in it using emacsclient. My typical setup is to have xterm + tmux on one monitor and a single emacs(client) frame on another. But there are times when I do not want to shift focus from one monitor to another, like when I just need to review some log file. So I started using an alias to emacs -nw -Q to quickly open log files, review, filter, and C-x C-c.

Of course, that’s not where this post ends. An alias was no longer adequate to do what I wanted it to do more ..

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)

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.

Save a macro as a function in emacs

I am in the process of converting traditional verilog test benches to SystemVerilog UVM test benches. As per the UVM methodology, it is recommended to use `uvm_info instead of $display statements so that the info statement encodes a Message ID and Message Verbosity along with the message required to be printed.

I won’t go in more detail about UVM and verilog as this post is about how I can save a macro that I use very frequently into an elisp function.

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.