GNU bug report logs - #9919
24.0.91; font-lock broken in dired

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 31 Oct 2011 15:15:02 UTC

Severity: normal

Tags: notabug

Merged with 6662

Found in versions 24.0.50, 24.0.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Forwarded to http://lists.gnu.org/archive/html/emacs-devel/2010-07/msg01057.html

Full log


Message #30 received at 9919 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 9919 <at> debbugs.gnu.org
Subject: RE: bug#9919: 24.0.91; font-lock broken in dired
Date: Mon, 9 Jan 2012 10:59:58 -0800
> > 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.

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.

I have this code, which has always worked and still works with Emacs 20 through
23.3:

(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)))

    ;; Emacs 24+: Need to refresh `font-lock-keywords' from
`font-lock-defaults'.
    (when (fboundp 'font-lock-refresh-defaults) (font-lock-refresh-defaults))))

The last bit, which invokes `font-lock-refresh-defaults', I had to add for Emacs
24.

Similarly, for buff-menu+.el, I need to do likewise on `buffer-menu-mode-hook'.
Again, this workaround is needed only for Emacs 24.

> > In any case, this is a regression and a performance problem.
> 
> 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.  What has
always given correct fontification before with a single fontification (and still
does, in the published Emacs releases) now does not, I must re-fontify
completely.

Am I missing something here?  Is there a way to get what's needed without
fontifying twice?  That's expensive.  What's the cause of this
change/regression?  Thx.





This bug report was last modified 13 years and 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.