[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: First fontification of a buffer happens before font lock is fully in

From: Alan Mackenzie
Subject: Re: First fontification of a buffer happens before font lock is fully initialised.
Date: Tue, 7 Feb 2012 10:10:08 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hello, Stefan.

On Sun, Feb 05, 2012 at 08:39:00PM -0500, Stefan Monnier wrote:
> >> Yes, I agree.  This was the behavior in Emacs-20, and is also the
> >> behavior with jit-lock (i.e. the default behavior).  I'm not sure what's
> >> the best way to get that result, tho: adding yet-another keyword to
> >> define-minor-mode is something I'd rather avoid.
> > I can only see one other way to deal with this: that is to write
> > `font-lock-mode' explicitly; or rather, expand the macro by hand, tidy it
> > up, and move the `run-hooks'.

> Moving away from define-minor-mode is also something I'd rather avoid
> (so we don't have to update font-lock-mode every time we change
> define-minor-mode).


> Some other thoughts:
> - use some trick to delay the fontification to after the minor-mode hook
>   is run (e.g. add to post-command-hook or something like that).
>   post-command-hook is not a good choice and I can't think of much
>   better, so maybe this is out.

post-command-hook _is_ ugly, and we don't want one-time code running in

> - maybe it's OK to add yet another argument to define-minor-mode.

define-minor-mode is insufficiently general, so something has to give.

>   Note that an arg that says "turn off this standard thingy" (as
>   in :no-hook) is out of the question, since a large part of the reason
>   why we have define-minor-mode is to try and auto-enforce the coding
>   conventions of minor modes.

Can we not trust the good taste and sense of hackers generally?  We can
certainly trust the Emacs developers.

>   But maybe we can have an :after-hook.  Some major modes would also
>   appreciate such a feature, so maybe this same arg can be added to
>   both define-minor-mode and define-derived-mode.

Or, perhaps, even (defmacro run-hooks-here () ...), which would preserve
the order of the initialisation forms in the mode.  But I'd be happy
enough with :after-hook.  Would you like me to implement it?

>         Stefan

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]