all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Dani Moncayo <dmoncayo@gmail.com>
Cc: Emacs development discussions <emacs-devel@gnu.org>
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	[thread overview]
Message-ID: <20170518212251.GA6248@acm.fritz.box> (raw)
In-Reply-To: <CAH8Pv0hPycJr+VkNGO+AH7iwVg42a5RkpDL58v3f_MWC9t+ESw@mail.gmail.com>

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 <acm@muc.de> 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	other threads:[~2017-05-18 21:22 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 20:44 Proposal: new mode-line `%'-construct %o meaning "Degree of travel of window through buffer" Alan Mackenzie
2017-05-15 23:27 ` Paul Eggert
2017-05-15 23:29   ` Drew Adams
2017-05-15 23:54 ` Kaushal Modi
2017-05-16  0:38 ` Noam Postavsky
2017-05-16  1:15   ` Clément Pit-Claudel
2017-05-16  2:47     ` Eli Zaretskii
2017-05-18  1:15   ` Perry E. Metzger
2017-05-18  4:28     ` Eli Zaretskii
2017-05-18 16:01       ` Perry E. Metzger
2017-05-18 16:18         ` Eli Zaretskii
2017-05-18 16:45           ` Perry E. Metzger
2017-05-18 19:43             ` Eli Zaretskii
2017-05-18 20:13               ` Perry E. Metzger
2017-05-18 20:25                 ` Eli Zaretskii
2017-05-18 20:51                   ` Perry E. Metzger
2017-05-19  6:17                     ` Eli Zaretskii
2017-05-22  2:22                       ` Kaushal Modi
2017-05-22  4:13                         ` Eli Zaretskii
2017-05-22 13:38                           ` Kaushal Modi
2017-05-22 18:20                             ` Alan Mackenzie
2017-05-22 18:55                               ` Kaushal Modi
2017-05-16  3:00 ` Eli Zaretskii
2017-05-16  3:35   ` Noam Postavsky
2017-05-16 20:37   ` Alan Mackenzie
2017-05-17  2:30     ` Eli Zaretskii
2017-05-17 21:32     ` Alan Mackenzie
2017-05-18 19:16       ` Dani Moncayo
2017-05-18 21:22         ` Alan Mackenzie [this message]
2017-05-19  5:32         ` Yuri Khan
2017-05-16  7:22 ` Andreas Schwab
2017-05-16 10:05   ` Dani Moncayo
2017-05-16 13:31     ` Drew Adams
2017-05-16 18:59     ` Toon Claes
2017-05-16 20:56       ` John Yates
2017-05-20 10:34 ` Proposal: new mode-line `%'-construct %o meaning "Degree of travel of window through buffer". [Patch] Alan Mackenzie
2017-05-21 15:55   ` Difficulty applying multi-file patches from within emacs (Was: Proposal: new mode-line `%'-construct %o ..) Kaushal Modi
2017-05-21 16:04     ` Noam Postavsky
2017-05-22  1:19       ` Kaushal Modi
2017-05-22  2:35         ` Noam Postavsky
2017-05-21 16:08     ` Difficulty applying multi-file patches from within emacs Alan Mackenzie
2017-05-21 17:20       ` Philipp Stephani
2017-05-21 17:39         ` Alan Mackenzie
2017-05-22  1:21           ` Kaushal Modi
2017-05-22  1:23             ` Kaushal Modi
2017-05-23 11:21     ` Difficulty applying multi-file patches from within emacs (Was: Proposal: new mode-line `%'-construct %o ..) Tino Calancha
2017-05-23  8:00   ` Proposal: new mode-line `%'-construct %o meaning "Degree of travel of window through buffer". [Patch] Dani Moncayo
2017-05-23 20:24     ` Alan Mackenzie
2017-05-24 10:45       ` Dani Moncayo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170518212251.GA6248@acm.fritz.box \
    --to=acm@muc.de \
    --cc=dmoncayo@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.