Browse Source

if we have org-every we should have org-some

* lisp/org.el (org-some): An org-mode version of the cl some function.
Eric Schulte 12 years ago
parent
commit
52b91acc59
1 changed files with 7 additions and 0 deletions
  1. 7 0
      lisp/org.el

+ 7 - 0
lisp/org.el

@@ -21760,6 +21760,13 @@ Adapted from `every' in cl.el."
     (mapc (lambda (e) (unless (funcall pred e) (throw 'org-every nil))) seq)
     (mapc (lambda (e) (unless (funcall pred e) (throw 'org-every nil))) seq)
     t))
     t))
 
 
+(defun org-some (pred seq)
+  "Return true if PREDICATE is true of any element of SEQ.
+Adapted from `some' in cl.el."
+  (catch 'org-some
+    (mapc (lambda (e) (when (funcall pred e) (throw 'org-some t))) seq)
+    nil))
+
 (defun org-back-over-empty-lines ()
 (defun org-back-over-empty-lines ()
   "Move backwards over whitespace, to the beginning of the first empty line.
   "Move backwards over whitespace, to the beginning of the first empty line.
 Returns the number of empty lines passed."
 Returns the number of empty lines passed."