Emacs: cursory version 1.0.0

Cursory provides a thin wrapper around built-in variables that affect the style of the Emacs cursor on graphical terminals. The intent is to allow the user to define preset configurations such as “block with slow blinking” or “bar with fast blinking” and set them on demand. The use-case for such presets is to adapt to evolving interface requirements and concomitant levels of expected comfort, such as in the difference between writing and reading.

Below are the release notes.


Cursory has been in a stable state for a long time. I use it daily and am happy with what it does. This version refactors parts of the code in the interest of legibility/hackability, while providing a quality-of-life feature for users.

A preset can now inherit from another

In the interest of defining multiple presets while avoiding duplication, the user option cursory-presets now accepts an :inherit property. For example:

(setq cursory-presets
      '(
        ;; Sample code here ...

        (bar
         :cursor-type (bar . 2)
         :cursor-in-non-selected-windows hollow
         :blink-cursor-mode 1
         :blink-cursor-blinks 10
         :blink-cursor-interval 0.5
         :blink-cursor-delay 0.2)

        (bar-no-other-window
         :inherit bar
         :cursor-in-non-selected-windows nil)

        ;; More sample code here ...
        ))

Presets were already capable of getting properties from a default t preset. Now they can be controlled with greater precision.

The value of cursory-presets is updated accordingly to benefit from this mechanism and to showcase how it is done:

(defcustom cursory-presets
  '((box
     :blink-cursor-interval 0.8)
    (box-no-blink
     :blink-cursor-mode -1)
    (bar
     :cursor-type (bar . 2)
     :blink-cursor-interval 0.5)
    (bar-no-other-window
     :inherit bar
     :cursor-in-non-selected-windows nil)
    (underscore
     :cursor-type (hbar . 3)
     :blink-cursor-blinks 50)
    (underscore-thin-other-window
     :inherit underscore
     :cursor-in-non-selected-windows (hbar . 1))
    (t ; the default values
     :cursor-type box
     :cursor-in-non-selected-windows hollow
     :blink-cursor-mode 1
     :blink-cursor-blinks 10
     :blink-cursor-interval 0.2
     :blink-cursor-delay 0.2))
  ;; Omitting the doc string for demo purposes...
  )

In the above sample, we notice both the :inherit property and the default t preset with all its properties. Presets beside t act as overrides of the defaults and, as such, need only consist of the properties that change from the default. In the case of an :inherit, properties are first taken from the inherited preset and then the default one.