all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* On multi-line font lock
@ 2017-09-14  0:54 Mark Oteiza
  2017-09-15 12:49 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Oteiza @ 2017-09-14  0:54 UTC (permalink / raw)
  To: help-gnu-emacs

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


Hi,

I'm writing to ask about correct use of font-lock-multiline and
font-lock-extend-* hooks, and possibly for a working example if possible.

I was writing a mode for mailcap files and was struggling to write
working elisp for handling multi-line constructs.  In mailcap, comments
begin with a # at BOL, and lines can be broken by a trailing \ in a
non-comment line:

  application/foobar; baz; copiousoutput; \
  # not a comment \
  # a comment

I discovered an existing mailcap-mode here:
http://user42.tuxfamily.org/mailcap-mode/index.html
which appears to take advantage of jit-lock-contextually.  I also
managed to figure out syntax-propertize to a degree, with the help of
some blog examples.

However, I'm not fond of jit-lock's delay (which is
configurable, but defaults are defaults are defaults), so I tried to get
the non-jit-lock option to work.  The attached
package somehow appears to be a working example of using
font-lock-extend-region-functions.

I'm puzzled because the function I've added to the hook always returns a
truthy value AFAICT, and the documentation suggests the hook is run
until all of its items return nil.

What is the correct way to use font-lock-extend-foo hooks?

Please Cc:, thanks.


[-- Attachment #2: mailcap-mode package --]
[-- Type: application/emacs-lisp, Size: 6991 bytes --]

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

end of thread, other threads:[~2017-09-16 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-14  0:54 On multi-line font lock Mark Oteiza
2017-09-15 12:49 ` Stefan Monnier
2017-09-16 12:44   ` Mark Oteiza
2017-09-16 13:14     ` Stefan Monnier

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.