diff options
| author | Gregory Heytings | 2022-08-20 22:55:14 +0000 |
|---|---|---|
| committer | Gregory Heytings | 2022-08-21 00:56:01 +0200 |
| commit | e41e9740fb7cfb775f8f1ddff6b6a66ceafc9ab0 (patch) | |
| tree | d565a19103ffd490814c37e9180b79ee6115be5c /src | |
| parent | 2727af3fd448e39f79e130c42286e85a51bf7a40 (diff) | |
| download | emacs-e41e9740fb7cfb775f8f1ddff6b6a66ceafc9ab0.tar.gz emacs-e41e9740fb7cfb775f8f1ddff6b6a66ceafc9ab0.zip | |
Fix user narrowing handling.
* src/editfns.c (syms_of_editfns): New 'outermost-narrowing' internal
variable.
(Fwiden, Fnarrow_to_region): Set and reset the variable.
(Fnarrowing_lock): Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c index 6987c44f986..f52db223e47 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2692,6 +2692,8 @@ in which case the the restrictions that were current when | |||
| 2692 | `narrowing-lock' was called are restored. */) | 2692 | `narrowing-lock' was called are restored. */) |
| 2693 | (void) | 2693 | (void) |
| 2694 | { | 2694 | { |
| 2695 | Fset (Qoutermost_narrowing, Qnil); | ||
| 2696 | |||
| 2695 | if (NILP (Vnarrowing_locks)) | 2697 | if (NILP (Vnarrowing_locks)) |
| 2696 | { | 2698 | { |
| 2697 | if (BEG != BEGV || Z != ZV) | 2699 | if (BEG != BEGV || Z != ZV) |
| @@ -2708,6 +2710,8 @@ in which case the the restrictions that were current when | |||
| 2708 | current_buffer->clip_changed = 1; | 2710 | current_buffer->clip_changed = 1; |
| 2709 | SET_BUF_BEGV (current_buffer, begv); | 2711 | SET_BUF_BEGV (current_buffer, begv); |
| 2710 | SET_BUF_ZV (current_buffer, zv); | 2712 | SET_BUF_ZV (current_buffer, zv); |
| 2713 | if (EQ (Fcar (Fcar (Vnarrowing_locks)), Qoutermost_narrowing)) | ||
| 2714 | Fset (Qnarrowing_locks, Qnil); | ||
| 2711 | } | 2715 | } |
| 2712 | /* Changing the buffer bounds invalidates any recorded current column. */ | 2716 | /* Changing the buffer bounds invalidates any recorded current column. */ |
| 2713 | invalidate_current_column (); | 2717 | invalidate_current_column (); |
| @@ -2750,6 +2754,11 @@ restrictions that were current when `narrowing-lock' was called. */) | |||
| 2750 | args_out_of_range (start, end); | 2754 | args_out_of_range (start, end); |
| 2751 | } | 2755 | } |
| 2752 | 2756 | ||
| 2757 | Fset (Qoutermost_narrowing, | ||
| 2758 | Fcons (Fcons (Qoutermost_narrowing, | ||
| 2759 | Fcons (make_fixnum (BEGV), make_fixnum (ZV))), | ||
| 2760 | Qnil)); | ||
| 2761 | |||
| 2753 | if (BEGV != s || ZV != e) | 2762 | if (BEGV != s || ZV != e) |
| 2754 | current_buffer->clip_changed = 1; | 2763 | current_buffer->clip_changed = 1; |
| 2755 | 2764 | ||
| @@ -2773,6 +2782,8 @@ used only within the limits of the restrictions that were current when | |||
| 2773 | `narrowing-lock' was called. */) | 2782 | `narrowing-lock' was called. */) |
| 2774 | (Lisp_Object tag) | 2783 | (Lisp_Object tag) |
| 2775 | { | 2784 | { |
| 2785 | if (NILP (Vnarrowing_locks)) | ||
| 2786 | Fset (Qnarrowing_locks, Voutermost_narrowing); | ||
| 2776 | Fset (Qnarrowing_locks, | 2787 | Fset (Qnarrowing_locks, |
| 2777 | Fcons (Fcons (tag, Fcons (make_fixnum (BEGV), make_fixnum (ZV))), | 2788 | Fcons (Fcons (tag, Fcons (make_fixnum (BEGV), make_fixnum (ZV))), |
| 2778 | Vnarrowing_locks)); | 2789 | Vnarrowing_locks)); |
| @@ -4624,12 +4635,18 @@ it to be non-nil. */); | |||
| 4624 | 4635 | ||
| 4625 | DEFSYM (Qnarrowing_locks, "narrowing-locks"); | 4636 | DEFSYM (Qnarrowing_locks, "narrowing-locks"); |
| 4626 | DEFVAR_LISP ("narrowing-locks", Vnarrowing_locks, | 4637 | DEFVAR_LISP ("narrowing-locks", Vnarrowing_locks, |
| 4627 | doc: /* Internal use only. | 4638 | doc: /* List of narrowing locks in the current buffer. Internal use only. */); |
| 4628 | List of narrowing locks in the current buffer. */); | ||
| 4629 | Vnarrowing_locks = Qnil; | 4639 | Vnarrowing_locks = Qnil; |
| 4630 | Fmake_variable_buffer_local (Qnarrowing_locks); | 4640 | Fmake_variable_buffer_local (Qnarrowing_locks); |
| 4631 | Funintern (Qnarrowing_locks, Qnil); | 4641 | Funintern (Qnarrowing_locks, Qnil); |
| 4632 | 4642 | ||
| 4643 | DEFSYM (Qoutermost_narrowing, "outermost-narrowing"); | ||
| 4644 | DEFVAR_LISP ("outermost-narrowing", Voutermost_narrowing, | ||
| 4645 | doc: /* Outermost narrowing bounds, if any. Internal use only. */); | ||
| 4646 | Voutermost_narrowing = Qnil; | ||
| 4647 | Fmake_variable_buffer_local (Qoutermost_narrowing); | ||
| 4648 | Funintern (Qoutermost_narrowing, Qnil); | ||
| 4649 | |||
| 4633 | defsubr (&Spropertize); | 4650 | defsubr (&Spropertize); |
| 4634 | defsubr (&Schar_equal); | 4651 | defsubr (&Schar_equal); |
| 4635 | defsubr (&Sgoto_char); | 4652 | defsubr (&Sgoto_char); |