From: Stephen Leake <stephen_leake@member.fsf.org>
To: emacs-devel@gnu.org
Subject: Re: syntax-propertize-function vs indentation lexer
Date: Thu, 30 May 2013 05:15:06 -0400 [thread overview]
Message-ID: <85bo7sbzhh.fsf@member.fsf.org> (raw)
In-Reply-To: <jwvfvx5u17h.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 29 May 2013 13:52:13 -0400")
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
>> However, syntax-propertize-function is only called from font-lock. So it
>> only runs on the visible part of the buffer, and only when font-lock is
>> enabled. So if neither of those conditions is present, the lexer fails
>> on character constants. In particular, I have a test suite that runs in
>> batch mode, when global-font-lock-mode is off.
>
> "syntax propertization" is done lazily, so if/when you need it, you need
> to call `syntax-propertize'. In many cases it's done for you
> (e.g. indent-according-to-mode makes sure it's propertized til the end
> of the current line), but not in all cases.
The doc string for syntax-propertize-function only mentions
font-lock, not indentation etc; it should say "most syntax uses", or
better, list all the places it is called.
> Not sure why propertization isn't done for you in the case
> of indentation. Maybe because you sometimes look after the current line?
> Or because your indentation doesn't go through
> indent-according-to-mode?
The later; I'm parsing the entire buffer with an LALR parser in
ada-mode, and whenever it changes, and caching the results for use by
indent. So far it's quite fast.
So I need to call
(syntax-propertize (point-max))
in ada-mode and
(syntax-ppss-flush-cache begin)
(syntax-propertize end)
in the after-change hook.
--
-- Stephe
next prev parent reply other threads:[~2013-05-30 9:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 15:19 syntax-propertize-function vs indentation lexer Stephen Leake
2013-05-29 15:28 ` Dmitry Gutov
2013-05-29 17:52 ` Stefan Monnier
2013-05-30 9:15 ` Stephen Leake [this message]
2013-05-30 14:02 ` Stefan Monnier
2013-05-31 7:45 ` Stephen Leake
2013-05-31 13:23 ` Stefan Monnier
2013-06-01 5:19 ` Stephen Leake
2013-06-01 14:31 ` 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=85bo7sbzhh.fsf@member.fsf.org \
--to=stephen_leake@member.fsf.org \
--cc=emacs-devel@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.