From: "Wedler, Christoph" <christoph.wedler@sap.com>
To: Dmitry Gutov <dgutov@yandex.ru>,
"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: Clarification needed: syntax-propertize vs font-lock-syntax-table
Date: Tue, 24 Nov 2015 08:58:13 +0000 [thread overview]
Message-ID: <F9C2521BBF380A4A97379009991555E6993579ED@DEWDFEMB17C.global.corp.sap> (raw)
In-Reply-To: <56536294.1000302@yandex.ru>
> 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.
I now checked the code: it is done via jit-lock-after-change in
after-change-functions. As I have guessed, syntax-propertize currently
only works correctly if font-lock is switched on.
> Neither is using font-lock: we fontify the file lazily, and thus also
> only propertize the buffer near its visible part.
Yes, but navigation command like M-x forward-list do not depend on
font-lock, but they do depend on syntax-propertize (consider parentheses
in generic strings).
> 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.
Well, then I think that the change in js is wrong. (Yes, a fully lazy
solution is better, but as long as it is not there...)
>> 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.
OK, I send a suggestion later this week, together with:
>> 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.
Ok, I'll name it syntax-ppss-open-positions (like (nth 0 ppss) is called
syntax-ppss-depth, and not syntax-ppss-list-depth).
>> 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.
Well, that was the point of the above function: in the former case, the
function body is changed to (mapcar 'car (nth 9 ppss)), and will stay
the same in the latter.
next prev parent reply other threads:[~2015-11-24 8:58 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
2015-11-24 8:58 ` Wedler, Christoph [this message]
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=F9C2521BBF380A4A97379009991555E6993579ED@DEWDFEMB17C.global.corp.sap \
--to=christoph.wedler@sap.com \
--cc=dgutov@yandex.ru \
--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.