|
From: | Gregory Heytings |
Subject: | bug#64391: buffer narrowing slowdown regression in emacs 29 |
Date: | Sun, 09 Jul 2023 18:03:02 +0000 |
On a second thought, I believe its better to not replace LABEL with TAG, because that would mean changing that word in many places, including places in which such a change would make the text less understandable, e.g. the docstring of narrow-to-region:LABEL implies a string or a symbol, whereas :label can accept "any object that is not nil". The description of 'catch' uses TAG.
I know, and I agree that in principle TAG would be better. However all the code and documentation was written with the word "label", and although using a non-symbol is possible, LABEL is intended to be a symbol, not an arbitrary Lisp object. So perhaps the best thing to do would be this:
diff --git a/lisp/subr.el b/lisp/subr.el index 0b397b7bebf..c2110cb4bb2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3972,7 +3972,8 @@ with-restriction \(fn START END [:label LABEL] BODY)" (declare (indent 2) (debug t)) - (if (eq (car rest) :label) + (if (and (eq (car rest) :label) + (symbolp (cadr rest))) `(internal--with-restriction ,start ,end (lambda () ,@(cddr rest)) ,(cadr rest)) `(internal--with-restriction ,start ,end (lambda () ,@rest))))
--- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -1169,9 +1169,10 @@ 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 is evaluated to get the +label to use and must not be @code{nil},What "must not be nil": the label or the result of its evaluation?
The result of the evaluation of the label argument. I don't know how to make this clearer.
[Prev in Thread] | Current Thread | [Next in Thread] |