emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposal: new mode-line `%'-construct %o meaning "Degree of travel o


From: Alan Mackenzie
Subject: Re: Proposal: new mode-line `%'-construct %o meaning "Degree of travel of window through buffer".
Date: Tue, 16 May 2017 20:37:59 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Eli.

On Tue, May 16, 2017 at 06:00:12 +0300, Eli Zaretskii wrote:
> > Date: Mon, 15 May 2017 20:44:17 +0000
> > From: Alan Mackenzie <address@hidden>
> > 
> > Numerically, "%p" is 100 * a / (a + W + b).
> > 
> > "%o" is 100 * a / (a + b).

> Isn't it better to display 100 * (a + W/2) / (a + W + b) instead?

> This shows the portion of buffer before the window-center.  It will
> show 50% in the first use case and 73% in the second.  IMO, showing
> 98% in the second case sounds misleading, not unlike the current 49%,
> because it effectively disregards the text inside the window, and thus
> can lead to skewed estimations when the part inside the window is
> non-negligible relative to the part that outside.

I think the 100 * a / (a + b) is better, but that's likely to be just my
personal preference.  Why can't we have 100 * (a + W/2) / (a + W + b) as
well?  It is easily added.  Maybe we could denote that by %O.

Your other idea, that of having a customizable option for a user to
indicate his preference for how to display the approximate buffer/window
position will, I think, be somewhat more tedious to implement.

How about this as a design?  We introduce a new variable
`mode-line-window-position', which will be a short propertised string
typically holding "%p", "%P", or "%o" (or even "%O") with the properties
currently on the corresponding part of mode-line-position.
The new `mode-line-position' "includes" `mode-line-window-position' in
the standard `mode-line-format' way.

We also introduce a new customizable variable to set it with, which will
take one of these values:
  nil: don't display the window position at all;
  'top: display the window position with "%p";
  'bottom: display it with "%P";
  'middle: display it with (the proposed) "%O";
  'travel: display it with "%o";
  <further possibilities, such as "(23-30%)" mentioned by somebody>.

That new variable will have as a :set value the (new) function
`mode-line-generate-window-position', which will do the obvious thing.

I must admit, I find it a little dispiriting that `mode-line-format',
which used to be a user settable variable isn't really one any more, and
we've got to use defcustoms and such like to make this variable
tractable.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]