Subject: bug#64391: buffer narrowing slowdown regression in emacs 29

From: Gregory Heytings <[email-masked]>
Date: Sat, 08 Jul 2023 22:21:20 +0000

>> I thought that "special form" and "macro" were more or less synonyms. 
>> The manual describes lambda, prog2, setq-default, dlet, letrec, 
>> named-let, with-suppressed-warnings, with-no-warnings, with-restriction 
>> and without-restriction as "special forms", although they are in fact 
>> macros.
>
> You're right: from a programmer's stand point the distinction doesn't 
> really matter.  It matters only from the point of view of the language 
> implementer.  For some reason it tripped me, here (I went looking at the 
> code fearing that we were using an actual special form).
>
> Sorry 'bout that, move along, nothing to see :-)
>

Well, there's at least something that could be fixed in the manuals.  I 
admit I had never read the "Special Forms" section, and if the manual had 
been consistent about the special form vs. macro distiction, perhaps I 
wouldn't have confused these two similar, but subtly different, notions.

>> The latter: it's like catch/throw, it's intended to use with a symbol 
>> but it could be any non-nil value.  So one could write something 
>> similar to what is found in the docstring of catch: "LABEL is evalled 
>> to get the label to use, it must not be nil".
>
> +1 from me,
>

Eli, I guess that minor documentation fix is okay for emacs-29?

diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index e74a165b9ed..af5e648eb9d 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -1169,9 +1169,9 @@ Narrowing

  @cindex labeled narrowing
  @cindex labeled restriction
-When the optional argument @var{label}, a symbol, is present, the
-narrowing is @dfn{labeled}.  A labeled narrowing differs from a
-non-labeled one in several ways:
+When the optional argument @var{label}, which may be any Lisp object
+except @code{nil}, is present, the narrowing is @dfn{labeled}.  A
+labeled narrowing differs from a non-labeled one in several ways:

  @itemize @bullet
  @item
diff --git a/lisp/subr.el b/lisp/subr.el
index 0b397b7bebf..b73d0e5d989 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3964,11 +3964,11 @@ with-restriction

  The current restrictions, if any, are restored upon return.

-When the optional :label LABEL argument is present, in which
-LABEL is a symbol, inside BODY, `narrow-to-region' and `widen'
-can be used only within the START and END limits.  To gain access
-to other portions of the buffer, use `without-restriction' with the
-same LABEL argument.
+When the optional :label LABEL argument, which is evalled to get
+the label to use and must not be nil, is present, inside BODY,
+`narrow-to-region' and `widen' can be used only within the START
+and END limits.  To gain access to other portions of the buffer,
+use `without-restriction' with the same LABEL argument.

  \(fn START END [:label LABEL] BODY)"
    (declare (indent 2) (debug t))