unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrowing.
       [not found] ` <20221125175209.51166C004B6@vcs2.savannah.gnu.org>
@ 2022-12-30 16:22   ` Stefan Monnier
  0 siblings, 0 replies; only message in thread
From: Stefan Monnier @ 2022-12-30 16:22 UTC (permalink / raw)
  To: emacs-devel; +Cc: Gregory Heytings

>     Reworked locked narrowing.
>     
>     * src/editfns.c: (narrowing_locks): New alist to hold the narrowing
>     locks and their buffers.
>     (narrowing_lock_get_bound, narrowing_lock_peek_tag)
>     (narrowing_lock_push, narrowing_lock_pop): New functions to access
>     and update 'narrowing_locks'.
>     (reset_outermost_narrowings, unwind_reset_outermost_narrowing):
>     Functions moved from src/xdisp.c, and rewritten with the above
>     functions.
>     (Fwiden): Use the above functions. Update docstring.
>     (Fnarrow_to_region, Fnarrowing_lock, Fnarrowing_unlock): Use the above
>     functions.
>     (syms_of_editfns): Remove the 'narrowing-locks' variable.
>     
>     * src/lisp.h: Make 'reset_outermost_narrowings' externally visible.
>     
>     * src/xdisp.c (reset_outermost_narrowings)
>     unwind_reset_outermost_narrowing): Functions moved to src/editfns.c.
>     
>     * lisp/subr.el (with-locked-narrowing): Improved macro, with a helper
>     function.

[ Sorry for coming late.  ]
This commit (which is now on emacs-29 branch) still has some problems:

- I don't see any mention of those new features in etc/NEWS.
- I can't think of a case where a piece of code could/should make use of
  `narrowing-unlock`.
- In `nlinum--line-number-at-pos`, I want to circumvent the narrowing
  lock due to long lines (since its performance is only affected by
  buffer size but not by line length), but I can't see how to do that.
  The only primitive I see which would let me get out of the locked
  narrowing is `narrowing-unlock` but:
  - I don't know which tag(s) to use.
  - I don't want to remove the lock, I only want to circumvent it
    temporarily, and I can't see how to re-install a lock after
    removing it (`narrowing-lock` doesn't fit the bill because I don't
    know the bounds of the lock and because that would not preserve the
    stacking order of locks).


-- Stefan




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-30 16:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <166939872890.18950.12581667269687468681@vcs2.savannah.gnu.org>
     [not found] ` <20221125175209.51166C004B6@vcs2.savannah.gnu.org>
2022-12-30 16:22   ` feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrowing Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).