all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry OReilly <gundaetiapo@gmail.com>
To: emacs-devel@gnu.org
Subject: Fontifying outside of region passed to registered JIT lock function
Date: Fri, 15 Nov 2013 10:47:46 -0500	[thread overview]
Message-ID: <CAFM41H08rkMsKdymOzQZHtvkMJho3JHXUpdgK_XTsnSbrE6VaQ@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2013-11-15 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-15 15:47 Barry OReilly [this message]
2013-11-15 17:44 ` Fontifying outside of region passed to registered JIT lock function 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

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=CAFM41H08rkMsKdymOzQZHtvkMJho3JHXUpdgK_XTsnSbrE6VaQ@mail.gmail.com \
    --to=gundaetiapo@gmail.com \
    --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 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.