Skip to content

Disabling annotators, builtin or lightweight annotators

Marginalia activates rich annotators by default. Depending on your preference you may want to use the builtin annotators or even no annotators by default and only activate the annotators on demand by invoking marginalia-cycle.

In order to disable an annotator permanently, the marginalia-annotators can be modified. For example if you prefer to never see file annotations, you can delete all file annotators from the registry.

emacs-lisp
(setq marginalia-annotators
      (assq-delete-all 'file marginalia-annotators))

To use the builtin annotators by default, you can run the following code. Replace ‘builtin’ by ‘none’ to disable annotators by default.

emacs-lisp
(mapc (lambda (x)
        (setcdr x (cons 'builtin (remq 'builtin (cdr x)))))
      marginalia-annotators)

As an alternative to marginalia-cycle, if a completion category supports two annotators, you can toggle between them using the following command.

emacs-lisp
(defun marginalia-toggle ()
  (interactive)
  (mapc
   (lambda (x)
     (setcdr x (append (reverse (remq 'none
                                      (remq 'builtin (cdr x))))
                       '(builtin none))))
   marginalia-annotators))

After cycling the annotators you may want to automatically save the configuration. This can be achieved using an advice which calls customize-save-variable.

emacs-lisp
(advice-add #'marginalia-cycle :after
            (lambda ()
              (let ((inhibit-message t))
                (customize-save-variable 'marginalia-annotators
                                         marginalia-annotators))))