unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1355: suggestion on the modeline
@ 2008-11-16  1:09 xah lee
  2008-11-17  2:57 ` Richard M. Stallman
  2020-09-19 21:59 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 10+ messages in thread
From: xah lee @ 2008-11-16  1:09 UTC (permalink / raw)
  To: bug-gnu-emacs

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/^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-16  1:09 bug#1355: suggestion on the modeline xah lee
@ 2008-11-17  2:57 ` Richard M. Stallman
  2008-11-17 23:26   ` Alan Mackenzie
  2020-09-19 21:59 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 10+ messages in thread
From: Richard M. Stallman @ 2008-11-17  2:57 UTC (permalink / raw)
  To: xah lee, 1355; +Cc: bug-gnu-emacs, bug-submit-list

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

If the mode line were infinitely long, I would agree with you.
But there's no room for that.

      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.

You're probably right.  I would guess that only a few experts
know what these mean, and it's only useful once in a while,
not often enough to be worth mentioning in the mode line.

However, having the unibyte/multibyte indicator in the mode line
is useful.

      The cursor location percentage should by default not shown if  
    emacs is running in GUI with scroll bar.

Maybe so.

      When emacs is running in a terminal, the special indicator  
     Top  and  Bot  should be shown as percentage as usual,  

"Top" is equivalent to 00%, and showing "00%" instead would
be just as good.  However, "Bot" gives you other information:
that the bottom of the buffer is on the screen.

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

The aim is to show those that are useful to see.

      Line number mode should be on by default. So that, the line number  
    shows in the mode line.

Isn't it enabled by default, nowadays?






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-17  2:57 ` Richard M. Stallman
@ 2008-11-17 23:26   ` Alan Mackenzie
  2008-11-18  3:47     ` Stefan Monnier
  2008-11-18 18:17     ` James Cloos
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Mackenzie @ 2008-11-17 23:26 UTC (permalink / raw)
  To: rms, 1355; +Cc: xah lee, bug-gnu-emacs, bug-submit-list

Hi, R and X!

On Sun, Nov 16, 2008 at 09:57:21PM -0500, Richard M. Stallman wrote:

>       The cursor location percentage should by default not shown if  
>     emacs is running in GUI with scroll bar.

> Maybe so.

>       When emacs is running in a terminal, the special indicator  
>      Top  and  Bot  should be shown as percentage as usual,  

> "Top" is equivalent to 00%, and showing "00%" instead would
> be just as good.  However, "Bot" gives you other information:
> that the bottom of the buffer is on the screen.

Incidentally, I think the wrong percentage is displayed.  Assuming that
the window shows part of the buffer, there's stuff above, stuff below,
like this:

a               ^
a               |
a               |
a               |
  W             |              ^
  W             |              |
  W             |              |
  W          buffer         window
  W             |              |
  W             |              |
  W             |              v
b               |
b               |
b               |
b               v

, the percentage currently displayed is a / (a + W + b).  So, although in
the picture, the window is showing the middle of the buffer, the
percentage displayed is 22%, rather than 50%.  This is particularly
jarring when scrolling through, perhaps, an info page.  You see 47%, then
two lines later, Bot.

A better calculation would be a / (a + b), the degree of "travel" of the
windown through the buffer.  This approaches 100% as the window reaches
the bottom of the buffer.

I've been using this for many years now.  Here's how:

[ Emacs 22.3 ]
*** xdisp.orig.c	2008-08-26 15:45:44.000000000 +0000
--- xdisp.c	2008-09-12 13:59:17.000000000 +0000
***************
*** 18033,18041 ****
      case 'p':
        {
  	int pos = marker_position (w->start);
! 	int total = BUF_ZV (b) - BUF_BEGV (b);
  
! 	if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b))
  	  {
  	    if (pos <= BUF_BEGV (b))
  	      return "All";
--- 18033,18043 ----
      case 'p':
        {
  	int pos = marker_position (w->start);
!         int bottpos = BUF_Z (b) - XFASTINT (w->window_end_pos); /* ACM */
!         int totnotdisp = BUF_ZV (b) - BUF_BEGV (b) - (bottpos - pos); /* ACM */
! 	int total ;
  
!         if ((bottpos >= BUF_ZV (b)) || (totnotdisp <= 0)) /* ACM */
  	  {
  	    if (pos <= BUF_BEGV (b))
  	      return "All";
***************
*** 18046,18056 ****
  	  return "Top";
  	else
  	  {
! 	    if (total > 1000000)
  	      /* Do it differently for a large value, to avoid overflow.  */
! 	      total = ((pos - BUF_BEGV (b)) + (total / 100) - 1) / (total / 100);
  	    else
! 	      total = ((pos - BUF_BEGV (b)) * 100 + total - 1) / total;
  	    /* We can't normally display a 3-digit number,
  	       so get us a 2-digit number that is close.  */
  	    if (total == 100)
--- 18048,18060 ----
  	  return "Top";
  	else
  	  {
!             if (totnotdisp > 1000000)
  	      /* Do it differently for a large value, to avoid overflow.  */
! 	      total = ((pos - BUF_BEGV (b)) + (totnotdisp / 100) - 1)
!                       / (totnotdisp / 100); /* ACM */
  	    else
!               total = ((pos - BUF_BEGV (b)) * 100 + totnotdisp - 1)
!                       / totnotdisp ; /* ACM */
  	    /* We can't normally display a 3-digit number,
  	       so get us a 2-digit number that is close.  */
  	    if (total == 100)


-- 
Alan Mackenzie (Nuremberg, Germany).







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-17 23:26   ` Alan Mackenzie
@ 2008-11-18  3:47     ` Stefan Monnier
  2008-11-18  9:42       ` Juanma Barranquero
  2008-11-18 18:17     ` James Cloos
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2008-11-18  3:47 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: xah lee, bug-gnu-emacs, bug-submit-list, 1355, rms

> , the percentage currently displayed is a / (a + W + b).  So, although in
> the picture, the window is showing the middle of the buffer, the
> percentage displayed is 22%, rather than 50%.  This is particularly
> jarring when scrolling through, perhaps, an info page.  You see 47%, then
> two lines later, Bot.

> A better calculation would be a / (a + b), the degree of "travel" of the
> windown through the buffer.  This approaches 100% as the window reaches
> the bottom of the buffer.

I'd tend to agree, tho I don't have any strong feeling about it.


        Stefan






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-18  3:47     ` Stefan Monnier
@ 2008-11-18  9:42       ` Juanma Barranquero
  2008-11-18 10:37         ` Alan Mackenzie
  0 siblings, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2008-11-18  9:42 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 1355

On Tue, Nov 18, 2008 at 04:47, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>> A better calculation would be a / (a + b), the degree of "travel" of the
>> windown through the buffer.  This approaches 100% as the window reaches
>> the bottom of the buffer.
>
> I'd tend to agree, tho I don't have any strong feeling about it.

I like the effect much more than the original, but it contradicts the
"above" bit of the documentation:

  %p -- print percent of buffer above top of window, or Top, Bot or All.

Also, the same change should be done to %P, shouldn't it?

  Juanma






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-18 10:37         ` Alan Mackenzie
@ 2008-11-18 10:37           ` Juanma Barranquero
  2008-11-18 16:30           ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2008-11-18 10:37 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 1355

On Tue, Nov 18, 2008 at 11:37, Alan Mackenzie <acm@muc.de> wrote:

> How about:
>
>    %p -- print Top, Bot, All, or how far through the buffer the window
>    is (in percent).  This is 100 * A / (A + B), where A is the number
>    bytes above the window, B the number below it.

Too much information; the second sentence is not really needed IMO.
But anyway, my point was exactly what you're addressing here:

> So, for backwards compatibility, %p and %P should
> remain unchanged, and 100 * A / (A + B) should be attached to a new
> %-construct, say %v.  (Why %v?  Why not?  It's reminiscent of C-v, and
> %M-v.)

I'd like to see that added. Let's hear what Stefan and Chong have to say.

  Juanma






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-18  9:42       ` Juanma Barranquero
@ 2008-11-18 10:37         ` Alan Mackenzie
  2008-11-18 10:37           ` Juanma Barranquero
  2008-11-18 16:30           ` Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Mackenzie @ 2008-11-18 10:37 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 1355

Hi, Juanma!

On Tue, Nov 18, 2008 at 10:42:09AM +0100, Juanma Barranquero wrote:
> On Tue, Nov 18, 2008 at 04:47, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> >> A better calculation would be a / (a + b), the degree of "travel" of the
> >> windown through the buffer.  This approaches 100% as the window reaches
> >> the bottom of the buffer.

> > I'd tend to agree, tho I don't have any strong feeling about it.

> I like the effect much more than the original, but it contradicts the
> "above" bit of the documentation:

>   %p -- print percent of buffer above top of window, or Top, Bot or All.

How about:

    %p -- print Top, Bot, All, or how far through the buffer the window
    is (in percent).  This is 100 * A / (A + B), where A is the number
    bytes above the window, B the number below it.

> Also, the same change should be done to %P, shouldn't it?
 
Hmmm.  :-)  If so, than %p + %P = 100% (modulo rounding errors), and %P
is kind of redundant.  So, for backwards compatibility, %p and %P should
remain unchanged, and 100 * A / (A + B) should be attached to a new
%-construct, say %v.  (Why %v?  Why not?  It's reminiscent of C-v, and
%M-v.)

>   Juanma

-- 
Alan Mackenzie (Nuremberg, Germany).






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-18 10:37         ` Alan Mackenzie
  2008-11-18 10:37           ` Juanma Barranquero
@ 2008-11-18 16:30           ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2008-11-18 16:30 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Juanma Barranquero, 1355

>> %p -- print percent of buffer above top of window, or Top, Bot or All.

> How about:

>     %p -- print Top, Bot, All, or how far through the buffer the window
>     is (in percent).  This is 100 * A / (A + B), where A is the number
>     bytes above the window, B the number below it.

>> Also, the same change should be done to %P, shouldn't it?
 
> Hmmm.  :-)  If so, than %p + %P = 100% (modulo rounding errors), and %P
> is kind of redundant.  So, for backwards compatibility, %p and %P should
> remain unchanged, and 100 * A / (A + B) should be attached to a new
> %-construct, say %v.  (Why %v?  Why not?  It's reminiscent of C-v, and
> %M-v.)

You'd have to ask people who use %P: how do they use it?  Why (or what for)?
Maybe it's OK to have %P represent B/(A+B), or maybe a better solution
would be to offer access to A/(A+B) as well as (TOTAL-A-B)/TOTAL
(i.e. percentage of buffer shown).

I don't think it's urgent, so we should take the time to try and figure
out what %P users want.


        Stefan






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-17 23:26   ` Alan Mackenzie
  2008-11-18  3:47     ` Stefan Monnier
@ 2008-11-18 18:17     ` James Cloos
  1 sibling, 0 replies; 10+ messages in thread
From: James Cloos @ 2008-11-18 18:17 UTC (permalink / raw)
  To: 1355

I just noticed this one.

I have to say that: "Top" is indeed better than "0%" or "00%"; "Bot",
as RMS wrote, gives more info and should remain as is; and I use that
info even in a GUI with a scroll bar -- it is often more informative
than the bar can be.

I hope the default at least remains as is.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1355: suggestion on the modeline
  2008-11-16  1:09 bug#1355: suggestion on the modeline xah lee
  2008-11-17  2:57 ` Richard M. Stallman
@ 2020-09-19 21:59 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-19 21:59 UTC (permalink / raw)
  To: xah lee; +Cc: 1355

xah lee <xah@xahlee.org> writes:

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

Some discussion followed, but there didn't seem to be much enthusiasm
for the new defaults proposed by the patch.  So I'm closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-19 21:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-16  1:09 bug#1355: suggestion on the modeline xah lee
2008-11-17  2:57 ` Richard M. Stallman
2008-11-17 23:26   ` Alan Mackenzie
2008-11-18  3:47     ` Stefan Monnier
2008-11-18  9:42       ` Juanma Barranquero
2008-11-18 10:37         ` Alan Mackenzie
2008-11-18 10:37           ` Juanma Barranquero
2008-11-18 16:30           ` Stefan Monnier
2008-11-18 18:17     ` James Cloos
2020-09-19 21:59 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).