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: Thu, 18 May 2017 21:22:51 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Dani.

On Thu, May 18, 2017 at 21:16:06 +0200, Dani Moncayo wrote:
> On Wed, May 17, 2017 at 11:32 PM, Alan Mackenzie <address@hidden> wrote:
> > Hello, Eli and Dani.

> Hi Alan, thanks for working on this.

> > For %q, I haven't included the parentheses Dani suggested, and it's a
> > bit DWIMy, with things like "All", "Top-5%", "63%-Bot", "15-25%".

> > Just to save you some work, I found the following useful for trying them
> > out, by setting the pertinent part of the standard mode-line format.
> > (i) (For %O): (aset (cadr (car mode-line-position)) 1 ?O)
> > (ii) (For %q): (aset (cadr (car mode-line-position)) 1 ?q)
> >       and      (setcar (car mode-line-position) -7)

> > Thoughts?

> Wrt %q, I find the format to be too irregular.

OK.

> I'd prefer to stick to "N-M%" (with no whitespace around the hyphen),
> ....

Er, the WS was unintentional.  Sorry!  I can do a bit of other tidying
up on that code, too.

> .... even when N is 0 or M is 100.  The only exception to that format
> would be when N=0 _and_ M=100, in which case I'd prefer "All" rather
> than "0-100%".

Presumably truncating the number to 99%, except when the window is right
at the bottom of the buffer.  The rounding up to 1% is already done by
the SW.

> Also, I'd like the whole text related to %q to take a
> constant amount of space in the modeline, to avoid shifting any text
> to the right side of %q.

I'm not sure that's the Right Thing.  This would take up 7 characters +
at least one space (compared with the current 3 characters + at least
one space for "%p") for "99-100%".  That's an awful lot of mode-line
space.  I would be tempted to scale it back to 6 characters (for
"54-59%") which is the "usual" maximum width, and take the hit when we
reach "99-100%", by expanding to 7 characters then.

So, the range of formats we'd deal with would be:
"All   "
"0-5%  "
"4-11% "
"31-38%"
"99-99%"
"99-100%"
, the last one happening only when EOB is visible in the window.  This
doesn't take up any more space than my proposed "99%-Bot", which is also
7 characters.

Somehow I think even "100-100%" might be possible, if the window were at
EOB, and the buffer were narrowed to zero characters (if that is
possible - I'm not sure it is).  Or, maybe that would be handled by "All
".

I haven't had time to make any changes this evening - I've been working
on the code to select the "percentage offset" formula by a customisable
variable.  Maybe we can finalise this change by the weekend.

> Thanks.

> -- 
> Dani Moncayo

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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