浏览代码

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 年之前
父节点
当前提交
52b91acc59
共有 1 个文件被更改,包括 7 次插入0 次删除
  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."