all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: locked narrowing in ELisp
Date: Wed, 17 Aug 2022 04:00:28 +0300	[thread overview]
Message-ID: <79484704-f981-5c12-e000-333b75499520@yandex.ru> (raw)
In-Reply-To: <jwv1qtfg0cr.fsf-monnier+emacs@gnu.org>

On 17.08.2022 03:55, Stefan Monnier wrote:
>> Have you given any thought to the "soft widen" alternative
>> I voiced recently?
>>
>> https://lists.gnu.org/archive/html/emacs-devel/2022-08/msg00291.html
>>
>> If the user-level narrow/widen commands didn't use _actual_ narrowing, but
>> display engine tricks or whatever (example:
>> https://github.com/Malabarba/fancy-narrow/), "other parts of the major mode"
>> wouldn't have to do the usual (save-restriction (widen) ...) dance, which
>> a lot of code is littered with.
>>
>> Then there would be no need for "hard" or "locked" narrowing to restrict
>> those calls to 'widen', because there wouldn't be any. The
>> 'narrow-to-region' and 'widen' would be restricted to lower-level uses, like
>> mmm-mode, Info-mode, and the display engine long-line wrangling magic.
>>
>> The migration path seems difficult, but the result might be worth it.
> 
> Such a display-only narrowing might be a good alternative for many uses
> of narrowing, but narrowing is also used quite commonly (either by the
> end-user or in ELisp code) in order to restrict the effect of an
> operation (like search&replace) to a particular region.

Certain operations could look up the "soft narrowing" bounds and act 
accordingly, if it's implemented in the core and appropriately documented.

To my understanding, there are more commands and facilities that want to 
ignore user-level narrowing, rather than the ones that want to obey it. 
Also a lot of "undecided" ones, waiting for someone to report that they 
should, in fact, ignore narrowing.



  reply	other threads:[~2022-08-17  1:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 20:18 locked narrowing in ELisp Stefan Monnier
2022-08-17  0:05 ` Dmitry Gutov
2022-08-17  0:55   ` Stefan Monnier
2022-08-17  1:00     ` Dmitry Gutov [this message]
2022-08-17 13:03       ` Stefan Monnier
2022-08-17 13:40         ` Dmitry Gutov
2022-08-17 13:55           ` Eli Zaretskii
2022-08-17 14:03             ` Dmitry Gutov
2022-08-17 14:20               ` Eli Zaretskii
2022-08-17 23:13                 ` Dmitry Gutov
2022-08-18  1:58                   ` Stefan Monnier
2022-08-18 21:42                     ` Dmitry Gutov
2022-08-18  6:25                   ` Eli Zaretskii
2022-08-18 23:10                     ` Dmitry Gutov
2022-08-19  6:31                       ` Eli Zaretskii
2022-08-22  0:59                         ` Dmitry Gutov
2022-08-17 11:44   ` Eli Zaretskii
2022-08-17 11:54     ` Dmitry Gutov
2022-08-17  5:59 ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79484704-f981-5c12-e000-333b75499520@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.