Skip to content

Commit f27187f

Browse files
committed
Clarify lexvar restrictions for add-to-ordered-list, add-to-history
* lisp/subr.el (add-to-ordered-list, add-to-history): * doc/lispref/lists.texi (List Variables): * doc/lispref/minibuf.texi (Minibuffer History): Note in the doc string and manual that the variable arguments to add-to-ordered-list and add-to-history cannot refer to a lexical variable (bug#39373).
1 parent 32763da commit f27187f

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

doc/lispref/lists.texi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ and unlike @code{setq}. Quote the argument yourself if necessary.
832832

833833
The ordering information is stored in a hash table on @var{symbol}'s
834834
@code{list-order} property.
835+
@var{symbol} cannot refer to a lexical variable.
835836
@end defun
836837

837838
Here's a scenario showing how to use @code{add-to-ordered-list}:

doc/lispref/minibuf.texi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ and returns the updated history list. It limits the list length to
572572
the value of @var{maxelt} (if non-@code{nil}) or @code{history-length}
573573
(described below). The possible values of @var{maxelt} have the same
574574
meaning as the values of @code{history-length}.
575+
@var{history-var} cannot refer to a lexical variable.
575576

576577
Normally, @code{add-to-history} removes duplicate members from the
577578
history list if @code{history-delete-duplicates} is non-@code{nil}.

lisp/subr.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,7 @@ of ELEMENT if it has one.
19351935
19361936
The list order for each element is stored in LIST-VAR's
19371937
`list-order' property.
1938+
LIST-VAR cannot refer to a lexical variable.
19381939
19391940
The return value is the new value of LIST-VAR."
19401941
(let ((ordering (get list-var 'list-order)))
@@ -1963,7 +1964,8 @@ variable. The possible values of maximum length have the same meaning as
19631964
the values of `history-length'.
19641965
Remove duplicates of NEWELT if `history-delete-duplicates' is non-nil.
19651966
If optional fourth arg KEEP-ALL is non-nil, add NEWELT to history even
1966-
if it is empty or duplicates the most recent entry in the history."
1967+
if it is empty or duplicates the most recent entry in the history.
1968+
HISTORY-VAR cannot refer to a lexical variable."
19671969
(unless maxelt
19681970
(setq maxelt (or (get history-var 'history-length)
19691971
history-length)))

0 commit comments

Comments
 (0)