mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 18:36:26 +00:00
ox: Small refactoring
* lisp/ox.el (org-export-get-category): Refactor code.
This commit is contained in:
parent
ab145f0df5
commit
8b959237fc
14
lisp/ox.el
14
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")
|
||||
|
|
Loading…
Reference in a new issue