As mbork commented, you can use delight.el to selectively modify or disable minor (and indeed major) mode text in the mode line.
One of the advantages is that it takes care of the eval-after-load
(which you need to write manually with diminish.el in most use-cases), which makes the configuration cleaner. You still need the same information -- the name of the mode, and the library which implements it (which Emacs will tell you if you ask it about the mode) -- but you can wrap it all up into a single form:
(require 'delight)
(delight '((some-mode nil "some-library")
(some-other-mode nil "some-other-library")))
(Or follow the link above for some real usage examples.)
I would recommend taking this approach, because even if you don't want most minor mode lighter text, there's a good chance that you'll find some of them useful (and you can still modify those ones to be shorter).
If you truly want to eliminate all minor mode lighter text (and again, I don't recommend it), you could modify the mode-line-modes
variable. The mode line variables changed a while back, so you may want to use M-x find-variable RET mode-line-modes RET
and then manually adapt your default definition, editing out the section concerning minor-modes-alist
.
Of course then you'd need to maintain it, which isn't so flash, so you might prefer replacing the minor-mode-alist
symbol within the existing value. The following is somewhat implementation-specific, but certainly nicer than setting mode-line-modes
in its entirety, and you can toggle it on and off.
(define-minor-mode minor-mode-blackout-mode
"Hides minor modes from the mode line."
t)
(catch 'done
(mapc (lambda (x)
(when (and (consp x)
(equal (cadr x) '("" minor-mode-alist)))
(let ((original (copy-sequence x)))
(setcar x 'minor-mode-blackout-mode)
(setcdr x (list "" original)))
(throw 'done t)))
mode-line-modes))
(global-set-key (kbd "C-c m") 'minor-mode-blackout-mode)