[Top][All Lists]

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

On multi-line font lock

From: Mark Oteiza
Subject: On multi-line font lock
Date: Wed, 13 Sep 2017 20:54:18 -0400


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:
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

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: mailcap-mode.el
Description: mailcap-mode package

reply via email to

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