4.8.2 Delight

When delight4 is installed, you can use the :delight keyword. If delight is not installed, the :delight keyword does nothing.

First, add the following declaration to the beginning of your init file.

(use-package delight :ensure t)

The optional :ensure t makes sure the package is installed if it isn’t already (see Installing packages automatically).

The :delight keyword takes as its argument a minor mode symbol, a replacement string, or quoted mode line data (in which case the minor mode symbol is assumed to be the package name with ‘-mode’ appended at the end), both of these, or several lists of both. See Mode Line Data in GNU Emacs Lisp Reference Manual. If no arguments are provided, the default mode name is hidden completely.

For example, the following hides everything for the ‘foo-mode’ minor mode in the ‘foo’ package:

(use-package foo
  :delight)

If the mode name doesn’t match the package name with ‘-mode’ appended, provide a symbol instead. For example, the following hides auto-revert-mode from the mode line:

;; Don't show anything for auto-revert-mode, which doesn't match
;; its package name.
(use-package autorevert
  :delight auto-revert-mode)

You can also use arbitrary Lisp code as argument of :delight. For example, to replace ‘foo-mode’ with the value of the current buffer:

(use-package foo
  :delight '(:eval buffer-file-name))

Here is an example of hiding several built-in minor modes:

;; Completely hide visual-line-mode and change auto-fill-mode to " AF".
(use-package emacs
  :delight
  (auto-fill-function " AF")
  (visual-line-mode))

Footnotes

(4)

The delight package is installable from GNU ELPA.