emacs-devel
[Top][All Lists]
Advanced

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

Re: Syntax ambiguities in narrowed buffers and multiple major modes: a p


From: Stefan Monnier
Subject: Re: Syntax ambiguities in narrowed buffers and multiple major modes: a proposed solution.
Date: Sun, 26 Feb 2017 23:05:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> I am proposing implementing islands as a solution to the problem, not as
> a way of thinking about it.

In order to design a solution, we need to think about the problem somehow.

>> But the issue is that the syntax beginning in the above example should be
>> point-min, not 1.
> Should it?

It's not really inherent in the code, but it's how it currently behaves
(mostly), and in some cases that is what the author wants.  In other
cases, the author wants something else.

> When does it actually make a difference, apart from when point-min is
> inside a string or a comment?  I don't think it makes a difference in
> the (backward-sexp 1) case above.

backward-sexp will call back_comment, so yes it makes a difference.
And since speed may be important, it's also important to make sure we
don't scan over the 100KB of text that comes before point-min.

> That is correct.  The creation of an island will not be an expensive
> action, unless it is in a tight loop - recording two current syntactic
> elements, and calculating and setting two syntax-table text properties;
> then restoring these later.

But won't setting those islands flush the caches (e.g. comment-cache,
syntax-ppss cache, ...)?


        Stefan



reply via email to

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