emacs-devel
[Top][All Lists]
Advanced

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

Re: How to add pseudo vector types


From: Eli Zaretskii
Subject: Re: How to add pseudo vector types
Date: Sun, 25 Jul 2021 22:03:38 +0300

> From: Stephen Leake <stephen_leake@stephe-leake.org>
> Cc: casouri@gmail.com,  cpitclaudel@gmail.com,  monnier@iro.umontreal.ca,
>   emacs-devel@gnu.org
> Date: Sun, 25 Jul 2021 11:21:27 -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.

Not relevant: if a major mode's fontification code knows it needs to
do that, it will call 'widen'.

The issue was what should the TS reader function do.  My firm opinion
is that it should not look beyond the restriction, because it isn't
its business to make those decisions.  If the caller needs to widen,
it will.

> >> 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.

Once again, we are talking about the function used by TS to read
buffer text.  Not about the parser or its caller.  Low-level code,
which knows nothing about the context, should never look beyond the
restriction.



reply via email to

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