Trying to get the modeline to show the current c++ function point is in, I modified my modeline in the following way:

    (setq-default mode-line-format
               (#(" " 0 1
            "    "
            "    "
            (line-number-mode "%l/")
            (:eval (number-to-string (count-lines (point-min) (point-max))))        
            "    "
            "    "

All is fine, except that now also [eglot:project] is shown in the modeline which I don't want. How can I remove that but keep the function name information (included in mode-line-misc-info)?

The value of mode-line-misc-info as reported by C-h v is:

((eglot--managed-mode (" [" eglot--mode-line-format "] ")) (which-function-mode (which-func-mode (#1="" which-func-format " "))) (global-mode-string (#1# global-mode-string)))
  • What is the value of mode-line-misc-info? Do C-h v mode-line-misc-info to get it and add it to your question.
    – NickD
    Commented May 4, 2023 at 21:31
  • mode-line-misc-info is a variable defined in ‘bindings.el’. Its value is ((eglot--managed-mode (" [" eglot--mode-line-format "] ")) (which-function-mode (which-func-mode (#1="" which-func-format " "))) (global-mode-string (#1# global-mode-string)))
    – CD86
    Commented May 5, 2023 at 9:39
  • So what happens if you get rid of the first element of mode-line-misc-info by evaluating the following form: (setq mode-line-misc-info (cdr mode-line-misc-info)). Does that look more like what you want? N.B. untested and no warranty is provided: you might want to do that in a throw-away session of Emacs, just in case.
    – NickD
    Commented May 5, 2023 at 12:59


Your Answer

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

Browse other questions tagged or ask your own question.