all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: help-gnu-emacs@gnu.org
Subject: On multi-line font lock
Date: Wed, 13 Sep 2017 20:54:18 -0400	[thread overview]
Message-ID: <87o9qedrr9.fsf@holos> (raw)

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

             reply	other threads:[~2017-09-14  0:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  0:54 Mark Oteiza [this message]
2017-09-15 12:49 ` On multi-line font lock Stefan Monnier
2017-09-16 12:44   ` Mark Oteiza
2017-09-16 13:14     ` 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=87o9qedrr9.fsf@holos \
    --to=mvoteiza@udel.edu \
    --cc=help-gnu-emacs@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.