emacs-devel
[Top][All Lists]
Advanced

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

Re: Fontifying outside of region passed to registered JIT lock function


From: Barry OReilly
Subject: Re: Fontifying outside of region passed to registered JIT lock function
Date: Fri, 15 Nov 2013 13:30:32 -0500

> If you explain in more details, we can probably help you figure it
> out,

I can show you. It's a work in progress, but the basic algorithm is in
the attached color-parens.el. Load it, call color-parens-mode, open
the attached thread-test-binding.el (which was just a random .el file
lying around). You'll see the correct parens fontified in this block:

   (defun threads-test-thread2 ()
     (let ((threads-test-binding 23))
   (thread-yield))
     (setq threads-test-global 23))

But not in this block:

   (progn
     (setq threads-test-global nil)
     (make-thread #'threads-test-thread2)
     (while (not threads-test-global)
   (thread-yield))
     (and (not threads-test-binding)
          threads-test-global))

The reason is that the regions JIT lock passes begin and end in the
middle of the progn list.

If you highlight the progn list and 's/^/ /', you'll see
the desired fontification, since JIT now passes in the desired region.

To explain what I'm doing in simpler terms, suppose you have:

   (a b
      c
      d)

The close paren is where the indentation would imply, so there's no
coloring of parens.

Suppose you edit the code so as it is now:

   (a b
   c
      d)

The indentation implies the close paren would be after b. Since it is
not, the minor mode wants to update the color of the parens. JIT lock
may pass in a region that excludes those parens however.

By the way, I'd be interested if something already exists that does
something similar: gives some visual indication in Lisp code that
close parens and indentation are inconsistent.

Attachment: color-parens.el
Description: Text Data

Attachment: thread-test-binding.el
Description: Text Data


reply via email to

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