From 1b5fda5cbca96aec3e407bc9e4f8a16e48e7954c Mon Sep 17 00:00:00 2001 From: Nicolas Petton Date: Sun, 6 Sep 2015 00:51:35 +0200 Subject: Improve the semantic of map-some Update map-some to return the returned by the predicate, similar to seq-some. * lisp/emacs-lisp/map.el (map-some): Update the function to return the return value of the predicate. * test/automated/map-tests.el (test-map-some): Update the test to check for non-nil values only. --- lisp/emacs-lisp/map.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index 4e7d3b91b16..ea56efefe97 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -262,8 +262,9 @@ MAP can be a list, hash-table or array." MAP can be a list, hash-table or array." (catch 'map--break (map-apply (lambda (key value) - (when (funcall pred key value) - (throw 'map--break (cons key value)))) + (let ((result (funcall pred key value))) + (when result + (throw 'map--break result)))) map) nil)) -- cgit v1.2.3