emacs-devel
[Top][All Lists]
Advanced

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

Re: feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrow


From: Stefan Monnier
Subject: Re: feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrowing.
Date: Fri, 30 Dec 2022 11:22:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>     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




reply via email to

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