summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-11-20 09:38:54 -0700
committerEric Schulte <schulte.eric@gmail.com>2011-11-20 09:38:54 -0700
commit15417f67c4a818173c13d6e413bf8984bc04d347 (patch)
treeab85cf9747d291b0b9391e926c7e42c3dcca562b
parentf55810593e8dcac95ec4faf6a0cf59e4742aa569 (diff)
downloadorg-mode-15417f67c4a818173c13d6e413bf8984bc04d347.tar.gz
Added a less functional Org-mode copy of the cl reduce function.
* lisp/org.el (org-reduce): Added a less functional Org-mode copy of the cl reduce function.
-rw-r--r--lisp/org.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 5d52884..18e2927 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19660,6 +19660,18 @@ Taken from `count' in cl-seq.el with all keyword arguments removed."
(if (funcall predicate e) (push e res)))
(nreverse res)))
+(defun org-reduce (cl-func cl-seq &rest cl-keys)
+ "Reduce two-argument FUNCTION across SEQ.
+Taken from `reduce' in cl-seq.el with all keyword arguments but
+\":initial-value\" removed."
+ (let ((cl-accum (cond ((memq :initial-value cl-keys)
+ (cadr (memq :initial-value cl-keys)))
+ (cl-seq (pop cl-seq))
+ (t (funcall cl-func)))))
+ (while cl-seq
+ (setq cl-accum (funcall cl-func cl-accum (pop cl-seq))))
+ cl-accum))
+
(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."