summaryrefslogtreecommitdiff
path: root/doc/lispref/lists.texi
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-12-31 05:28:47 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2020-12-31 05:28:47 +0100
commitb1ac23ebef62d5a185727a4973462828dc6f65f0 (patch)
tree453a984bdfccfd3217743630e2b7260b144d38d7 /doc/lispref/lists.texi
parent3d9f20cfcf647063e62ba12187cf3b4bcd4d9685 (diff)
downloademacs-b1ac23ebef62d5a185727a4973462828dc6f65f0.tar.gz
emacs-b1ac23ebef62d5a185727a4973462828dc6f65f0.tar.bz2
emacs-b1ac23ebef62d5a185727a4973462828dc6f65f0.zip
Allow add-to-ordered-list to use a test predicate
* doc/lispref/lists.texi (List Variables): Update manual. * lisp/subr.el (add-to-ordered-list): Allow using a test predicate, and make slightly more efficient (bug#45539).
Diffstat (limited to 'doc/lispref/lists.texi')
-rw-r--r--doc/lispref/lists.texi9
1 files changed, 5 insertions, 4 deletions
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index ae793d5e15e..21ee386335e 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -807,13 +807,14 @@ foo ;; @r{@code{foo} was changed.}
(setq @var{var} (cons @var{value} @var{var})))
@end example
-@defun add-to-ordered-list symbol element &optional order
+@defun add-to-ordered-list symbol element &optional order test-function
This function sets the variable @var{symbol} by inserting
@var{element} into the old value, which must be a list, at the
position specified by @var{order}. If @var{element} is already a
-member of the list, its position in the list is adjusted according
-to @var{order}. Membership is tested using @code{eq}.
-This function returns the resulting list, whether updated or not.
+member of the list, its position in the list is adjusted according to
+@var{order}. Membership is tested using @var{test-function},
+defaulting to @code{eq} if @var{test-function} isn't present. This
+function returns the resulting list, whether updated or not.
The @var{order} is typically a number (integer or float), and the
elements of the list are sorted in non-decreasing numerical order.