all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "immerrr again..." <immerrr+lua@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: font-lock-syntactic-keywords: evaluating arbitrary elisp inside matchers?
Date: Tue, 25 Sep 2012 15:31:24 +0400	[thread overview]
Message-ID: <5061960C.7050106@gmail.com> (raw)
In-Reply-To: <jwvobkvorrf.fsf-monnier+emacs@gnu.org>

On 09/25/2012 05:03 AM, Stefan Monnier wrote:
 > Here's your problem: the comments/strings you want to match may span
 > several lines, yet the patterns on font-lock-syntactic-keywords cannot
 > reliably match more than a single line (because when a line is modified,
 > font-lock only looked for that pattern in that line, for example).
 >

If I follow the documentation correctly, this can be worked around by using
`font-lock-extend-region-functions', isn't it?

 >
 > (defun lua-syntax-propertize (start end)
 >   (goto-char start)
 >   (lua-syntax-propertize-string-or-comment-end end)
 >   (funcall
 >    (syntax-propertize-rules
 >     ("\\(?:\\(?:^\\|[^-]\\)\\(-\\)-\\)?\\([\\)=*["
 >      (1 "< b") ;; Only applied if sub-group1 exists.
 >      (2 (prog1 (unless (match-beginning 1) (string-to-syntax "|"))
 >           (lua-syntax-propertize-string-or-comment-end end)))))
 >    start end))>
 >

The snippet is great. I, for one, have somehow missed the "<"/">" syntax
descriptors. But I have a concern: what if closing long bracket, i.e. 
"]==]",
is after `end', doesn't it need an extra matcher rule for that?

As for 23-vs-24 question, I really look forward to the moment when I can
safely drop backward compatibility for lua-mode, but in the meanwhile, I
guess, I'll need to look into the font-lock code to see how to do the 
same in
Emacs23.

-- 
Cheers,
immerrr




  reply	other threads:[~2012-09-25 11:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 20:48 font-lock-syntactic-keywords: evaluating arbitrary elisp inside matchers? immerrr again...
2012-09-25  1:03 ` Stefan Monnier
2012-09-25 11:31   ` immerrr again... [this message]
2012-09-25 13:20     ` Stefan Monnier
2012-09-28  8:19       ` immerrr again
2012-09-28 12:28         ` Stefan Monnier
2012-09-29  6:50           ` immerrr again
2013-03-26 13:48           ` immerrr again

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=5061960C.7050106@gmail.com \
    --to=immerrr+lua@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.