unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Fontifying outside of region passed to registered JIT lock function
@ 2013-11-15 15:47 Barry OReilly
  2013-11-15 17:44 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Barry OReilly @ 2013-11-15 15:47 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1861 bytes --]

Background:

I'm writing a color-parens minor mode that will fontify parens if they
are inconsistent with indentation. For example:

   (if region
       (setq beg (min jit-lock-start (car region))
       end (max jit-lock-end (cdr region))))

Indentation implies the close paren of (setq ...) would be at the end
of the same line, but it's really on the next line, so the minor mode
fontifies that. The goal is to give the user clues when indentation
lies about where close parens are.

Problem:

I am passing my color-parens-propertize-region function to
jit-lock-register and it processes the regions passed to it. However,
the regions need expansion because it's possible parent lists' parens
outside the region need fontification too.

I found the Elisp manual's section on Multiline Font Lock Constructs
and tried adding a hook to font-lock-extend-region-functions to expand
the region. I discovered that doesn't work because
font-lock-fontify-region-function and
font-lock-extend-region-functions are used under
font-lock-fontify-region, which is another registered JIT lock
function. Those region expansions don't apply to the other registered
jit-lock-functions.

Obviously I could disregard the region inputs and fontify minimally
outside of it, but my concerns are:

   • Maybe the JIT lock infrastructure expects jit-lock-functions to
     fontify only within the region?

   • It might be needlessly inefficient to fontify outside the region
     without JIT lock knowing, then it calls the jit-lock-functions
     again for those regions.

I found the jit-lock-after-change-extend-region-functions, but those
hooks aren't called for the initial fontifications.

What is the recommended way to expand the JIT region or otherwise
fontify outside of the regions passed to a registered JIT lock
function?

[-- Attachment #2: Type: text/html, Size: 2030 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-16 22:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-15 15:47 Fontifying outside of region passed to registered JIT lock function Barry OReilly
2013-11-15 17:44 ` Stefan Monnier
2013-11-15 18:30   ` Barry OReilly
2013-11-16  1:04     ` Stefan Monnier
2013-11-16 20:59       ` Barry OReilly
2013-11-16 22:12         ` Stefan Monnier

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