org-element: Small refactoring

* contrib/lisp/org-element.el (org-element-map): Remove use of `every'
  function.
This commit is contained in:
Nicolas Goaziou 2012-06-22 15:30:13 +02:00
parent bafe0fb295
commit 9696250e53

View file

@ -3338,12 +3338,21 @@ Nil values returned from FUN do not appear in the results."
(unless (listp no-recursion) (setq no-recursion (list no-recursion))) (unless (listp no-recursion) (setq no-recursion (list no-recursion)))
;; Recursion depth is determined by --CATEGORY. ;; Recursion depth is determined by --CATEGORY.
(let* ((--category (let* ((--category
(cond (catch 'found
((every (lambda (el) (memq el org-element-greater-elements)) types) (let ((category 'greater-elements))
'greater-elements) (mapc (lambda (type)
((every (lambda (el) (memq el org-element-all-elements)) types) (cond ((memq type org-element-all-objects)
'elements) ;; If one object is found, the function
(t 'objects))) ;; has to recurse into every object.
(throw 'found 'objects))
((not (memq type org-element-greater-elements))
;; If one regular element is found, the
;; function has to recurse, at lest, into
;; every element it encounters.
(and (not (eq category 'elements))
(setq category 'elements)))))
types)
category)))
--acc --acc
--walk-tree --walk-tree
(--walk-tree (--walk-tree