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 19:52:34 +0200 Message-ID: <83ehjywvx9.fsf@gnu.org> References: <77CAAFE4D0CE4DD98476C996E3158648@us.oracle.com> <83obj2x218.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1352742767 23512 80.91.229.3 (12 Nov 2012 17:52:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Nov 2012 17:52:47 +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 18:52:57 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 1TXyBs-0001Ng-0q for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Nov 2012 18:52:56 +0100 Original-Received: from localhost ([::1]:42191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXyBi-0008S5-Iq for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Nov 2012 12:52:46 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXyBd-0008Rv-54 for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2012 12:52:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TXyBa-0000AU-3a for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2012 12:52:41 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXyBZ-0000AQ-Ur for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2012 12:52:38 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TXyBy-0007KQ-Fz for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2012 12:53:02 -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 17:53:02 +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.135274277028152 (code B ref 12867); Mon, 12 Nov 2012 17:53:02 +0000 Original-Received: (at 12867) by debbugs.gnu.org; 12 Nov 2012 17:52:50 +0000 Original-Received: from localhost ([127.0.0.1]:35854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TXyBm-0007K0-4p for submit@debbugs.gnu.org; Mon, 12 Nov 2012 12:52:50 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:44255) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TXyBi-0007Jp-LF for 12867@debbugs.gnu.org; Mon, 12 Nov 2012 12:52:48 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MDD00L00YVWG000@a-mtaout20.012.net.il> for 12867@debbugs.gnu.org; Mon, 12 Nov 2012 19:52:19 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MDD00L77YZ72SA0@a-mtaout20.012.net.il>; Mon, 12 Nov 2012 19:52:19 +0200 (IST) In-reply-to: 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:66808 Archived-At: > From: "Drew Adams" > Cc: <12867@debbugs.gnu.org> > Date: Mon, 12 Nov 2012 09:09:43 -0800 > > That is, %l triggers redisplay when the current line changes. It is that > triggering that I miss otherwise; it is not evaluating to produce the right > display (e.g. using :eval), once redisplay is triggered. So you want to be able to trigger redisplay of the mode line at will, without being forced to have a line number display on the mode line, is that it? Or do you only want to trigger redisplay of mode line when the current line changes? If the latter, then what is so special about changing the current line that you want mode line redisplayed only at that time? > Yes, I could instead use, say, `post-command-hook' and `force-mode-line-update' > if the line changes. But %l triggers mode-line redisplay on line changes, and > it seems to me better to let it do the triggering than to call `count-lines' in > a Lisp function on `post-command-hook'. Yes, post-command-hook is ugly and expensive. But you should know that %l is not ideal either: e.g., if display of the line numbers is disabled because the file is too large or the lines are too long, and Emacs displays "???" instead of the number, I think mode line is not redisplayed when the current line changes. Again, because Emacs tries very hard to avoid this costly redisplay. > I will be glad to find a way to simplify the code and remove this ugly little > hack. Suggestions welcome. A user option sounds like the right approach. But we should first formulate the conditions under which this redisplay will be performed. Doing that only when the line number changes sounds too ad-hoc to me. Can we come up with something more general? E.g., would redisplaying the mode line on _every_ redisplay cycle (under the new option) be acceptable? Anyway, it looks like this discussion should continue in another bug report, as the crash is solved. > (defun foo () > (set (make-local-variable 'mode-line-position) > '(:propertize "%l (line)" invisible t)) > (set (make-local-variable 'mode-line-format) > '(("" mode-name mode-line-position)))) > > I thought that something I tried earlier using text property `invisible' made > all of the text invisible, including the line #, but also broke the dynamic > update wrt current line. Perhaps I was mistaken about that - perhaps the code I > was testing just led to an error that somehow prevented the %l formatted text > from being used at all. Dunno. > > (The symptom was that the line number did not appear in the mode line, and the > mode line was not updated wrt current-line changes. And I did not get the > *invalid* mode-line-format display that typically indicates a mode-line > display/formatting error.) > > But at any rate, trying the code above you can see that it does not make the > line number itself disappear. Shouldn't it? Or perhaps I am missing something > and there is a simple way to make that text invisible? Did you try the syntax used in bindings.el? It's ",(propertize ...", perhaps that's what you should do as well to make the text invisible. > What is not so obvious is that you can automatically update anything at all in > the mode line when the cursor changes line, as long as you include %l somewhere > in the `mode-line-format'. IOW, %l triggers mode-line redisplay when you change > lines, and your mode-line code can take advantage of that. (But you must show > the line number as well.) Yes, and there are other complications (see above about "???"), all of them artifacts of the implementation details. I don't think this should be documented, because it can change without notice.