diff options
author | Basil L. Contovounesios <basil@contovou.net> | 2025-02-02 18:05:57 +0100 |
---|---|---|
committer | Basil L. Contovounesios <basil@contovou.net> | 2025-02-14 15:42:52 +0100 |
commit | ac143186c04ffd729cfe11abd99f02abdf742f64 (patch) | |
tree | 7720fb47fcf8fff57900f7956e5dc3ac5d7f1092 /lisp/emacs-lisp/cl-seq.el | |
parent | 0edf094e54c721f6039b878cafb8ed02fac74a0f (diff) | |
download | emacs-ac143186c04ffd729cfe11abd99f02abdf742f64.tar.gz emacs-ac143186c04ffd729cfe11abd99f02abdf742f64.tar.bz2 emacs-ac143186c04ffd729cfe11abd99f02abdf742f64.zip |
Document cl-n... set operations consistently
The docstrings of cl-nintersection and cl-nset-difference have been
inconsistent with their manual entries since the beginning of
emacs.git history (bug#76017). This patch settles on the weaker and
thus backward-compatible requirement that only their first argument
be safe to mutate.
* lisp/emacs-lisp/bytecomp.el: Include only first argument in
mutates-arguments property.
* lisp/emacs-lisp/cl-seq.el (cl-nintersection, cl-nset-difference):
Make docstring consistent with manual in that the second argument is
not modified.
* test/lisp/emacs-lisp/cl-seq-tests.el (cl-nintersection-test)
(cl-nset-difference-test): Simplify.
(cl-nset-difference): Pass fresh list as second argument, otherwise
destructive modifications to it could go undetected.
Diffstat (limited to 'lisp/emacs-lisp/cl-seq.el')
-rw-r--r-- | lisp/emacs-lisp/cl-seq.el | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index 1878153f811..5b4337ad9cb 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el @@ -864,8 +864,8 @@ to avoid corrupting the original LIST1 and LIST2. (defun cl-nintersection (cl-list1 cl-list2 &rest cl-keys) "Combine LIST1 and LIST2 using a set-intersection operation. The resulting list contains all items that appear in both LIST1 and LIST2. -This is a destructive function; it reuses the storage of LIST1 and LIST2 -whenever possible. +This is a destructive function; it reuses the storage of LIST1 (but not +LIST2) whenever possible. \nKeywords supported: :test :test-not :key \n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (and cl-list1 cl-list2 (apply 'cl-intersection cl-list1 cl-list2 cl-keys))) @@ -894,8 +894,8 @@ to avoid corrupting the original LIST1 and LIST2. (defun cl-nset-difference (cl-list1 cl-list2 &rest cl-keys) "Combine LIST1 and LIST2 using a set-difference operation. The resulting list contains all items that appear in LIST1 but not LIST2. -This is a destructive function; it reuses the storage of LIST1 and LIST2 -whenever possible. +This is a destructive function; it reuses the storage of LIST1 (but not +LIST2) whenever possible. \nKeywords supported: :test :test-not :key \n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (if (or (null cl-list1) (null cl-list2)) cl-list1 |