Posts

Showing posts from July, 2024

Annotate completion candidates (GNU Emacs)

Image
GNU Emacs supports annotation for completion candidates. An annotation is a small bit of useful information shown next to a completion candidate which a package developer can use to provide additional help to the user while making a selection. e.g. while selecting a command, this is usually the keyboard shortcut. In the following example, annotation is used to display a sample text with the candidate font-family applied.  (defun test ()   (interactive)   (let* (( completion-extra-properties           `(:annotation-function         (lambda (a)           (propertize " (OIly10)" 'face               `(:family ,a :background "grey"))))))     (completing-read "Font family: " (font-family-list))     ))   By default , Emacs uses completions-annotations face for the annotation...