[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Major modes using `widen' is a good, even essential, programming pra
From: |
Alan Mackenzie |
Subject: |
Re: Major modes using `widen' is a good, even essential, programming practice. |
Date: |
Mon, 22 Aug 2022 11:26:59 +0000 |
Hello, Dmitry.
A bit late, but ....
On Sun, Aug 07, 2022 at 20:57:59 +0300, Dmitry Gutov wrote:
> On 06.08.2022 23:13, Alan Mackenzie wrote:
> > Narrowing is primarily a user feature. Users can arbitrarily narrow a
> > buffer to ANY contiguous region of text. So when a major mode needs to
> > examine text even slightly distant from point, it MUST widen, to be sure
> > that the text to be examined is within the visible region.
> Now wouldn't it have been nice if user-level narrowing didn't create an
> *actual* narrowing but only some visual perception of it? IIRC there is
> a third-party package which implements this approach.
I'm not convinced, given how well narrowing currently works. I don't
think it's useful to debate how things _would_ have been, when they are
currently very different.
> From what I've seen of feature requests related to narrowing in my
> packages, it's always along the lines of "please add (save-restriction
> (widen) ...) around the whole implementation".
> Are there actually user-level commands which should not ignore
> narrowing?
Yes, lots and lots of them. goto-char, isearch, occur, and many others.
It might be easier to answer the question which user-level commands are
not restricted by narrowing.
> If not, it would be better if user-level narrowing was implemented as
> something else (e.g. two invisible overlays). Then all other code
> wouldn't have to bother with undoing it.
But "all" other code would instead have to take account of the invisible
overlays instead. I don't think this would be better. It would involve
a _lot_ of work to implement and we'd be left with some other
inconveniences instead of the currently perceived ones.
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Major modes using `widen' is a good, even essential, programming practice., (continued)
- Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Gregory Heytings, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Alan Mackenzie, 2022/08/08
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/08
- Re: Major modes using `widen' is a good, even essential, programming practice., Gregory Heytings, 2022/08/08
Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/07
- Re: Major modes using `widen' is a good, even essential, programming practice.,
Alan Mackenzie <=