From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#9919: 24.0.91; font-lock broken in dired Date: Mon, 09 Jan 2012 17:36:51 -0500 Message-ID: References: <1161A09A8D6E494CBF91D53B99D5FBC2@us.oracle.com> <86k47fuzce.fsf@googlemail.com> <01BD44CE3569404796A5C8252DDA7BDB@us.oracle.com> <7F9343C4FA564C29BE7E8576E5A25183@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1326148684 29260 80.91.229.12 (9 Jan 2012 22:38:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 9 Jan 2012 22:38:04 +0000 (UTC) Cc: 9919@debbugs.gnu.org To: "Drew Adams" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 09 23:37:59 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RkNqo-0002qO-Fk for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Jan 2012 23:37:58 +0100 Original-Received: from localhost ([::1]:51782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkNqm-0005A1-N2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Jan 2012 17:37:56 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:47124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkNqe-0004wd-Pp for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2012 17:37:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkNqc-0003I9-SQ for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2012 17:37:48 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkNqc-0003I5-Mk for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2012 17:37:46 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RkNqs-0004Gh-2F for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2012 17:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Jan 2012 22:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9919 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9919-submit@debbugs.gnu.org id=B9919.132614863116338 (code B ref 9919); Mon, 09 Jan 2012 22:38:02 +0000 Original-Received: (at 9919) by debbugs.gnu.org; 9 Jan 2012 22:37:11 +0000 Original-Received: from localhost ([127.0.0.1]:51417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RkNq3-0004FT-HK for submit@debbugs.gnu.org; Mon, 09 Jan 2012 17:37:11 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:51430) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RkNq0-0004FH-RK for 9919@debbugs.gnu.org; Mon, 09 Jan 2012 17:37:10 -0500 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q09MapWB007629; Mon, 9 Jan 2012 17:36:51 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id CE803B4177; Mon, 9 Jan 2012 17:36:51 -0500 (EST) In-Reply-To: <7F9343C4FA564C29BE7E8576E5A25183@us.oracle.com> (Drew Adams's message of "Mon, 9 Jan 2012 10:59:58 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4096=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4096> : streams <718246> : uri <1043809> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:55591 Archived-At: >> > I am still getting reports about this wrt dired+.el from users on >> > GNU/Linux. So perhaps my workaround is not sufficient there - dunno. >> Whenever you change font-lock-defaults, you need to cause >> font-lock-keywords (and the text already font-locked) to be refreshed, >> unless you know for sure that font-lock-mode has not yet been started. > Your "whenever" obviously does not apply to Emacs 20-22, since > `font-lock-refresh-defaults' does not even exist in those releases. It does: notice I don't mention font-lock-refresh-defaults which merely makes it easy (it was introduced just to make it easier to solve this problem). > And at least for my code, "whenever" is true only for Emacs 24, not > Emacs 23 (which also has `font-lock-refresh-defaults'). And the > problem did not exist in Emacs 24 either, until the build where > I reported the bug. No, your code was wrong and always has been: you change only font-lock-defaults, whereas you do not know for a fact that font-lock-mode has not yet been enabled. In earlier Emacsen, in normal circumstances, you just got lucky. > I have this code, which has always worked and still works with Emacs > 20 through 23.3: Code that works in practice doesn't mean correct code. > (add-hook > 'dired-mode-hook > (lambda () > (set (make-local-variable 'font-lock-defaults) > (cons '(dired-font-lock-keywords diredp-font-lock-keywords-1) > (cdr font-lock-defaults))) Great. Now after running the above code, the user adds (add-hook 'dired-mode-hook (lambda () (font-lock-mode 1))) and suddenly the bug shows up even in Emacs-23. >> I don't see any evidence of a performance problem. > This means, in effect, that fontification must now be done twice, or > else it is incorrect. That's the performance hit I meant: > font-locking twice. Evidence of a performance problem requires measures, times, things like that. You're talking about some hypothetical problem based on your understanding of how things work. Things don't always work the way we think they do. We have plenty of hypothetical performance problems in Emacs that I'm not going to worry about them. > What's the cause of this change/regression? Nothing very deep. The moment when font-lock-mode gets enabled has changed. I'm not convinced the new time is really much better, but I'm not convinced the old time was better either. Basically it used to be enabled after running the mode hook, which made it difficult to disable font-lock-mode via a mode-hook check, wherea now it gets enabled before, so you can just do (add-hook 'dired-mode-hook (lambda () (if foo (font-lock-mode -1)))) -- Stefan