Subject: bug#1355: suggestion on the modeline

From: xah lee <[email-masked]>
Date: Sat, 15 Nov 2008 17:09:36 -0800

Dear emacs developers,

Recently there's a question in gnu.help.emacs about how to disable  
the buffer switching behavior of mouse clicking on the buffer name in  
mode line. Out of this discussion i wrote a little essay on  
suggestions on the emacs mode line.

The essay is here:
http://xahlee.org/emacs/modernization_mode_line.html

I think this would make emacs more easier for the average programer  
or writer but does not subtract its power. Here's what i think, for  
what its worth.

Thanks.

---------------------------------------------
Emacs's Mode Line Modernization Suggestions

Xah Lee, 2008-12

This article gives some suggestions on improving emacs's “mode  
line”, so that it is more intuitive and useful.

I think the mode line is one of emacs's problem in usability.
emacs mode line

above: Emacs's mode line.

Here's what i think are better default:

• The start of the mode line, displaying the coding system used such  
as “-u”, “-uuu”, and displaying the modification status like  
“:**”, “%%”, “%*” are quite cryptic. Having used emacs for  
10 years, these are still not burned into my brain. And it's not easy  
to look them up what they are unless you are emacs diehard. (e.g.  
you'll have to know it's technically called “mode line”, then  
you'll have to know about emacs-index-search, and in general familiar  
with info and emacs)

It'd better to instead say “Read Only” instead of “%*”, and  
show “Modified” instead of the “**”. (don't show anything when  
it's “--”)

• The coding system shown in mode line should be removed. Because,  
for vast majority of programers, he rarely deals with different file  
coding systems or coding system change, perhaps just few times a  
year. It is not something programers encounter on a daily basis.  
Also, 3 letter-code is cryptic for conveying file coding system,  
especially today because there are lots of them. The current coding  
system should be shown perhaps in the menu somewhere, and allow users  
to change thru menu. For programers who deals with different file  
systems or coding systems hourly and need it be displayed on the mode  
line, perhaps emacs can introduce a customization feature so that the  
full coding system is displayed in modeline.

• The cursor location percentage should by default not shown if  
emacs is running in GUI with scroll bar. (this is sometimes shown as  
“Top” or “Bot”) GUI scroll bar gives intuitive indication of  
where cursor are in relation to the whole buffer, and also gives a  
indication of the screen display size in relation to the buffer size,  
and conveys these info faster.

• When emacs is running in a terminal, the special indicator  
“Top” and “Bot” should be shown as percentage as usual,  
because for someone uninitiated, consistent changing of percentage as  
he moves the cursor is more intuitive. The code “Top” and  
“Bot” could mean many things

• Minor mode 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 not something  
people who intuitively understands. For the other reason, Emacs's  
technical concept of Minor mode is somewhat confusing. Most minor  
modes in practice can be thought of as Preferences settings (Mac- 
speak) or Options (Windows-speak and Linux Desktops).

• Line number mode should be on by default. So that, the line number  
shows in the mode line. How to show line number is a frequently asked  
question.

• 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 popular major modes. (e.g. C, C++, java, perl,  
php, bash, javascript, html/xml, python, text, LaTeX, elisp.)

Summary

I think the mode line should be like this:

‹buffer name› ‹major mode name› ‹line num›  
‹status›-------------------

where the status is Modified or Read Only.

Here's a example of such actual display:

elisp_basics.html    html-mode    L19    Modified-------------------

Also, when editing as root, it'd be nice to indicate it in mode line.  
Possibly making the mode line's background red, or add a word  
“(root)” on the right. Some indication of being root is a  
frequently requested feature.

If running in a GUI, clicking on the buffer name should show menu  
list of user buffers, 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 linePos/charPos show a menu that allow user to turn on/ 
off line number mode or char number mode.

Clicking on the Read Only or “Modified”, should show a menu  
allowing user to toggle Read Only.

Clicking the rest of the mode line displaying “--------”, can show  
all the useful info about the current buffer. For example: modified/ 
read status, mode settings, minor modes, encoding used. This can be  
done as a new split window much like describe-function would. In the  
result pane, it can show status of other buffer local vars that are  
related to text editing (such as case sensitive search, how lines are  
wrapped, length for truncation, margin ... ). With links or active  
text that lets user toggle or set new vals easily (similar to the UI  
of the customize function).

All these clicking should be Right Click, which is more standard  
behavior of clicking on things for contextual menu. (e.g. in Windows,  
Mac, Linux, system wide, and in Firefox and other browsers.)

• The term “mode line” could be changed to “status bar” in  
the manuals. “Status bar” is more understandable to modern users.

   Xah
∑ http://xahlee.org/

☄