1

I've emacs modeline as below enter image description here

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?

4
  • 1
    As @Drew says: emacs.stackexchange.com/tags/elisp/info
    – NickD
    Mar 9, 2022 at 12:30
  • 2
    Probably the easiest way is to find out how whatever package you are currently using sets the mode line and then modify it appropriately. The basic references are Interpreting the mode line and Mode line format but the latter in particular will require some effort to go through: it deals with all the low level details that whatever package you currently use tried to hide.
    – NickD
    Mar 9, 2022 at 12:35
  • 1
    You might want to add to your question how your mode line is currently set (although if you use something like Doom or Spacemacs, or some other initialization framework, you might not know that: in that case, just specify the initialization framework).
    – NickD
    Mar 9, 2022 at 12:38
  • Please make the question more specific: say just what your mode-line shows now and what you want it to show instead, i.e., just what you want to change. As it is now, the question is too broad - it just asks how to change the mode-line.
    – Drew
    Mar 9, 2022 at 17:38

3 Answers 3

1

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.

0

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"

diminish.el package

0

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.