all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Hannu Koivisto <azure@iki.fi>, emacs-devel@gnu.org
Subject: Re: First fontification of a buffer happens before font lock is fully initialised.
Date: Tue, 7 Feb 2012 10:10:08 +0000	[thread overview]
Message-ID: <20120207101008.GB3314@acm.acm> (raw)
In-Reply-To: <jwvobtchhoo.fsf-monnier+emacs@gnu.org>

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

OK.

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

> - 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	other threads:[~2012-02-07 10:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 12:48 First fontification of a buffer happens before font lock is fully initialised Alan Mackenzie
2012-01-25 17:46 ` Stefan Monnier
2012-01-25 18:26   ` Alan Mackenzie
2012-01-25 19:22     ` Hannu Koivisto
2012-01-25 20:22       ` Alan Mackenzie
2012-01-26  1:43     ` Stefan Monnier
2012-01-26 10:58       ` Alan Mackenzie
2012-02-04 12:03       ` Alan Mackenzie
2012-02-06  1:39         ` Stefan Monnier
2012-02-07 10:10           ` Alan Mackenzie [this message]
2012-02-07 18:02             ` Stefan Monnier
2012-02-08 21:43               ` Alan Mackenzie
2012-02-10 14:27                 ` Stefan Monnier
2012-02-23 11:39                   ` Alan Mackenzie
2012-02-23 14:34                     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120207101008.GB3314@acm.acm \
    --to=acm@muc.de \
    --cc=azure@iki.fi \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.