7

I'd like to know exactly what my modeline is telling me and how it's derived. Right now, if I'm working with a graphical terminal I can hover over each modeline entry in turn, and if I'm lucky, a tooltip will pop up; obviously, this won't work in a console. Alternately I can examine the mode-line-format variable, but it's not at all obvious how the values correlate to what's displayed.

Ideally I'd like something within Emacs that would explain, for example, how am I getting from "%e" in mode-line-format to U:---, what that means and where to get more information: “U:--- comes from %e in mode-line-format and means this, that and the other. You can customize it here.”

Is there a mode or tool that will help me?

Drew
  • 75,699
  • 9
  • 109
  • 225
  • @asjo: The OP is looking to understand the mode line in detail, in particular, to understand `mode-line-format` better. That is in the Elisp manual, not the Emacs manual. – Drew Oct 12 '14 at 17:18

2 Answers2

5
  1. As far as I know, there is no such tool in Emacs or a 3rd-party library. But perhaps someone else will come up with one.

  2. You have correctly pointed to the two main sources of info I would have mentioned: (1) pop-up info in tooltips and (2) studying mode-line-format and its doc (doc string and Elisp manual, node Mode Line Top).

    A third source of info that can help is to see how existing code modifies mode-line-format and what it does with it. This can be helpful because of the complexity of mode-line-format. There are lots of such code examples out there. Library modeline-posn.el is one of mine, but there are plenty of others, including code that is part of the Emacs distribution.

  3. Please consider suggesting this as a possible enhancement to Emacs. You do that with M-x report-emacs-bug (it is not only for bug reports). And if you have any particular ideas of what features for this might be useful for users, please contribute them also.

    You can also send a mail to emacs-devel@gnu.org, which is the Emacs development mailing list, to open a discussion about this possibility.

    (There are other such complex structures in Emacs that could also benefit from additional help/exploration/navigation: menus & other keymaps, font-lock-keywords... A generic means of, or framework for, exploring/interrogating such a structure might also be helpful.)

Drew
  • 75,699
  • 9
  • 109
  • 225
4

Since any tool will have to read mode-line-format, you cannot do better than examining it. The manual has an extensive section describing the format here including all the % constructs.

Note that the mode-line-format is often recursive i.e. it contains variables which are themselves valid modeline formats so it is often useful to parse a part of it independently. For this case format-mode-line is a useful function which can give insight to what a particular snippet does.

Also note that many minor modes (anzu-mode, helm etc) will often add there own sections to the modelines which might not be evident from mode-line-format directly. Browsing customization options usually yields information on these.

Vamsi
  • 3,916
  • 22
  • 35