From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel 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 Message-ID: <20170518212251.GA6248@acm.fritz.box> References: <20170515204416.GA7349@acm.fritz.box> <8337c57bgj.fsf@gnu.org> <20170516203759.GA5238@acm.fritz.box> <20170517213237.GA4156@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1495142642 3385 195.159.176.226 (18 May 2017 21:24:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 May 2017 21:24:02 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: Emacs development discussions To: Dani Moncayo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 18 23:23:54 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBStm-0000ft-9e for ged-emacs-devel@m.gmane.org; Thu, 18 May 2017 23:23:54 +0200 Original-Received: from localhost ([::1]:55600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBStr-0000un-Nq for ged-emacs-devel@m.gmane.org; Thu, 18 May 2017 17:23:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBStm-0000ud-7r for emacs-devel@gnu.org; Thu, 18 May 2017 17:23:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBSth-0005Ec-9Z for emacs-devel@gnu.org; Thu, 18 May 2017 17:23:54 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:55135 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1dBStg-0005E5-To for emacs-devel@gnu.org; Thu, 18 May 2017 17:23:49 -0400 Original-Received: (qmail 86301 invoked by uid 3782); 18 May 2017 21:23:46 -0000 Original-Received: from acm.muc.de (p548C6FCF.dip0.t-ipconnect.de [84.140.111.207]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 18 May 2017 23:23:46 +0200 Original-Received: (qmail 6400 invoked by uid 1000); 18 May 2017 21:22:51 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214965 Archived-At: 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 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).