Просмотр исходного кода

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 лет назад
Родитель
Сommit
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."