Annotate completion candidates (GNU Emacs)
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUfUkhvHo0RTuN5y1H-xOyf6z0SQqxchxAL63RoD2YvD2GoVjO8uEX0G6coB59MQWtyIvjC_eZa5P6xxbvQr671_fGREoSee3pjAAyON8rCPpAOvMZvQwCd9g1SZPMzKaAbiAKavFNNwAV8Y7j1HzIN7Yq-wt83EtKEMTKGu7NgCl7UlNm0ukrwbf-fzk/s320/annotate-completion.png)
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. Use the following patch to skip changing the face when the annotation already has a face attached. modified lisp/minibuffer.el @@ -1754,8 +1754,10 @@ completion--insert-strings