[Top][All Lists]

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

Re: How to add pseudo vector types

From: Stephen Leake
Subject: Re: How to add pseudo vector types
Date: Sun, 25 Jul 2021 11:21:27 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Stephen Leake <stephen_leake@stephe-leake.org>
>> Cc: Yuan Fu <casouri@gmail.com>,  cpitclaudel@gmail.com,
>>   monnier@iro.umontreal.ca,  emacs-devel@gnu.org
>> Date: Sat, 24 Jul 2021 02:42:24 -0700
>> > But that's how the current font-lock and indentation work: they never
>> > look beyond the narrowing limits.  
>> And that's broken
> ??? Of course, it isn't: it's how Emacs has worked since v21.1.

Ada (and other languages, but not all) requires the full file text to
properly compute font and indent; narrowing breaks that.

The fix for font-lock is font-lock-dont-widen; I implemented a similar
mechanism for indent of an ada-mode region in multi-major-mode.

In plain ada-mode, indent is currently broken in a narrowed buffer;
wisi-indent-region does not widen because it is language-agnostic, and I
have not gotten around to implementing a "widen for indent" hook because I
don't use narrowing very often, and no one has complained.

>> unless the narrowing is for multi-major-mode.
> And what would you do in that case, if you allow TS to look beyond the
> restriction?

In the multi-major-mode case, there is a separate parser for each
language, and each sub-mode region in the text would get its own parser
tree (ie, it acts like a separate file), and that parser tree is only
told about changes to those regions. So the parser will never try to
look outside the region; it doesn't need to know about narrowing.

I'll have to upgrade my Ada multi-major-mode implementation to do this
for incremental parse.

-- Stephe

reply via email to

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