Emacs: lin version 0.2.0

Lin is a stylistic enhancement for Emacs’ built-in hl-line-mode. It remaps the hl-line face (or equivalent) buffer-locally to a style that is optimal for major modes where line selection is the primary mode of interaction.

The idea is that hl-line-mode cannot work equally well for contexts with competing priorities: (i) line selection, or (ii) simple line highlight. In the former case, the current line needs to be made prominent because it carries a specific meaning of some significance in the given context: the user has to select a line. Whereas in the latter case, the primary mode of interaction does not revolve around the line highlight itself: it may be because the focus is on editing text or reading through the buffer’s contents, so the current line highlight is more of a reminder of the point’s location on the vertical axis.

Here is an illustration of Lin in the lower window as compared to the default subtle style of hl-line-mode in the upper window (using the modus-operandi theme from my modus-themes package):

Modus Operandi with LIN active

Below are the release notes.


Version 0.2.0 on 2022-03-16

Rewrote the entirety of lin.el to make the configuration easier and keep the code streamlined. The gist is that now Lin automatically enables hl-line-mode in every mode implied by lin-mode-hooks. Here is how Lin should be set up henceforth:

(require 'lin)

(setq lin-face 'lin-blue) ; check doc string for alternative styles

(lin-setup) ; Either run this or change `lin-mode-hooks'

(customize-set-variable
 'lin-mode-hooks ; do not use `setq' with this; `customize-set-variable' runs `lin-setup' automatically
 '(dired-mode-hook
   elfeed-search-mode-hook
   git-rebase-mode-hook
   ibuffer-mode-hook
   ilist-mode-hook
   ledger-report-mode-hook
   log-view-mode-hook
   magit-log-mode-hook
   mu4e-headers-mode
   notmuch-search-mode-hook
   notmuch-tree-mode-hook
   occur-mode-hook
   org-agenda-mode-hook
   tabulated-list-mode-hook))

The manual has been updated to reflect those changes: https://protesilaos.com/emacs/lin.

Thanks to:

  • Christian Tietze for showing how the Lin face can use colors from the macOS palette. The original contribution was in merge request 2: https://gitlab.com/protesilaos/lin/-/merge_requests/2. Now we provide the lin-mac and lin-mac-override-fg faces. These can be assigned as a value to the user option lin-face.

  • Damien Cassou for suggesting that Lin sets itself up for a list of mode hooks. The original contribution was in merge request 3: https://gitlab.com/protesilaos/lin/-/merge_requests/3. It has now been rewritten as the lin-mode-hooks user option, though the idea is the same.

  • Federico Stilman for adding mu4e-headers-mode to the list that Damien had provided and which now lives as lin-mode-hooks. Federico’s contribution was sent as a patch via email.