aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory Heytings2023-02-13 10:23:39 +0000
committerGregory Heytings2023-02-13 11:39:46 +0100
commitdcb2379a463678bdadd05ee39d61e7da84c71c5e (patch)
tree551ac04d89f0a0b6c18ef5d4967d40c4e2dc5afb
parent4297039bd1325166eac82d950951716ec122d465 (diff)
downloademacs-scratch/fix-locked-narrowing.tar.gz
emacs-scratch/fix-locked-narrowing.zip
Minor improvements to labeled narrowingscratch/fix-locked-narrowing
* lisp/subr.el (internal--with-narrowing): (internal--without-narrowing): Remove unnecessary 'progn'. * etc/NEWS: Mention 'with-narrowing' in the entry about long lines. * doc/lispref/positions.texi (Narrowing): Fix typo. * doc/lispref/display.texi (Auto Faces): Use @pxref. * doc/lispref/commands.texi (Command Overview): Use @pxref.
-rw-r--r--doc/lispref/commands.texi4
-rw-r--r--doc/lispref/display.texi2
-rw-r--r--doc/lispref/positions.texi2
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/subr.el14
5 files changed, 13 insertions, 14 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index be34027d21d..9723c279a45 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -100,8 +100,8 @@ emacs, The GNU Emacs Manual}) runs these two hooks just as a keyboard
100command does. 100command 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
103hooks are called as if they were in a @code{with-narrowing} form (see 103hooks are called as if they were in a @code{with-narrowing} form
104@ref{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
106buffer narrowed to a portion around point. 106buffer narrowed to a portion around point.
107 107
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 1b7ef006634..f0ca7440c60 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -3503,7 +3503,7 @@ usually assign faces to around 400 to 600 characters at each call.
3503 3503
3504Note that, when the buffer text includes very long lines, these 3504Note that, when the buffer text includes very long lines, these
3505functions are called as if they were in a @code{with-narrowing} form 3505functions are called as if they were in a @code{with-narrowing} form
3506(see @ref{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
3508with the buffer narrowed to a portion around @var{pos}. 3508with the buffer narrowed to a portion around @var{pos}.
3509@end defvar 3509@end defvar
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index e7d5c610d67..bad83e1be2d 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -1193,5 +1193,5 @@ restores the saved bounds. In that case it is equivalent to
1193 1193
1194When the optional @var{label} argument is present however, the 1194When the optional @var{label} argument is present however, the
1195narrowing set by @code{with-narrowing} with the same @var{label} 1195narrowing set by @code{with-narrowing} with the same @var{label}
1196argument are lifted. 1196argument is lifted.
1197@end defspec 1197@end defspec
diff --git a/etc/NEWS b/etc/NEWS
index 01e7f2cfb09..de4f65ebe62 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -619,8 +619,9 @@ In buffers in which these display optimizations are in effect, the
619'fontification-functions', 'pre-command-hook' and 'post-command-hook' 619'fontification-functions', 'pre-command-hook' and 'post-command-hook'
620hooks are executed on a narrowed portion of the buffer, whose size is 620hooks are executed on a narrowed portion of the buffer, whose size is
621controlled by the options 'long-line-optimizations-region-size' and 621controlled by the options 'long-line-optimizations-region-size' and
622'long-line-optimizations-bol-search-limit'. This may, in particular, 622'long-line-optimizations-bol-search-limit', as if they were in a
623cause occasional mis-fontifications in these buffers. 623'with-narrowing' form. This may, in particular, cause occasional
624mis-fontifications in these buffers.
624 625
625The new function 'long-line-optimizations-p' returns non-nil when 626The new function 'long-line-optimizations-p' returns non-nil when
626these optimizations are in effect in the current buffer. 627these optimizations are in effect in the current buffer.
diff --git a/lisp/subr.el b/lisp/subr.el
index 7ed0cb02a70..d280c7fef13 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3961,10 +3961,9 @@ same LABEL argument.
3961(defun internal--with-narrowing (start end body &optional label) 3961(defun internal--with-narrowing (start end body &optional label)
3962 "Helper function for `with-narrowing', which see." 3962 "Helper function for `with-narrowing', which see."
3963 (save-restriction 3963 (save-restriction
3964 (progn 3964 (narrow-to-region start end)
3965 (narrow-to-region start end) 3965 (if label (internal--lock-narrowing label))
3966 (if label (internal--lock-narrowing label)) 3966 (funcall body)))
3967 (funcall body))))
3968 3967
3969(defmacro without-narrowing (&rest rest) 3968(defmacro without-narrowing (&rest rest)
3970 "Execute BODY without restrictions. 3969 "Execute BODY without restrictions.
@@ -3984,10 +3983,9 @@ are lifted.
3984(defun internal--without-narrowing (body &optional label) 3983(defun internal--without-narrowing (body &optional label)
3985 "Helper function for `without-narrowing', which see." 3984 "Helper function for `without-narrowing', which see."
3986 (save-restriction 3985 (save-restriction
3987 (progn 3986 (if label (internal--unlock-narrowing label))
3988 (if label (internal--unlock-narrowing label)) 3987 (widen)
3989 (widen) 3988 (funcall body)))
3990 (funcall body))))
3991 3989
3992(defun find-tag-default-bounds () 3990(defun find-tag-default-bounds ()
3993 "Determine the boundaries of the default tag, based on text at point. 3991 "Determine the boundaries of the default tag, based on text at point.