Minor improvements to labeled 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.
This commit is contained in:
Gregory Heytings 2023-02-13 10:23:39 +00:00
parent 4297039bd1
commit dcb2379a46
5 changed files with 13 additions and 14 deletions

View file

@ -100,8 +100,8 @@ emacs, The GNU Emacs Manual}) runs these two hooks just as a keyboard
command does. command does.
Note that, when the buffer text includes very long lines, these two Note that, when the buffer text includes very long lines, these two
hooks are called as if they were in a @code{with-narrowing} form (see hooks are called as if they were in a @code{with-narrowing} form
@ref{Narrowing}), with a (@pxref{Narrowing}), with a
@code{long-line-optimizations-in-command-hooks} label and with the @code{long-line-optimizations-in-command-hooks} label and with the
buffer narrowed to a portion around point. buffer narrowed to a portion around point.

View file

@ -3503,7 +3503,7 @@ usually assign faces to around 400 to 600 characters at each call.
Note that, when the buffer text includes very long lines, these Note that, when the buffer text includes very long lines, these
functions are called as if they were in a @code{with-narrowing} form functions are called as if they were in a @code{with-narrowing} form
(see @ref{Narrowing}), with a (@pxref{Narrowing}), with a
@code{long-line-optimizations-in-fontification-functions} label and @code{long-line-optimizations-in-fontification-functions} label and
with the buffer narrowed to a portion around @var{pos}. with the buffer narrowed to a portion around @var{pos}.
@end defvar @end defvar

View file

@ -1193,5 +1193,5 @@ restores the saved bounds. In that case it is equivalent to
When the optional @var{label} argument is present however, the When the optional @var{label} argument is present however, the
narrowing set by @code{with-narrowing} with the same @var{label} narrowing set by @code{with-narrowing} with the same @var{label}
argument are lifted. argument is lifted.
@end defspec @end defspec

View file

@ -619,8 +619,9 @@ In buffers in which these display optimizations are in effect, the
'fontification-functions', 'pre-command-hook' and 'post-command-hook' 'fontification-functions', 'pre-command-hook' and 'post-command-hook'
hooks are executed on a narrowed portion of the buffer, whose size is hooks are executed on a narrowed portion of the buffer, whose size is
controlled by the options 'long-line-optimizations-region-size' and controlled by the options 'long-line-optimizations-region-size' and
'long-line-optimizations-bol-search-limit'. This may, in particular, 'long-line-optimizations-bol-search-limit', as if they were in a
cause occasional mis-fontifications in these buffers. 'with-narrowing' form. This may, in particular, cause occasional
mis-fontifications in these buffers.
The new function 'long-line-optimizations-p' returns non-nil when The new function 'long-line-optimizations-p' returns non-nil when
these optimizations are in effect in the current buffer. these optimizations are in effect in the current buffer.

View file

@ -3961,10 +3961,9 @@ same LABEL argument.
(defun internal--with-narrowing (start end body &optional label) (defun internal--with-narrowing (start end body &optional label)
"Helper function for `with-narrowing', which see." "Helper function for `with-narrowing', which see."
(save-restriction (save-restriction
(progn
(narrow-to-region start end) (narrow-to-region start end)
(if label (internal--lock-narrowing label)) (if label (internal--lock-narrowing label))
(funcall body)))) (funcall body)))
(defmacro without-narrowing (&rest rest) (defmacro without-narrowing (&rest rest)
"Execute BODY without restrictions. "Execute BODY without restrictions.
@ -3984,10 +3983,9 @@ are lifted.
(defun internal--without-narrowing (body &optional label) (defun internal--without-narrowing (body &optional label)
"Helper function for `without-narrowing', which see." "Helper function for `without-narrowing', which see."
(save-restriction (save-restriction
(progn
(if label (internal--unlock-narrowing label)) (if label (internal--unlock-narrowing label))
(widen) (widen)
(funcall body)))) (funcall body)))
(defun find-tag-default-bounds () (defun find-tag-default-bounds ()
"Determine the boundaries of the default tag, based on text at point. "Determine the boundaries of the default tag, based on text at point.