From 8b959237fca518fbd6dc7cd36a67093e1ec1f00b Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 18 Jun 2014 23:30:54 +0200 Subject: [PATCH] ox: Small refactoring * lisp/ox.el (org-export-get-category): Refactor code. --- lisp/ox.el | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 4bfef5227..4a538aed5 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -3875,19 +3875,7 @@ INFO is a plist used as a communication channel. CATEGORY is automatically inherited from a parent headline, from #+CATEGORY: keyword or created out of original file name. If all fail, the fall-back value is \"???\"." - (or (let ((headline (if (eq (org-element-type blob) 'headline) blob - (org-export-get-parent-headline blob)))) - ;; Almost like `org-export-node-property', but we cannot trust - ;; `plist-member' as every headline has a `:CATEGORY' - ;; property, would it be nil or equal to "???" (which has the - ;; same meaning). - (let ((parent headline) value) - (catch 'found - (while parent - (let ((category (org-element-property :CATEGORY parent))) - (and category (not (equal "???" category)) - (throw 'found category))) - (setq parent (org-element-property :parent parent)))))) + (or (org-export-get-node-property :CATEGORY blob t) (org-element-map (plist-get info :parse-tree) 'keyword (lambda (kwd) (when (equal (org-element-property :key kwd) "CATEGORY")