emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax tables for multiple modes [was: bug#22983: syntax-ppss return


From: Dmitry Gutov
Subject: Re: Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.]
Date: Mon, 21 Mar 2016 16:29:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

On 03/21/2016 04:20 PM, Vitalie Spinu wrote:

It might be good to not include these (prog-indentation-context including) in
emacs 25 release.

Of course, none of them. But nor should we put BEFORE-STRING into master until we understand that we really need it, and how to use it.

Performance is not a primary concern for indentation. Correctness and conceptual
cleanness is at a much higher stake here. My hope is that generic helper
functions can be optimized to re-use same temp buffer for multiple invocations
of calculate-indent-function.

So, how about trying my alternative proposal first?

Sorry. What proposal do you mean?

"""
Instead, if you want to know what indentation an inner mode would return if STRING-BEFORE was before it, insert that string into the buffer (while inhibiting undo history). Call the indentation function, then remove the string.
"""

Same with AFTER-STRING. The multi-mode package itself would do that.

Right. Those stale values won't occur in multi-modes because both syntax-ppss
and parse-partial-sexp will always operate on same hard-narrowed regions.

We could only be sure of that for syntax-ppss calls in facilities that the
multi-mode handles specially, like font-lock, syntax-propertize and
indentation. Not so with any other functions the user could call.

I assume that multi-mode engine is advising syntax-ppss which I think it should.

Very well, that's an option. Having syntax-ppss-dont-widen (or making syntax-ppss respect hard-widen-limits) should be sufficient for it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]