Преглед изворни кода

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 пре 13 година
родитељ
комит
29e2853870
1 измењених фајлова са 7 додато и 0 уклоњено
  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))))
       (setq cl-accum (funcall cl-func cl-accum (pop cl-seq))))
     cl-accum))
     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 ()
 (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."