This article gives some suggestions on improving emacs's “mode line”, so that it is more intuitive and useful.
Can you tell what each of the above means?
The start of the mode line -uuu:**-F1 is quite
cryptic. Having used emacs for 10 years, i still don't understand most
of it without looking up. Worse, it's not easy to look them up unless
you are a emacs expert. (⁖ you'll have to know its technical
name being “mode line”, then you'll have to know about
emacs-index-search, and you must be familiar emacs's info
system.)
Here's what i think are better default.
The coding system indicator should be removed. Here's examples of the coded word used: u, uuu, U(Unix), u(DOS), 1(Unix).
Here's some of their meanings:
Vast majority of programers do not frequently work with different character encoding or newline convention. Maybe once a month. Therefore, displaying encoding info in the mode line is probably not necessary.
Also, the abbreviation used is cryptic, especially today because there are hundreds of coding systems, with tens of them popularly used depending on country.
It is best to show the coding system used for the current buffer in a more dedicated place, such as a menu command, and allow users to change coding system thru menu. (As of emacs 23 (2009-07), such menu does not exist.)
For programers who deal with files with different character encoding or unix/Windows newline conventions daily and need it be displayed on the mode line, the best solution is probably a customization feature, so that when it is turned on, the character encoding system is displayed in mode line by the encoding abbreviation such as “utf-8/unix” (not by letter codes).
It'd better to instead say Read Only instead of %% or %*, and show Modified instead of the **. (don't show anything when it's --)
Emacs mode line displays one of the following {nn%, Top, Bot, All}, to indicate the location of cursor relative to whole file content.
The cursor location indicator is redundant when emacs is running in GUI with scroll bar. GUI scroll bar conveys the cursor location much more effectively, and also gives a sense of content length by the length of the scroll bar.
When emacs is running in a terminal, there is usually no scroll bar, so the percentage “nn%” for cursor location is good. It should not change to “Top” when cursor is at the first line, or “Bot” and “All” special cases. Because, a consistent format is much easier to understand. When user moves the cursor, she can see the percentage display change dynamically from 1% to 100%. This is a very natural feedback.
The special case brief/abbrev words {Top, Bot, All} is more confusing because they could mean many other things. The mode line uses abbreviated words or coded words to indicate minor modes and coding system, so there is potential to confuse “Bot” and “Top” as coded words for something to new users. For example, “Top” could mean the unix process viewer program “top” is running in emacs, “Bot” could mean there is a emacs bot (robot) running in the background maybe doing some clean up, etc.
Minor modes should not be displayed in mode line. It's confusing. For one reason, it by default selectively display only some of the minor modes currently on, and the selective process is esoteric, probably only few emacs developers understand. For the other reason, the concept of emacs's minor mode is not something non-expert emacs users understand. From a user point of view, most minor modes in practice are today universally known as Preference settings or Options.
Clicking on the file name should not switch buffer. It could do contextual menu listing user buffers instead. (user buffer here are those not starting with “*”)
Clicking on the major mode name should pop up a contextual menu to let user switch to major modes that are familiar to majority of average programers. (example: C, C++, Java, Perl, Python, PHP, Bash, JavaScript, HTML, text, LaTeX, Emacs Lisp, …) The menu can have a “More…” submenu to show all other available major modes.
Emacs today (Emacs 23, 2009-07) does not have a menu anywhere showing major modes it supports.
The term “mode line” could be changed to “status bar” in the manuals. “Status bar” is more standard term today.
I think the mode line should be like this:
‹buffer name› ‹major mode name› ‹line num› ‹modified status›
The “status” can have 3 states: “Modified”, “Read Only”, or nothing. But actually, indication of Read Only status is not necessary. One method of finding out whether a buffer is read-only, is by simply typing something in the buffer. This method is universal and familiar to all. Thus, the benefit of having mode line status to indicate Read Only is for saving the labor of typing something, but at the cost of introducing a item in the mode line and the (comparatively smaller) effort to look at the mode line. The benefit/cost ratio is trivial.
So, that leaves the possible display of the word “Modified” for status. The modified or not modified status would actually be better if it is changed to indicate whether the buffer is saved as file or not. Saved or unsaved is a more useful a state to know, because when a buffer is not associated with a file, it is always modified unless it is empty, so for such buffers shown as “Modified” is rather meaningless. (here, special purpose buffers such as dired, calc, calender, etc are excluded from consideration, because being “modified” does not have normal meaning in them.)
Considering all of the above, the possible display for status section in mode line is just “Unsaved”. Technically, this means that if buffer-modified-p returns true, and if the buffer name does not start with a “*” (meaning it is a user buffer), and the buffer is not a special mode (dired), then “Unsaved” should be displayed in the modeline.
By modern convention, many editors indicated “unsaved” status by just a bullet “◆” adjacent to the file name displayed in the window top border. (⁖ BBEdit, Mathematica.) Emacs could also adopt this convention but on the mode line.
This consolidates the “**”, “%*”, “%%”, “--” codes for the modeline. When a user sees “Unsaved”, it tells the user that he may need to save it to file.
Here's a example of such actual display:
elisp_basics.html html-mode L19 Unsaved
Also, when editing as root (admin privilege), it'd be nice to indicate it in mode line. Possibly making the mode line's background red, or add a word “(admin)” on the right. Some indication of being root is a frequently requested feature. Here's a example:
etc Dired L19 (admin)
If running in a GUI, clicking on the buffer name should show menu list of user buffers. That is, those not starting with a “*”.
Clicking on the major mode name should show a menu of commonly used major modes, allowing user a easy way to switch. (currently, emacs has no intuitive way for user to switch a mode or know what modes are available. This is also a FAQ item.)
Clicking on “line num” should show a menu that allow user to turn on/off line number mode and cursor column position.