From: Vitalie Spinu <spinuvit@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 24749@debbugs.gnu.org
Subject: bug#24749: Making sure syntax-propertize is called
Date: Tue, 04 Jun 2019 07:49:22 +0200 [thread overview]
Message-ID: <87o93dx5lp.fsf@gmail.com> (raw)
In-Reply-To: <jwvk1e2pir0.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 03 Jun 2019 15:45:06 -0400")
>> On Mon, Jun 03 2019 15:45, Stefan Monnier wrote:
> It's syntax-propertize which sets parse-sexp-lookup-properties ;-)
Arh. Right. It's a chicken-egg then, syntax-propertize is triggered by search
when parse-sexp-lookup-properties are t, but parse-sexp-lookup-properties is set
by syntax-propertize. So an external tool (font-lock) was needed to
syntax-propertize for the first time before this patch. Things are not
particularly elegant, are they?
>>> Note: you can also set parse-sexp-lookup-properties's default value to
>>> t and forget about the problem ;-)
>> Why not make it the default then?
> No idea.
Would you consider a patch which sets it to t by default and removes the
auto-resets? It's hard to imagine that it would break anything.
>> and the other way around.
> Actually the other way around isn't quite true: a major mode may decide
> to use the syntax-table text-property but set it by hand its own way
> rather than via syntax-propertize.
Ok, but then setting parse-sexp-lookup-properties to t by default would not harm
such a mode.
Instead, one can imagine a scenario when a mode doesn't want to use syntax
tables but would like to use syntax-propertize to install various text
properties (to be used in font-lock or just caching buffer structures
etc). Current situation harms such modes by re-setting
parse-sexp-lookup-properties to t on various occasions.
>> It seems that the only(?) use case for a nil `parse-sexp-lookup-properties` is
>> to set it to nil dynamically in specialized lookup code for performance
>> reasons. Such code does let-bind it to nil already.
> I can't remember binding it to nil for performance reasons (tho maybe
> that's the reason behind yasnippet.el's case), but we do let-bind it
> temporarily to nil in a few cases as a hackish way to have a "different
> view" of the buffer which happens to fit our needs. E.g. this is done
> in font-latex.el and sm-c-mode.el.
I am setting it to nil while searching for mode boundaries in polymode. First,
it doesn't make sense to use local syntax tables in search because different
inner modes might have a different opinion of syntax. Second, I don't want to
trigger syntax-propertize for performance reasons. The bounds of the forward
search is normally eob and that would mean syntax-propertizing the entire buffer
on every mode boundary lookup.
Vitale
next prev parent reply other threads:[~2019-06-04 5:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-20 21:14 bug#24749: Making sure syntax-propertize is called Stefan Monnier
2016-10-20 22:31 ` Dmitry Gutov
2016-10-20 23:12 ` Stefan Monnier
2016-10-21 15:58 ` Dmitry Gutov
2016-10-21 6:56 ` Eli Zaretskii
2016-10-21 15:36 ` Stefan Monnier
2016-10-21 16:02 ` Eli Zaretskii
2016-10-21 16:34 ` Stefan Monnier
2016-10-21 17:27 ` Eli Zaretskii
2017-12-12 2:03 ` Noam Postavsky
2017-12-12 14:12 ` Stefan Monnier
[not found] ` <handler.24749.D24749.151308794732170.notifdone@debbugs.gnu.org>
2017-12-12 17:54 ` bug#24749: closed (Re: bug#24749: Making sure syntax-propertize is called) Tassilo Horn
2017-12-12 19:45 ` Stefan Monnier
[not found] ` <jwv4lovu3xj.fsf-monnier+emacs@gnu.org>
2017-12-13 8:50 ` martin rudalics
[not found] ` <87ef4awyb6.fsf@gmail.com>
[not found] ` <jwvblzewpgj.fsf-monnier+emacs@gnu.org>
2019-06-03 17:47 ` bug#24749: Making sure syntax-propertize is called Stefan Monnier
2019-06-03 19:25 ` Vitalie Spinu
2019-06-03 19:45 ` Stefan Monnier
2019-06-03 20:04 ` npostavs
2019-06-04 5:49 ` Vitalie Spinu [this message]
2019-06-04 13:08 ` Stefan Monnier
2019-06-05 5:25 ` Vitalie Spinu
2019-06-05 13:32 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o93dx5lp.fsf@gmail.com \
--to=spinuvit@gmail.com \
--cc=24749@debbugs.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).