From: Stefan Monnier Date: Thu, 17 Mar 2022 13:54:41 +0000 (-0400) Subject: (seq-contains-p): Refine the non-nil returned value X-Git-Tag: emacs-29.0.90~1931^2~1066 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=81bcad03e93854087ab239f4e8b7c062fb069ca5;p=emacs.git (seq-contains-p): Refine the non-nil returned value * lisp/emacs-lisp/seq.el (seq-contains-p): Like `cl-some` return the value returned by the test function rather than t. --- diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 5ea9fae2e9b..1bcb844d8e9 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -418,8 +418,9 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil." Equality is defined by TESTFN if non-nil or by `equal' if nil." (catch 'seq--break (seq-doseq (e sequence) - (when (funcall (or testfn #'equal) e elt) - (throw 'seq--break t))) + (let ((r (funcall (or testfn #'equal) e elt))) + (when r + (throw 'seq--break r)))) nil)) (cl-defgeneric seq-set-equal-p (sequence1 sequence2 &optional testfn)