Przeglądaj źródła

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 13 lat temu
rodzic
commit
52b91acc59
1 zmienionych plików z 7 dodań i 0 usunięć
  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."