From: Dmitry Gutov <dgutov@yandex.ru>
To: "Wedler, Christoph" <christoph.wedler@sap.com>,
"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Clarification needed: syntax-propertize vs font-lock-syntax-table
Date: Mon, 23 Nov 2015 21:01:40 +0200 [thread overview]
Message-ID: <56536294.1000302@yandex.ru> (raw)
In-Reply-To: <F9C2521BBF380A4A97379009991555E699357628@DEWDFEMB17C.global.corp.sap>
On 11/23/2015 07:05 PM, Wedler, Christoph wrote:
> Well, I realized that (with Emacs-24.4) the imenu list in antlr-mode
> wasn't correctly before I put (syntax-propertize (point-max)) into
> antlr-imenu-create-index-function. I could imagine similar things in
> other modes.
In other functions, you mean. Yes, various facilities that depend on
syntax properties should call syntax-propertize at appropriate times.
Note that calling (syntax-propertize (point-max)), as js-mode was doing,
is not a guarantee of the file staying entirely up-to-date WRT syntax
properties as the user edits it.
Neither is using font-lock: we fontify the file lazily, and thus also
only propertize the buffer near its visible part.
> I probably define a variable for that which will be t for Emacs below
> emacs-25.x and nil with the next release.
But nothing has changed in Emacs 25 in that regard (I think?). We
changed js-mode behavior, but mostly because it was a kludge anyway, and
not because anything else is compensating for it now.
> The other documentation request was for font-lock syntax-table as being
> "syntax-ppss-compatible" (as you put it nicely).
I'd be happy to review the documentation patch. We can also ask Stefan
to do that.
> Agreed. How about a function like
>
> (defun syntax-ppss-open-list-positions (ppss)
> "Get all syntactically open list position found in a syntactic scan.
> PPSS is a scan state, as returned by `parse-partial-sexp' or `syntax-ppss'.
> The start position of the outermost list comes first."
> (nth 9 ppss))
>
> This function needs to be changed if the internal structure of (nth 9
> ppss) is changed.
Yes, that sounds good (maybe choose a shorter name?). But see above.
> We might need something (an extra syntax flag?) which makes it easy to
> "rewind" the ppss such that
>
> (equal (syntax-ppss inner-mode-end-position)
> (syntax-ppss inner-mode-start-position))
That sounds like it might require turning the current "list of openers"
structure into a list-of-lists, where each element is the current "list
of openers", plus some boundary information.
Or maybe handle that in some entirely different way, like keeping the
current spss format, but allow the buffers to override the syntax-ppss
logic via a newly introduced syntax-ppss-function variable.
Someone could try implementing the latter approach right now, using advice.
next prev parent reply other threads:[~2015-11-23 19:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 18:06 Clarification needed: syntax-propertize vs font-lock-syntax-table Wedler, Christoph
2015-11-18 18:37 ` Dmitry Gutov
2015-11-20 18:24 ` Wedler, Christoph
2015-11-20 18:39 ` Dmitry Gutov
2015-11-23 17:05 ` Wedler, Christoph
2015-11-23 19:01 ` Dmitry Gutov [this message]
2015-11-24 8:58 ` Wedler, Christoph
2015-11-24 11:35 ` Dmitry Gutov
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=56536294.1000302@yandex.ru \
--to=dgutov@yandex.ru \
--cc=christoph.wedler@sap.com \
--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.