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: Tue, 16 May 2017 20:37:59 +0000 Message-ID: <20170516203759.GA5238@acm.fritz.box> References: <20170515204416.GA7349@acm.fritz.box> <8337c57bgj.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1494967186 9841 195.159.176.226 (16 May 2017 20:39:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 16 May 2017 20:39:46 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 16 22:39:41 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 1dAjFs-0002QM-PA for ged-emacs-devel@m.gmane.org; Tue, 16 May 2017 22:39:40 +0200 Original-Received: from localhost ([::1]:43884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAjFy-0007kF-CU for ged-emacs-devel@m.gmane.org; Tue, 16 May 2017 16:39:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAjFE-0007k8-W7 for emacs-devel@gnu.org; Tue, 16 May 2017 16:39:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAjFA-00087u-5S for emacs-devel@gnu.org; Tue, 16 May 2017 16:39:01 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:16209 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1dAjF9-000871-P8 for emacs-devel@gnu.org; Tue, 16 May 2017 16:38:56 -0400 Original-Received: (qmail 18408 invoked by uid 3782); 16 May 2017 20:38:54 -0000 Original-Received: from acm.muc.de (p548C6F9C.dip0.t-ipconnect.de [84.140.111.156]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 16 May 2017 22:38:53 +0200 Original-Received: (qmail 5383 invoked by uid 1000); 16 May 2017 20:37:59 -0000 Content-Disposition: inline In-Reply-To: <8337c57bgj.fsf@gnu.org> 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:214892 Archived-At: 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 > > > > 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"; . 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).