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 15:07:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

On 03/21/2016 02:40 PM, Vitalie Spinu wrote:

Strings? Indentation engines do not deal with strings, they deal with buffer
contents. Having them handle this possibility would also amount to sharing a
part of multi-mode logic.

Yeh. That's the sucky part. My hope is that BEFORE-STRING will be seldom
used.

Then let's not add that to the API until we see a concrete need for 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?

Then a lot of modes don't even care about what's in the current line, so
STRING-AFTER will be irrelevant as well.

Almost all of them care whether the current line contains }, or `end', or
`else', and so on.

Indeed. But this information is trivial to retrieve from STRING-AFTER.

Feeding it to each particular indentation engine is not going to be trivial.

In any case, your hard-narrowing proposal is very similar. Surely you don't want
to keep the second element of prog-indentation-context after hard-narrowing
becomes available?

Indeed. I was not thinking about algorithmic complexities.

AFAIK if second element is removed, the third one should go as well. That leaves
only FIRST-COLUMN then, which I personally don't mind.

OK. And that one could be replaced with the introduction of prog-indentation-function. Though that might be getting ahead of ourselfves.

This way the
request aired in bug#22983 of parse-partial-sexp == syntax-ppss will be
automatically satisfied. You won't need syntax-ppss-dont-widen either.

That doesn't seem relevant. That bug is about stale cache values between
different narrowing bounds.

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.



reply via email to

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