From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#1355: suggestion on the modeline Date: Mon, 17 Nov 2008 23:26:48 +0000 Message-ID: <20081117232648.GA9335@muc.de> References: Reply-To: Alan Mackenzie , 1355@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1226964629 30720 80.91.229.12 (17 Nov 2008 23:30:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2008 23:30:29 +0000 (UTC) Cc: xah lee , bug-gnu-emacs@gnu.org, bug-submit-list@donarmstrong.com To: rms@gnu.org, 1355@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 18 00:31:31 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L2DZ2-0008WB-DY for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Nov 2008 00:31:28 +0100 Original-Received: from localhost ([127.0.0.1]:42450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2DXt-00076P-UL for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Nov 2008 18:30:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2DXq-000768-6J for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2008 18:30:14 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2DXp-00075w-IY for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2008 18:30:13 -0500 Original-Received: from [199.232.76.173] (port=42390 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2DXp-00075t-Ed for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2008 18:30:13 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:49013) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L2DXo-00039Y-Rj for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2008 18:30:13 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mAHNU8FY010576; Mon, 17 Nov 2008 15:30:09 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mAHNK39k007719; Mon, 17 Nov 2008 15:20:03 -0800 X-Loop: don@donarmstrong.com Resent-From: Alan Mackenzie Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 17 Nov 2008 23:20:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1355 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12269636826378 (code B ref -1); Mon, 17 Nov 2008 23:20:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 17 Nov 2008 23:14:42 +0000 Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mAHNEdK0006371 for ; Mon, 17 Nov 2008 15:14:40 -0800 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2DIk-0003Xy-UL for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2008 18:14:38 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2DIj-0003XP-7E for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2008 18:14:38 -0500 Original-Received: from [199.232.76.173] (port=48234 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2DIj-0003XM-4f for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2008 18:14:37 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:3680 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L2DIi-00026W-He for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2008 18:14:36 -0500 Original-Received: (qmail 47334 invoked by uid 3782); 17 Nov 2008 23:14:28 -0000 Original-Received: from acm.muc.de (pD9E5292D.dip.t-dialin.net [217.229.41.45]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Tue, 18 Nov 2008 00:14:26 +0100 Original-Received: (qmail 9550 invoked by uid 1000); 17 Nov 2008 23:26:48 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-CrossAssassin-Score: 2 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Mon, 17 Nov 2008 18:30:13 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:22448 Archived-At: Hi, R and X! On Sun, Nov 16, 2008 at 09:57:21PM -0500, Richard M. Stallman wrote: > The cursor location percentage should by default not shown if > emacs is running in GUI with scroll bar. > Maybe so. > When emacs is running in a terminal, the special indicator > Top and Bot should be shown as percentage as usual, > "Top" is equivalent to 00%, and showing "00%" instead would > be just as good. However, "Bot" gives you other information: > that the bottom of the buffer is on the screen. Incidentally, I think the wrong percentage is displayed. Assuming that the window shows part of the buffer, there's stuff above, stuff below, like this: a ^ a | a | a | W | ^ W | | W | | W buffer window W | | W | | W | v b | b | b | b v , the percentage currently displayed is a / (a + W + b). So, although in the picture, the window is showing the middle of the buffer, the percentage displayed is 22%, rather than 50%. This is particularly jarring when scrolling through, perhaps, an info page. You see 47%, then two lines later, Bot. A better calculation would be a / (a + b), the degree of "travel" of the windown through the buffer. This approaches 100% as the window reaches the bottom of the buffer. I've been using this for many years now. Here's how: [ Emacs 22.3 ] *** xdisp.orig.c 2008-08-26 15:45:44.000000000 +0000 --- xdisp.c 2008-09-12 13:59:17.000000000 +0000 *************** *** 18033,18041 **** case 'p': { int pos = marker_position (w->start); ! int total = BUF_ZV (b) - BUF_BEGV (b); ! if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) { if (pos <= BUF_BEGV (b)) return "All"; --- 18033,18043 ---- case 'p': { int pos = marker_position (w->start); ! int bottpos = BUF_Z (b) - XFASTINT (w->window_end_pos); /* ACM */ ! int totnotdisp = BUF_ZV (b) - BUF_BEGV (b) - (bottpos - pos); /* ACM */ ! int total ; ! if ((bottpos >= BUF_ZV (b)) || (totnotdisp <= 0)) /* ACM */ { if (pos <= BUF_BEGV (b)) return "All"; *************** *** 18046,18056 **** return "Top"; else { ! if (total > 1000000) /* Do it differently for a large value, to avoid overflow. */ ! total = ((pos - BUF_BEGV (b)) + (total / 100) - 1) / (total / 100); else ! total = ((pos - BUF_BEGV (b)) * 100 + total - 1) / total; /* We can't normally display a 3-digit number, so get us a 2-digit number that is close. */ if (total == 100) --- 18048,18060 ---- return "Top"; else { ! if (totnotdisp > 1000000) /* Do it differently for a large value, to avoid overflow. */ ! total = ((pos - BUF_BEGV (b)) + (totnotdisp / 100) - 1) ! / (totnotdisp / 100); /* ACM */ else ! total = ((pos - BUF_BEGV (b)) * 100 + totnotdisp - 1) ! / totnotdisp ; /* ACM */ /* We can't normally display a 3-digit number, so get us a 2-digit number that is close. */ if (total == 100) -- Alan Mackenzie (Nuremberg, Germany).