I want to hide some text such as
Lisp Interaction : WC ivy Projectile Eldoc
from modeline . I want to leave other as it is and dont change those .
How can i do this?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI want to hide some text such as
Lisp Interaction : WC ivy Projectile Eldoc
from modeline . I want to leave other as it is and dont change those .
How can i do this?
Hide list of minor modes in mode-line is a near-duplicate question as far as the list of minor modes goes.
This is the first time I've ever heard of someone not wanting to see what the major mode is, though.
Provided you have a reasonably normal mode-line-format
you can do what you want with this:
(setq-default mode-line-format (delq 'mode-line-modes mode-line-format))
From your screenshot you're using some kind of fancy mode line, so if the above doesn't work then you're going to have to show us the value of your mode-line-format
if you need anyone to figure out the equivalent, because we can't guess what you're using.
FWIW delight.el will let you hide OR rename most major and minor mode text in the mode line, on a case-by-case basis. If you would be happier to hide only some things and see shorter text for others, that will let you achieve that.
I'm guessing that you're trying to hide minor-mode lines. The diminish
package could help.
(require 'diminish)
(diminish 'rainbow-mode) ; Hide lighter from mode-line
(diminish 'rainbow-mode " Rbow") ; Replace rainbow-mode lighter with " Rbow"
(diminish 'rainbow-mode 'rainbow-mode-lighter) ; Use raingow-mode-lighter variable value
(diminish 'rainbow-mode '(" " "R-" "bow")) ; Replace rainbow-mode lighter with " R-bow"
(diminish 'rainbow-mode '((" " "R") "/" "bow")) ; Replace rainbow-mode lighter with " R/bow"
(diminish 'rainbow-mode '(:eval (format " Rbow/%s" (+ 2 3)))) ; Replace rainbow-mode lighter with " Rbow/5"
(diminish 'rainbow-mode ; Replace rainbow-mode lighter with greened " Rbow"
'(:propertize " Rbow" face '(:foreground "green")))
(diminish 'rainbow-mode ; If rainbow-mode-mode-linep is non-nil " Rbow/t"
'(rainbow-mode-mode-linep " Rbow/t" " Rbow/nil"))
(diminish 'rainbow-mode '(3 " Rbow" "/" "s")) ; Replace rainbow-mode lighter with " Rb"
For diminishing the major mode:
(cl-defmacro ph/diminish-major-mode (feature diminished-indicator &optional
(hook (ph/format-symbol "%s-hook" feature)))
"Shrink the modeline indicator for FEATURE to DIMINISHED-INDICATOR.
Optional argument HOOK in case the mode hook is not FEATURE-hook."
`(with-eval-after-load (quote ,feature)
(add-hook (quote ,hook)
(defun ,(ph/format-symbol "ph/diminish-%s" feature) ()
(setq mode-name ,diminished-indicator)))))
(defun ph/format-symbol (template &rest substitutions)
"Build a symbol from TEMPLATE, substituting in SUBSTITUTIONS.
TEMPLATE and SUBSTITUTIONS are as per the STRING and OBJECTS parameters to
`format'.
\(fn TEMPLATE SUBSTITUTIONS...)"
(intern
(apply #'format template substitutions)))
;; Example:
(ph/diminish-major-mode elisp-mode "EL" emacs-lisp-mode-hook)
Note the use of defun
rather than lambda
, in order to make it easier to identify (and perhaps later remove from the hook).