diff options
| author | Eli Zaretskii | 2023-02-13 20:11:28 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2023-02-13 20:11:28 +0200 |
| commit | 3d572ae0d507bba07f3cfc5ae2d2c7dd4937472c (patch) | |
| tree | ddff8ab3f26f07bcb3694a7a5493871a9410ca85 | |
| parent | dd8b720ee74e72359eb174aa5a27ab1770a349bd (diff) | |
| download | emacs-3d572ae0d507bba07f3cfc5ae2d2c7dd4937472c.tar.gz emacs-3d572ae0d507bba07f3cfc5ae2d2c7dd4937472c.zip | |
Rename with/without-narrowing to with/without-restriction
* doc/lispref/commands.texi:
* doc/lispref/display.texi:
* doc/lispref/positions.texi:
* etc/NEWS:
* lisp/subr.el:
* src/buffer.c:
* src/editfns.c:
* src/keyboard.c:
* src/xdisp.c:
* test/src/buffer-tests.el: Rename with-narrowing and
without-narrowing to with-restriction and without-restriction.
Likewise with internal--with-narrowing and
internal--without-narrowing. All callers and documentation
changed.
| -rw-r--r-- | doc/lispref/commands.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/positions.texi | 24 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/subr.el | 24 | ||||
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/editfns.c | 18 | ||||
| -rw-r--r-- | src/keyboard.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 2 | ||||
| -rw-r--r-- | test/src/buffer-tests.el | 32 |
10 files changed, 58 insertions, 58 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 9723c279a45..6fd9377e1de 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi | |||
| @@ -100,7 +100,7 @@ emacs, The GNU Emacs Manual}) runs these two hooks just as a keyboard | |||
| 100 | command does. | 100 | command does. |
| 101 | 101 | ||
| 102 | Note that, when the buffer text includes very long lines, these two | 102 | Note that, when the buffer text includes very long lines, these two |
| 103 | hooks are called as if they were in a @code{with-narrowing} form | 103 | hooks are called as if they were in a @code{with-restriction} form |
| 104 | (@pxref{Narrowing}), with a | 104 | (@pxref{Narrowing}), with a |
| 105 | @code{long-line-optimizations-in-command-hooks} label and with the | 105 | @code{long-line-optimizations-in-command-hooks} label and with the |
| 106 | buffer narrowed to a portion around point. | 106 | buffer narrowed to a portion around point. |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index f0ca7440c60..a8311f5c9a2 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -3502,7 +3502,7 @@ For efficiency, we recommend writing these functions so that they | |||
| 3502 | usually assign faces to around 400 to 600 characters at each call. | 3502 | usually assign faces to around 400 to 600 characters at each call. |
| 3503 | 3503 | ||
| 3504 | Note that, when the buffer text includes very long lines, these | 3504 | Note that, when the buffer text includes very long lines, these |
| 3505 | functions are called as if they were in a @code{with-narrowing} form | 3505 | functions are called as if they were in a @code{with-restriction} form |
| 3506 | (@pxref{Narrowing}), with a | 3506 | (@pxref{Narrowing}), with a |
| 3507 | @code{long-line-optimizations-in-fontification-functions} label and | 3507 | @code{long-line-optimizations-in-fontification-functions} label and |
| 3508 | with the buffer narrowed to a portion around @var{pos}. | 3508 | with the buffer narrowed to a portion around @var{pos}. |
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index bad83e1be2d..f6a0cf14476 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi | |||
| @@ -1037,12 +1037,12 @@ positions. | |||
| 1037 | In an interactive call, @var{start} and @var{end} are set to the bounds | 1037 | In an interactive call, @var{start} and @var{end} are set to the bounds |
| 1038 | of the current region (point and the mark, with the smallest first). | 1038 | of the current region (point and the mark, with the smallest first). |
| 1039 | 1039 | ||
| 1040 | However, when the narrowing has been set by @code{with-narrowing} with | 1040 | However, when the narrowing has been set by @code{with-restriction} with |
| 1041 | a label argument (see below), @code{narrow-to-region} can be used only | 1041 | a label argument (see below), @code{narrow-to-region} can be used only |
| 1042 | within the limits of that narrowing. If @var{start} or @var{end} are | 1042 | within the limits of that narrowing. If @var{start} or @var{end} are |
| 1043 | outside these limits, the corresponding limit set by | 1043 | outside these limits, the corresponding limit set by |
| 1044 | @code{with-narrowing} is used instead. To gain access to other | 1044 | @code{with-restriction} is used instead. To gain access to other |
| 1045 | portions of the buffer, use @code{without-narrowing} with the same | 1045 | portions of the buffer, use @code{without-restriction} with the same |
| 1046 | label. | 1046 | label. |
| 1047 | @end deffn | 1047 | @end deffn |
| 1048 | 1048 | ||
| @@ -1068,10 +1068,10 @@ It is equivalent to the following expression: | |||
| 1068 | (narrow-to-region 1 (1+ (buffer-size))) | 1068 | (narrow-to-region 1 (1+ (buffer-size))) |
| 1069 | @end example | 1069 | @end example |
| 1070 | 1070 | ||
| 1071 | However, when a narrowing has been set by @code{with-narrowing} with a | 1071 | However, when a narrowing has been set by @code{with-restriction} with a |
| 1072 | label argument (see below), the limits set by @code{with-narrowing} | 1072 | label argument (see below), the limits set by @code{with-restriction} |
| 1073 | are restored, instead of canceling the narrowing. To gain access to | 1073 | are restored, instead of canceling the narrowing. To gain access to |
| 1074 | other portions of the buffer, use @code{without-narrowing} with the | 1074 | other portions of the buffer, use @code{without-restriction} with the |
| 1075 | same label. | 1075 | same label. |
| 1076 | @end deffn | 1076 | @end deffn |
| 1077 | 1077 | ||
| @@ -1089,7 +1089,7 @@ abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). | |||
| 1089 | Therefore, this construct is a clean way to narrow a buffer temporarily. | 1089 | Therefore, this construct is a clean way to narrow a buffer temporarily. |
| 1090 | 1090 | ||
| 1091 | This construct also saves and restores the narrowings that were set by | 1091 | This construct also saves and restores the narrowings that were set by |
| 1092 | @code{with-narrowing} with a label argument (see below). | 1092 | @code{with-restriction} with a label argument (see below). |
| 1093 | 1093 | ||
| 1094 | The value returned by @code{save-restriction} is that returned by the | 1094 | The value returned by @code{save-restriction} is that returned by the |
| 1095 | last form in @var{body}, or @code{nil} if no body forms were given. | 1095 | last form in @var{body}, or @code{nil} if no body forms were given. |
| @@ -1141,7 +1141,7 @@ This is the contents of foo@point{} | |||
| 1141 | @end example | 1141 | @end example |
| 1142 | @end defspec | 1142 | @end defspec |
| 1143 | 1143 | ||
| 1144 | @defspec with-narrowing start end [:label label] body | 1144 | @defspec with-restriction start end [:label label] body |
| 1145 | This special form saves the current bounds of the accessible portion | 1145 | This special form saves the current bounds of the accessible portion |
| 1146 | of the buffer, sets the accessible portion to start at @var{start} and | 1146 | of the buffer, sets the accessible portion to start at @var{start} and |
| 1147 | end at @var{end}, evaluates the @var{body} forms, and restores the | 1147 | end at @var{end}, evaluates the @var{body} forms, and restores the |
| @@ -1164,8 +1164,8 @@ and @code{widen} can be used only within the @var{start} and @var{end} | |||
| 1164 | limits. | 1164 | limits. |
| 1165 | 1165 | ||
| 1166 | @item | 1166 | @item |
| 1167 | To lift the restriction introduced by @code{with-narrowing} and gain | 1167 | To lift the restriction introduced by @code{with-restriction} and gain |
| 1168 | access to other portions of the buffer, use @code{without-narrowing} | 1168 | access to other portions of the buffer, use @code{without-restriction} |
| 1169 | with the same @var{label} argument. (Another way to gain access to | 1169 | with the same @var{label} argument. (Another way to gain access to |
| 1170 | other portions of the buffer is to use an indirect buffer | 1170 | other portions of the buffer is to use an indirect buffer |
| 1171 | (@pxref{Indirect Buffers}).) | 1171 | (@pxref{Indirect Buffers}).) |
| @@ -1180,7 +1180,7 @@ user. | |||
| 1180 | @end itemize | 1180 | @end itemize |
| 1181 | @end defspec | 1181 | @end defspec |
| 1182 | 1182 | ||
| 1183 | @defspec without-narrowing [:label label] body | 1183 | @defspec without-restriction [:label label] body |
| 1184 | This special form saves the current bounds of the accessible portion | 1184 | This special form saves the current bounds of the accessible portion |
| 1185 | of the buffer, widens the buffer, evaluates the @var{body} forms, and | 1185 | of the buffer, widens the buffer, evaluates the @var{body} forms, and |
| 1186 | restores the saved bounds. In that case it is equivalent to | 1186 | restores the saved bounds. In that case it is equivalent to |
| @@ -1192,6 +1192,6 @@ restores the saved bounds. In that case it is equivalent to | |||
| 1192 | @end example | 1192 | @end example |
| 1193 | 1193 | ||
| 1194 | When the optional @var{label} argument is present however, the | 1194 | When the optional @var{label} argument is present however, the |
| 1195 | narrowing set by @code{with-narrowing} with the same @var{label} | 1195 | narrowing set by @code{with-restriction} with the same @var{label} |
| 1196 | argument is lifted. | 1196 | argument is lifted. |
| 1197 | @end defspec | 1197 | @end defspec |
| @@ -620,7 +620,7 @@ In buffers in which these display optimizations are in effect, the | |||
| 620 | hooks are executed on a narrowed portion of the buffer, whose size is | 620 | hooks are executed on a narrowed portion of the buffer, whose size is |
| 621 | controlled by the variables 'long-line-optimizations-region-size' and | 621 | controlled by the variables 'long-line-optimizations-region-size' and |
| 622 | 'long-line-optimizations-bol-search-limit', as if they were in a | 622 | 'long-line-optimizations-bol-search-limit', as if they were in a |
| 623 | 'with-narrowing' form. This may, in particular, cause occasional | 623 | 'with-restriction form. This may, in particular, cause occasional |
| 624 | mis-fontifications in these buffers. | 624 | mis-fontifications in these buffers. |
| 625 | 625 | ||
| 626 | The new function 'long-line-optimizations-p' returns non-nil when | 626 | The new function 'long-line-optimizations-p' returns non-nil when |
| @@ -3820,7 +3820,7 @@ The default timeout value can be defined by the new variable | |||
| 3820 | 'set-transient-map-timeout'. | 3820 | 'set-transient-map-timeout'. |
| 3821 | 3821 | ||
| 3822 | +++ | 3822 | +++ |
| 3823 | ** New forms 'with-narrowing' and 'without-narrowing'. | 3823 | ** New forms 'with-restriction' and 'without-restriction'. |
| 3824 | These forms can be used as enhanced alternatives to the | 3824 | These forms can be used as enhanced alternatives to the |
| 3825 | 'save-restriction' form combined with, respectively, | 3825 | 'save-restriction' form combined with, respectively, |
| 3826 | 'narrow-to-region' and 'widen'. They also accept an optional label | 3826 | 'narrow-to-region' and 'widen'. They also accept an optional label |
diff --git a/lisp/subr.el b/lisp/subr.el index 58a8e85b61d..c26cbb9a56c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3941,7 +3941,7 @@ See also `locate-user-emacs-file'.") | |||
| 3941 | "Return non-nil if the current buffer is narrowed." | 3941 | "Return non-nil if the current buffer is narrowed." |
| 3942 | (/= (- (point-max) (point-min)) (buffer-size))) | 3942 | (/= (- (point-max) (point-min)) (buffer-size))) |
| 3943 | 3943 | ||
| 3944 | (defmacro with-narrowing (start end &rest rest) | 3944 | (defmacro with-restriction (start end &rest rest) |
| 3945 | "Execute BODY with restrictions set to START and END. | 3945 | "Execute BODY with restrictions set to START and END. |
| 3946 | 3946 | ||
| 3947 | The current restrictions, if any, are restored upon return. | 3947 | The current restrictions, if any, are restored upon return. |
| @@ -3949,39 +3949,39 @@ The current restrictions, if any, are restored upon return. | |||
| 3949 | When the optional :label LABEL argument is present, in which | 3949 | When the optional :label LABEL argument is present, in which |
| 3950 | LABEL is a symbol, inside BODY, `narrow-to-region' and `widen' | 3950 | LABEL is a symbol, inside BODY, `narrow-to-region' and `widen' |
| 3951 | can be used only within the START and END limits. To gain access | 3951 | can be used only within the START and END limits. To gain access |
| 3952 | to other portions of the buffer, use `without-narrowing' with the | 3952 | to other portions of the buffer, use `without-restriction' with the |
| 3953 | same LABEL argument. | 3953 | same LABEL argument. |
| 3954 | 3954 | ||
| 3955 | \(fn START END [:label LABEL] BODY)" | 3955 | \(fn START END [:label LABEL] BODY)" |
| 3956 | (if (eq (car rest) :label) | 3956 | (if (eq (car rest) :label) |
| 3957 | `(internal--with-narrowing ,start ,end (lambda () ,@(cddr rest)) | 3957 | `(internal--with-restriction ,start ,end (lambda () ,@(cddr rest)) |
| 3958 | ,(cadr rest)) | 3958 | ,(cadr rest)) |
| 3959 | `(internal--with-narrowing ,start ,end (lambda () ,@rest)))) | 3959 | `(internal--with-restriction ,start ,end (lambda () ,@rest)))) |
| 3960 | 3960 | ||
| 3961 | (defun internal--with-narrowing (start end body &optional label) | 3961 | (defun internal--with-restriction (start end body &optional label) |
| 3962 | "Helper function for `with-narrowing', which see." | 3962 | "Helper function for `with-restriction', which see." |
| 3963 | (save-restriction | 3963 | (save-restriction |
| 3964 | (narrow-to-region start end) | 3964 | (narrow-to-region start end) |
| 3965 | (if label (internal--lock-narrowing label)) | 3965 | (if label (internal--lock-narrowing label)) |
| 3966 | (funcall body))) | 3966 | (funcall body))) |
| 3967 | 3967 | ||
| 3968 | (defmacro without-narrowing (&rest rest) | 3968 | (defmacro without-restriction (&rest rest) |
| 3969 | "Execute BODY without restrictions. | 3969 | "Execute BODY without restrictions. |
| 3970 | 3970 | ||
| 3971 | The current restrictions, if any, are restored upon return. | 3971 | The current restrictions, if any, are restored upon return. |
| 3972 | 3972 | ||
| 3973 | When the optional :label LABEL argument is present, the | 3973 | When the optional :label LABEL argument is present, the |
| 3974 | restrictions set by `with-narrowing' with the same LABEL argument | 3974 | restrictions set by `with-restriction' with the same LABEL argument |
| 3975 | are lifted. | 3975 | are lifted. |
| 3976 | 3976 | ||
| 3977 | \(fn [:label LABEL] BODY)" | 3977 | \(fn [:label LABEL] BODY)" |
| 3978 | (if (eq (car rest) :label) | 3978 | (if (eq (car rest) :label) |
| 3979 | `(internal--without-narrowing (lambda () ,@(cddr rest)) | 3979 | `(internal--without-restriction (lambda () ,@(cddr rest)) |
| 3980 | ,(cadr rest)) | 3980 | ,(cadr rest)) |
| 3981 | `(internal--without-narrowing (lambda () ,@rest)))) | 3981 | `(internal--without-restriction (lambda () ,@rest)))) |
| 3982 | 3982 | ||
| 3983 | (defun internal--without-narrowing (body &optional label) | 3983 | (defun internal--without-restriction (body &optional label) |
| 3984 | "Helper function for `without-narrowing', which see." | 3984 | "Helper function for `without-restriction', which see." |
| 3985 | (save-restriction | 3985 | (save-restriction |
| 3986 | (if label (internal--unlock-narrowing label)) | 3986 | (if label (internal--unlock-narrowing label)) |
| 3987 | (widen) | 3987 | (widen) |
diff --git a/src/buffer.c b/src/buffer.c index 755061d0dee..df1f5206668 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5924,7 +5924,7 @@ This variable has effect only in buffers in which | |||
| 5924 | `long-line-optimizations-p' is non-nil. For performance reasons, in | 5924 | `long-line-optimizations-p' is non-nil. For performance reasons, in |
| 5925 | such buffers, the `fontification-functions', `pre-command-hook' and | 5925 | such buffers, the `fontification-functions', `pre-command-hook' and |
| 5926 | `post-command-hook' hooks are executed on a narrowed buffer around | 5926 | `post-command-hook' hooks are executed on a narrowed buffer around |
| 5927 | point, as if they were called in a `with-narrowing' form with a label. | 5927 | point, as if they were called in a `with-restriction' form with a label. |
| 5928 | This variable specifies the size of the narrowed region around point. | 5928 | This variable specifies the size of the narrowed region around point. |
| 5929 | 5929 | ||
| 5930 | To disable that narrowing, set this variable to 0. | 5930 | To disable that narrowing, set this variable to 0. |
| @@ -5942,7 +5942,7 @@ This variable has effect only in buffers in which | |||
| 5942 | `long-line-optimizations-p' is non-nil. For performance reasons, in | 5942 | `long-line-optimizations-p' is non-nil. For performance reasons, in |
| 5943 | such buffers, the `fontification-functions', `pre-command-hook' and | 5943 | such buffers, the `fontification-functions', `pre-command-hook' and |
| 5944 | `post-command-hook' hooks are executed on a narrowed buffer around | 5944 | `post-command-hook' hooks are executed on a narrowed buffer around |
| 5945 | point, as if they were called in a `with-narrowing' form with a label. | 5945 | point, as if they were called in a `with-restriction' form with a label. |
| 5946 | The variable `long-line-optimizations-region-size' specifies the | 5946 | The variable `long-line-optimizations-region-size' specifies the |
| 5947 | size of the narrowed region around point. This variable, which should | 5947 | size of the narrowed region around point. This variable, which should |
| 5948 | be a small integer, specifies the number of characters by which that | 5948 | be a small integer, specifies the number of characters by which that |
diff --git a/src/editfns.c b/src/editfns.c index f9879662168..ce133785e0b 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2836,10 +2836,10 @@ DEFUN ("widen", Fwiden, Swiden, 0, 0, "", | |||
| 2836 | 2836 | ||
| 2837 | This allows the buffer's full text to be seen and edited. | 2837 | This allows the buffer's full text to be seen and edited. |
| 2838 | 2838 | ||
| 2839 | However, when restrictions have been set by `with-narrowing' with a | 2839 | However, when restrictions have been set by `with-restriction' with a |
| 2840 | label, `widen' restores the narrowing limits set by `with-narrowing'. | 2840 | label, `widen' restores the narrowing limits set by `with-restriction'. |
| 2841 | To gain access to other portions of the buffer, use | 2841 | To gain access to other portions of the buffer, use |
| 2842 | `without-narrowing' with the same label. */) | 2842 | `without-restriction' with the same label. */) |
| 2843 | (void) | 2843 | (void) |
| 2844 | { | 2844 | { |
| 2845 | Fset (Qoutermost_narrowing, Qnil); | 2845 | Fset (Qoutermost_narrowing, Qnil); |
| @@ -2886,12 +2886,12 @@ When calling from Lisp, pass two arguments START and END: | |||
| 2886 | positions (integers or markers) bounding the text that should | 2886 | positions (integers or markers) bounding the text that should |
| 2887 | remain visible. | 2887 | remain visible. |
| 2888 | 2888 | ||
| 2889 | However, when restrictions have been set by `with-narrowing' with a | 2889 | However, when restrictions have been set by `with-restriction' with a |
| 2890 | label, `narrow-to-region' can be used only within the limits of these | 2890 | label, `narrow-to-region' can be used only within the limits of these |
| 2891 | restrictions. If the START or END arguments are outside these limits, | 2891 | restrictions. If the START or END arguments are outside these limits, |
| 2892 | the corresponding limit set by `with-narrowing' is used instead of the | 2892 | the corresponding limit set by `with-restriction' is used instead of the |
| 2893 | argument. To gain access to other portions of the buffer, use | 2893 | argument. To gain access to other portions of the buffer, use |
| 2894 | `without-narrowing' with the same label. */) | 2894 | `without-restriction' with the same label. */) |
| 2895 | (Lisp_Object start, Lisp_Object end) | 2895 | (Lisp_Object start, Lisp_Object end) |
| 2896 | { | 2896 | { |
| 2897 | EMACS_INT s = fix_position (start), e = fix_position (end); | 2897 | EMACS_INT s = fix_position (start), e = fix_position (end); |
| @@ -2944,7 +2944,7 @@ DEFUN ("internal--lock-narrowing", Finternal__lock_narrowing, | |||
| 2944 | Sinternal__lock_narrowing, 1, 1, 0, | 2944 | Sinternal__lock_narrowing, 1, 1, 0, |
| 2945 | doc: /* Lock the current narrowing with LABEL. | 2945 | doc: /* Lock the current narrowing with LABEL. |
| 2946 | 2946 | ||
| 2947 | This is an internal function used by `with-narrowing'. */) | 2947 | This is an internal function used by `with-restriction'. */) |
| 2948 | (Lisp_Object tag) | 2948 | (Lisp_Object tag) |
| 2949 | { | 2949 | { |
| 2950 | Lisp_Object buf = Fcurrent_buffer (); | 2950 | Lisp_Object buf = Fcurrent_buffer (); |
| @@ -2966,7 +2966,7 @@ DEFUN ("internal--unlock-narrowing", Finternal__unlock_narrowing, | |||
| 2966 | Sinternal__unlock_narrowing, 1, 1, 0, | 2966 | Sinternal__unlock_narrowing, 1, 1, 0, |
| 2967 | doc: /* Unlock a narrowing locked with LABEL. | 2967 | doc: /* Unlock a narrowing locked with LABEL. |
| 2968 | 2968 | ||
| 2969 | This is an internal function used by `without-narrowing'. */) | 2969 | This is an internal function used by `without-restriction'. */) |
| 2970 | (Lisp_Object tag) | 2970 | (Lisp_Object tag) |
| 2971 | { | 2971 | { |
| 2972 | Lisp_Object buf = Fcurrent_buffer (); | 2972 | Lisp_Object buf = Fcurrent_buffer (); |
| @@ -3073,7 +3073,7 @@ DEFUN ("save-restriction", Fsave_restriction, Ssave_restriction, 0, UNEVALLED, 0 | |||
| 3073 | The buffer's restrictions make parts of the beginning and end invisible. | 3073 | The buffer's restrictions make parts of the beginning and end invisible. |
| 3074 | \(They are set up with `narrow-to-region' and eliminated with `widen'.) | 3074 | \(They are set up with `narrow-to-region' and eliminated with `widen'.) |
| 3075 | This special form, `save-restriction', saves the current buffer's | 3075 | This special form, `save-restriction', saves the current buffer's |
| 3076 | restrictions, including those that were set by `with-narrowing' with a | 3076 | restrictions, including those that were set by `with-restriction' with a |
| 3077 | label argument, when it is entered, and restores them when it is exited. | 3077 | label argument, when it is entered, and restores them when it is exited. |
| 3078 | So any `narrow-to-region' within BODY lasts only until the end of the form. | 3078 | So any `narrow-to-region' within BODY lasts only until the end of the form. |
| 3079 | The old restrictions settings are restored even in case of abnormal exit | 3079 | The old restrictions settings are restored even in case of abnormal exit |
diff --git a/src/keyboard.c b/src/keyboard.c index 1d0b907bd8e..b2816f8270b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -12732,7 +12732,7 @@ which the error occurred is unconditionally removed, since otherwise | |||
| 12732 | the error might happen repeatedly and make Emacs nonfunctional. | 12732 | the error might happen repeatedly and make Emacs nonfunctional. |
| 12733 | 12733 | ||
| 12734 | Note that, when `long-line-optimizations-p' is non-nil in the buffer, | 12734 | Note that, when `long-line-optimizations-p' is non-nil in the buffer, |
| 12735 | these functions are called as if they were in a `with-narrowing' form, | 12735 | these functions are called as if they were in a `with-restriction' form, |
| 12736 | with a `long-line-optimizations-in-command-hooks' label and with the | 12736 | with a `long-line-optimizations-in-command-hooks' label and with the |
| 12737 | buffer narrowed to a portion around point whose size is specified by | 12737 | buffer narrowed to a portion around point whose size is specified by |
| 12738 | `long-line-optimizations-region-size'. | 12738 | `long-line-optimizations-region-size'. |
| @@ -12752,7 +12752,7 @@ unavoidable, wrap your code in `(while-no-input (redisplay) CODE)' to | |||
| 12752 | avoid making Emacs unresponsive while the user types. | 12752 | avoid making Emacs unresponsive while the user types. |
| 12753 | 12753 | ||
| 12754 | Note that, when `long-line-optimizations-p' is non-nil in the buffer, | 12754 | Note that, when `long-line-optimizations-p' is non-nil in the buffer, |
| 12755 | these functions are called as if they were in a `with-narrowing' form, | 12755 | these functions are called as if they were in a `with-restriction' form, |
| 12756 | with a `long-line-optimizations-in-command-hooks' label and with the | 12756 | with a `long-line-optimizations-in-command-hooks' label and with the |
| 12757 | buffer narrowed to a portion around point whose size is specified by | 12757 | buffer narrowed to a portion around point whose size is specified by |
| 12758 | `long-line-optimizations-region-size'. | 12758 | `long-line-optimizations-region-size'. |
diff --git a/src/xdisp.c b/src/xdisp.c index 1450b869d20..5c5ecaa2bcb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -36778,7 +36778,7 @@ fontify a region starting at POS in the current buffer, and give | |||
| 36778 | fontified regions the property `fontified' with a non-nil value. | 36778 | fontified regions the property `fontified' with a non-nil value. |
| 36779 | 36779 | ||
| 36780 | Note that, when `long-line-optimizations-p' is non-nil in the buffer, | 36780 | Note that, when `long-line-optimizations-p' is non-nil in the buffer, |
| 36781 | these functions are called as if they were in a `with-narrowing' form, | 36781 | these functions are called as if they were in a `with-restriction' form, |
| 36782 | with a `long-line-optimizations-in-fontification-functions' label and | 36782 | with a `long-line-optimizations-in-fontification-functions' label and |
| 36783 | with the buffer narrowed to a portion around POS whose size is | 36783 | with the buffer narrowed to a portion around POS whose size is |
| 36784 | specified by `long-line-optimizations-region-size'. */); | 36784 | specified by `long-line-optimizations-region-size'. */); |
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 0ae78c8d9d9..45914b2b6b0 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el | |||
| @@ -8540,12 +8540,12 @@ Finally, kill the buffer and its temporary file." | |||
| 8540 | ))) | 8540 | ))) |
| 8541 | 8541 | ||
| 8542 | (ert-deftest test-labeled-narrowing () | 8542 | (ert-deftest test-labeled-narrowing () |
| 8543 | "Test `with-narrowing' and `without-narrowing'." | 8543 | "Test `with-restriction' and `without-restriction'." |
| 8544 | (with-current-buffer (generate-new-buffer " foo" t) | 8544 | (with-current-buffer (generate-new-buffer " foo" t) |
| 8545 | (insert (make-string 5000 ?a)) | 8545 | (insert (make-string 5000 ?a)) |
| 8546 | (should (= (point-min) 1)) | 8546 | (should (= (point-min) 1)) |
| 8547 | (should (= (point-max) 5001)) | 8547 | (should (= (point-max) 5001)) |
| 8548 | (with-narrowing | 8548 | (with-restriction |
| 8549 | 100 500 :label 'foo | 8549 | 100 500 :label 'foo |
| 8550 | (should (= (point-min) 100)) | 8550 | (should (= (point-min) 100)) |
| 8551 | (should (= (point-max) 500)) | 8551 | (should (= (point-max) 500)) |
| @@ -8564,11 +8564,11 @@ Finally, kill the buffer and its temporary file." | |||
| 8564 | (narrow-to-region 400 1000) | 8564 | (narrow-to-region 400 1000) |
| 8565 | (should (= (point-min) 400)) | 8565 | (should (= (point-min) 400)) |
| 8566 | (should (= (point-max) 500)) | 8566 | (should (= (point-max) 500)) |
| 8567 | (without-narrowing | 8567 | (without-restriction |
| 8568 | :label 'bar | 8568 | :label 'bar |
| 8569 | (should (= (point-min) 100)) | 8569 | (should (= (point-min) 100)) |
| 8570 | (should (= (point-max) 500))) | 8570 | (should (= (point-max) 500))) |
| 8571 | (without-narrowing | 8571 | (without-restriction |
| 8572 | :label 'foo | 8572 | :label 'foo |
| 8573 | (should (= (point-min) 1)) | 8573 | (should (= (point-min) 1)) |
| 8574 | (should (= (point-max) 5001))) | 8574 | (should (= (point-max) 5001))) |
| @@ -8577,18 +8577,18 @@ Finally, kill the buffer and its temporary file." | |||
| 8577 | (widen) | 8577 | (widen) |
| 8578 | (should (= (point-min) 100)) | 8578 | (should (= (point-min) 100)) |
| 8579 | (should (= (point-max) 500)) | 8579 | (should (= (point-max) 500)) |
| 8580 | (with-narrowing | 8580 | (with-restriction |
| 8581 | 50 250 :label 'bar | 8581 | 50 250 :label 'bar |
| 8582 | (should (= (point-min) 100)) | 8582 | (should (= (point-min) 100)) |
| 8583 | (should (= (point-max) 250)) | 8583 | (should (= (point-max) 250)) |
| 8584 | (widen) | 8584 | (widen) |
| 8585 | (should (= (point-min) 100)) | 8585 | (should (= (point-min) 100)) |
| 8586 | (should (= (point-max) 250)) | 8586 | (should (= (point-max) 250)) |
| 8587 | (without-narrowing | 8587 | (without-restriction |
| 8588 | :label 'bar | 8588 | :label 'bar |
| 8589 | (should (= (point-min) 100)) | 8589 | (should (= (point-min) 100)) |
| 8590 | (should (= (point-max) 500)) | 8590 | (should (= (point-max) 500)) |
| 8591 | (without-narrowing | 8591 | (without-restriction |
| 8592 | :label 'foo | 8592 | :label 'foo |
| 8593 | (should (= (point-min) 1)) | 8593 | (should (= (point-min) 1)) |
| 8594 | (should (= (point-max) 5001))) | 8594 | (should (= (point-max) 5001))) |
| @@ -8598,39 +8598,39 @@ Finally, kill the buffer and its temporary file." | |||
| 8598 | (should (= (point-max) 250))) | 8598 | (should (= (point-max) 250))) |
| 8599 | (should (= (point-min) 100)) | 8599 | (should (= (point-min) 100)) |
| 8600 | (should (= (point-max) 500)) | 8600 | (should (= (point-max) 500)) |
| 8601 | (with-narrowing | 8601 | (with-restriction |
| 8602 | 50 250 :label 'bar | 8602 | 50 250 :label 'bar |
| 8603 | (should (= (point-min) 100)) | 8603 | (should (= (point-min) 100)) |
| 8604 | (should (= (point-max) 250)) | 8604 | (should (= (point-max) 250)) |
| 8605 | (with-narrowing | 8605 | (with-restriction |
| 8606 | 150 500 :label 'baz | 8606 | 150 500 :label 'baz |
| 8607 | (should (= (point-min) 150)) | 8607 | (should (= (point-min) 150)) |
| 8608 | (should (= (point-max) 250)) | 8608 | (should (= (point-max) 250)) |
| 8609 | (without-narrowing | 8609 | (without-restriction |
| 8610 | :label 'bar | 8610 | :label 'bar |
| 8611 | (should (= (point-min) 150)) | 8611 | (should (= (point-min) 150)) |
| 8612 | (should (= (point-max) 250))) | 8612 | (should (= (point-max) 250))) |
| 8613 | (without-narrowing | 8613 | (without-restriction |
| 8614 | :label 'foo | 8614 | :label 'foo |
| 8615 | (should (= (point-min) 150)) | 8615 | (should (= (point-min) 150)) |
| 8616 | (should (= (point-max) 250))) | 8616 | (should (= (point-max) 250))) |
| 8617 | (without-narrowing | 8617 | (without-restriction |
| 8618 | :label 'baz | 8618 | :label 'baz |
| 8619 | (should (= (point-min) 100)) | 8619 | (should (= (point-min) 100)) |
| 8620 | (should (= (point-max) 250)) | 8620 | (should (= (point-max) 250)) |
| 8621 | (without-narrowing | 8621 | (without-restriction |
| 8622 | :label 'foo | 8622 | :label 'foo |
| 8623 | (should (= (point-min) 100)) | 8623 | (should (= (point-min) 100)) |
| 8624 | (should (= (point-max) 250))) | 8624 | (should (= (point-max) 250))) |
| 8625 | (without-narrowing | 8625 | (without-restriction |
| 8626 | :label 'bar | 8626 | :label 'bar |
| 8627 | (should (= (point-min) 100)) | 8627 | (should (= (point-min) 100)) |
| 8628 | (should (= (point-max) 500)) | 8628 | (should (= (point-max) 500)) |
| 8629 | (without-narrowing | 8629 | (without-restriction |
| 8630 | :label 'foobar | 8630 | :label 'foobar |
| 8631 | (should (= (point-min) 100)) | 8631 | (should (= (point-min) 100)) |
| 8632 | (should (= (point-max) 500))) | 8632 | (should (= (point-max) 500))) |
| 8633 | (without-narrowing | 8633 | (without-restriction |
| 8634 | :label 'foo | 8634 | :label 'foo |
| 8635 | (should (= (point-min) 1)) | 8635 | (should (= (point-min) 1)) |
| 8636 | (should (= (point-max) 5001))) | 8636 | (should (= (point-max) 5001))) |