mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-28 07:45:00 +00:00
Declare more functions as having important-return-value
* lisp/subr.el (assoc-delete-all, assq-delete-all, rassq-delete-all) (alist-get): Declare as important-return-value. * lisp/emacs-lisp/bytecomp.el (important-return-value-fns): Add `assoc-string`.
This commit is contained in:
parent
5d15818b94
commit
88d1e9b436
@ -3561,7 +3561,7 @@ lambda-expression."
|
||||
;; These functions are side-effect-free except for the
|
||||
;; behaviour of functions passed as argument.
|
||||
mapcar mapcan mapconcat
|
||||
assoc plist-get plist-member
|
||||
assoc assoc-string plist-get plist-member
|
||||
|
||||
;; It's safe to ignore the value of `sort' and `nreverse'
|
||||
;; when used on arrays, but most calls pass lists.
|
||||
|
@ -893,6 +893,7 @@ Non-strings in LIST are ignored."
|
||||
Compare keys with TEST. Defaults to `equal'.
|
||||
Return the modified alist.
|
||||
Elements of ALIST that are not conses are ignored."
|
||||
(declare (important-return-value t))
|
||||
(unless test (setq test #'equal))
|
||||
(while (and (consp (car alist))
|
||||
(funcall test (caar alist) key))
|
||||
@ -909,12 +910,14 @@ Elements of ALIST that are not conses are ignored."
|
||||
"Delete from ALIST all elements whose car is `eq' to KEY.
|
||||
Return the modified alist.
|
||||
Elements of ALIST that are not conses are ignored."
|
||||
(declare (important-return-value t))
|
||||
(assoc-delete-all key alist #'eq))
|
||||
|
||||
(defun rassq-delete-all (value alist)
|
||||
"Delete from ALIST all elements whose cdr is `eq' to VALUE.
|
||||
Return the modified alist.
|
||||
Elements of ALIST that are not conses are ignored."
|
||||
(declare (important-return-value t))
|
||||
(while (and (consp (car alist))
|
||||
(eq (cdr (car alist)) value))
|
||||
(setq alist (cdr alist)))
|
||||
@ -957,6 +960,7 @@ Example:
|
||||
(setf (alist-get \\='b foo nil \\='remove) nil)
|
||||
|
||||
foo => ((a . 1))"
|
||||
(declare (important-return-value t))
|
||||
(ignore remove) ;;Silence byte-compiler.
|
||||
(let ((x (if (not testfn)
|
||||
(assq key alist)
|
||||
|
Loading…
Reference in New Issue
Block a user