unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: font-lock-extend-region-function: Final refinements.
Date: Sun, 6 Aug 2006 14:48:49 +0100	[thread overview]
Message-ID: <20060806134849.GA1245@muc.de> (raw)
In-Reply-To: <jwvbqr0obuc.fsf-monnier+emacs@gnu.org>

Hi, Stefan!

On Fri, Aug 04, 2006 at 10:59:05AM -0400, Stefan Monnier wrote:
> >> > One small point - there are slightly different mechanisms in
> >> > jit-lock-after-change and font-lock-after-change-function for
> >> > extending the region.  Is there a reason for this?

> >> Yes.

> >> Basically here is what happens in f-l-after-change:
> >> A1 - obey f-l-extend-after-change-function.

> >> Here is what happens in j-l-after-change (via
> >> f-l-extend-jit-lock-region-after-change):
> >> B1 - obey f-l-extend-after-change-function.
> >> B2 - obey font-lock-multiline (just once: no looping).
> >> B3 - round up to whole lines.

> >> - A1 == B1.

> > That's not quite true.  B1 uses
> > j-l-after-change-extend-region-functions, which has the same purpose
> > as f-l-extend-after-change-function, but a different calling
> > convention.  I can't see any reason why these two need to be
> > different - it seems to be an unnecessary complication.

> jit-lock.el is a package that provides a service used by font-lock.el
> and glasses.el and potentially many more packages.  Do a grep for
> `font-lock' in jit-lock.el and you'll see that it's only mentioned in
> docstrings and comments.

I don't understand what you're saying here - what is the relevance of
that fact to the way the hook functions get used?

> j-l-after-change-extend-region-functions is a hook provided by jit-lock
> for its client packages.

What do you mean by "client packages" here.  Is this things like
glasses.el?  Does it include font-lock.el, does it include foo-mode.el?
Are you saying that j-l-a-c-extend-region-f is a hook purely for the use
of font-lock itself (i.e. only in the three files font-lock.el,
font-core.el and jit-lock.el)?

> font-lock uses it [j-l-after-change-extend-region-functions] for
> various purposes, including to run its own
> f-l-extend-after-change-function.

I'm fairly confused at the moment, particularly by some of the function
names.  For example, what does the "jit-lock" part of the name
`font-lock-extend-jit-lock-region-after-change' mean?  Does it mean that
this function only gets called when jit-lock is active?  Could you
possibly give these new functions doc strings (or even comments) which
explain the context in which they're called?

> I.e. j-l-after-change-extend-region-functions should *not* be used by
> major modes for their font-lock needs.  There's
> f-l-extend-after-change-function for that (with the added advantage
> that it also works when font-lock doesn't use jit-lock).

OK.  I missed the fact that f-l-extend-a-c-function gets called from
jit-lock. 

But I'm not sure you've answered my question; if you have, I've not
understood the answer.  So let me ask it again: why are there two
separate hooks for extending the region after a buffer change [that's
jit-lock-after-change-region-functions and
font-lock-extend-after-change-region-function]?  What would become more
difficult or impossible if these two were unified into a single hook?
It seems to me that the two (or three) incompatible calling conventions
for these hooks might well cause unnecessary confusion.

Again, would it be possible to simplify the whole mechanism by using
only one of the pairs `font-lock-beg/end' and `jit-lock-start/end'?

>         Stefan

-- 
Alan.

  reply	other threads:[~2006-08-06 13:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-30 12:48 font-lock-extend-region-function: Final refinements Alan Mackenzie
2006-04-30 14:55 ` Stefan Monnier
2006-04-30 20:54 ` Richard Stallman
     [not found] ` <jwv8xm6p9jx.fsf-monnier+emacs@gnu.org>
     [not found]   ` <20060803163040.GC1282@muc.de>
     [not found]     ` <jwvirl9llf2.fsf-monnier+emacs@gnu.org>
2006-08-04  8:55       ` Alan Mackenzie
2006-08-04 14:59         ` Stefan Monnier
2006-08-06 13:48           ` Alan Mackenzie [this message]
2006-08-07 17:45             ` Stefan Monnier
2006-08-07 22:49               ` Alan Mackenzie

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20060806134849.GA1245@muc.de \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).