Browse Source

an Org-mode version of the cl every function

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

+ 7 - 0
lisp/org.el

@@ -21753,6 +21753,13 @@ Taken from `reduce' in cl-seq.el with all keyword arguments but
       (setq cl-accum (funcall cl-func cl-accum (pop cl-seq))))
     cl-accum))
 
+(defun org-every (pred seq)
+  "Return true if PREDICATE is true of every element of SEQ.
+Adapted from `every' in cl.el."
+  (catch 'org-every
+    (mapc (lambda (e) (unless (funcall pred e) (throw 'org-every nil))) seq)
+    t))
+
 (defun org-back-over-empty-lines ()
   "Move backwards over whitespace, to the beginning of the first empty line.
 Returns the number of empty lines passed."