Subject: RE: bug#9919: 24.0.91; font-lock broken in dired

From: "Drew Adams" <[email-masked]>
Date: Mon, 9 Jan 2012 16:04:19 -0800

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

OK, so Emacs broke it in 23 instead of 24. ;-)  That does not happen in Emacs
20-22 AFAICT.  What's the gotcha for Emacs 20-22?  What does a user need to do
in Emacs 20-22 to show that this code won't DTRT?

Let me put it this way: I've never seen the problem in Emacs 20-22, and I've
never received a report from anyone mentioning such a problem with that code.

Did you receive any Emacs 20-22 bug reports, for example, from users who, like
me, did not understand that such problematic behavior was inherent?

Not that such reports would have corresponded to real bugs, from what you say,
but presumably there would have been at least someone who was bitten by what you
say has always been an inherent gotcha/problem.

I'm just curious why this is manifested in 24 without doing anything, and in 23
if you do as you note above, but not at all (AFAICT) in 20-22.

> > 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.

Was that change made in Emacs 23 or 24?  See my question above - just trying to
understand the differences between (a) 20-22, (b) 23, and (c) 24.

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

I see.  Thanks for the explanation.  Makes sense.