summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-08-12 15:37:20 +0300
committerAlex Kost <alezost@gmail.com>2015-08-30 18:26:01 +0300
commite767752c79975d30341f71d7f9de88edeb192d59 (patch)
tree6569c78ee1736da3d1795fc6881df514ceecdacf /emacs
parentad0f31f6a514d29b2f734069d5c3b2a7a6cd2a82 (diff)
emacs: Add 'guix-any'.
* emacs/guix-utils.el (guix-any): New function.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-utils.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index 3157f6359b..fb1ca60654 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -215,6 +215,14 @@ accessed with KEYS."
(while (re-search-forward ,regexp nil t)
,@body)))
+(defun guix-any (pred lst)
+ "Test whether any element from LST satisfies PRED.
+If so, return the return value from the successful PRED call.
+Return nil otherwise."
+ (when lst
+ (or (funcall pred (car lst))
+ (guix-any pred (cdr lst)))))
+
;;; Diff