[Top][All Lists]

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

Re: `font-lock-extend-region-functions' vs. `font-lock-extend-after-chan

From: Tobias C. Rittweiler
Subject: Re: `font-lock-extend-region-functions' vs. `font-lock-extend-after-change-region-function'
Date: Wed, 29 Apr 2009 12:42:56 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.60 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> The "right" answer is usually font-lock-extend-region-functions, but
> it's hard to tell without knowing anything more (sometimes it's
> difficult/impossible to write the necessary
> font-lock-extend-region-functions).

Let EXTEND be a function that's pushed onto
`font-lock-extend-region-functions', and let MARKER be font-lock search
function that's specified in `font-lock-keywords'.

I get the following call chain:

  extend: (1, 523)        --> t   (1, 701)
  extend: (1, 701)        --> nil (1, 701)
  marker: pt=1 limit=701  ==> nil
  extend: (523, 1034)     --> t   (483, 1156)
  extend: (483, 1156)     --> nil (483, 1156)
  marker: pt=483 limit=1156

(The values in parentheses are font-lock-beg, and font-lock-end.)

As you see, EXTEND extends the region to be fontified from (1, 523) to
(1, 701). MARKER cannot find anything in that region.

But the new region that EXTEND is called with begins at 523, and not 701
even though we processed the region between 523 and 701 already.

This seems more inefficient than it needs to be if I'm not missing


PS: I'm using `jit-lock' as font-lock-support-mode.

reply via email to

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