From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#12867: 24.3.50; easy-to-repro crash involving mode line Date: Mon, 12 Nov 2012 17:40:35 +0200 Message-ID: <83obj2x218.fsf@gnu.org> References: <77CAAFE4D0CE4DD98476C996E3158648@us.oracle.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1352734846 12254 80.91.229.3 (12 Nov 2012 15:40:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Nov 2012 15:40:46 +0000 (UTC) Cc: 12867@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 12 16:40:56 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TXw87-00045i-UL for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Nov 2012 16:40:56 +0100 Original-Received: from localhost ([::1]:38014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXw7y-0000Ij-Fd for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Nov 2012 10:40:46 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXw7s-0000Fm-M1 for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2012 10:40:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TXw7p-00037L-Jh for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2012 10:40:40 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXw7p-00037H-Fu for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2012 10:40:37 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TXw8D-0004G0-PY for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2012 10:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Nov 2012 15:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12867 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12867-submit@debbugs.gnu.org id=B12867.135273485616354 (code B ref 12867); Mon, 12 Nov 2012 15:41:01 +0000 Original-Received: (at 12867) by debbugs.gnu.org; 12 Nov 2012 15:40:56 +0000 Original-Received: from localhost ([127.0.0.1]:35583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TXw87-0004Fi-PH for submit@debbugs.gnu.org; Mon, 12 Nov 2012 10:40:56 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:63518) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TXw7z-0004FU-LQ for 12867@debbugs.gnu.org; Mon, 12 Nov 2012 10:40:49 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MDD00H00SSVR500@a-mtaout22.012.net.il> for 12867@debbugs.gnu.org; Mon, 12 Nov 2012 17:40:20 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MDD00HU1SV841C0@a-mtaout22.012.net.il>; Mon, 12 Nov 2012 17:40:20 +0200 (IST) In-reply-to: <77CAAFE4D0CE4DD98476C996E3158648@us.oracle.com> X-012-Sender: halo1@inter.net.il X-Spam-Score: 1.5 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-Spam-Score: 1.5 (+) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66797 Archived-At: > From: "Drew Adams" > Date: Sun, 11 Nov 2012 19:52:09 -0800 > > emacs -Q > > (defun foo () > (set (make-local-variable 'mode-line-position) > '("%99l (line)")) > (set (make-local-variable 'mode-line-format) > '(("" mode-name mode-line-position)))) > > M-: (foo) > > No problem. The line number is shown at the far right, padded on the > left (see bug #12866). You might need to widen the window/frame to see > it. But no problem. > > Now change 99 to 999 and repeat M-: (foo). Still no problem. Now, no > matter how big you make the window or how small you make the font, the > line number has probably moved off the screen at the right, so you no > longer see it. Good (what I wanted). > > Now change the value to 9999. Crash. Fixed in revision 110850 on the emacs-24 branch. (The value 999 was already too large, btw, it just didn't cause an immediate crash by sheer luck. The maximum width is 4 times the width of the frame, and with the above revision, you are limited to that maximum.) > I want to use the fact that a %l construct in the mode line enables you > to do something dynamic when the cursor moves to another line. May I inquire why you don't use the (:eval FORM) construct? IIUC, this does exactly what you want and is supported since Emacs 21.1. > 1. The %l construct must be present in the `mode-line-format'. > 2. Its resulting line-number text must not have property `invisible'. The need to redisplay the mode line on every move of point is a killer of many redisplay optimizations. It is also potentially expensive by itself, because it requires Emacs to count lines, something that is not an easy operation in Emacs, which sees the buffer text as a linear array of characters, not a series of lines. So the display engine tries very hard to avoid redisplaying the mode line if it decides that the line number does not need to appear. This is probably the explanation for what you see. Still, it is not entirely clear to me what "must" means in this context, so please show the mode-line spec you tried and tell what didn't work when 1 or 2 above was not true. Maybe there's something else involved. > Besides fixing the crash, it would be great if I did not have to resort > to such an ugly hack in the first place. > > Presumably, this feature of dynamic line-sensitive updating is buried in > the bowels of Emacs C code, so not available to Lisp users to tweak. > Must this feature really be tied to an actual display of the line > number? If so, can't we at least make that text invisible? If :eval doesn't fit the bill, please tell why. If there's need to make changes in the display engine to support the feature you want to implement, I'd prefer to invest the energy in providing a clean solution, rather than making mode-line-position serve as a back door for such ugly hacks. > Regardless, it would also be good if this feature (line-sensitive > updating) were documented. I could find nothing that even hinted at it. Sorry, I don't understand: what is undocumented? If you are talking about refreshing mode-line-position, then shouldn't it be obvious that it's refreshed on every move of point?