org-export: Fill `org-export-current-backend' before pre-parsing hook
* contrib/lisp/org-export.el (org-export-as): Store current back-end in `org-export-current-backend' before running `org-export-before-parsing-hook'.
This commit is contained in:
parent
51472b4d33
commit
507b3c937b
|
@ -2228,6 +2228,8 @@ Return the updated communication channel."
|
||||||
;; why file inclusion should be done before any structure can be
|
;; why file inclusion should be done before any structure can be
|
||||||
;; associated to the file, that is before parsing.
|
;; associated to the file, that is before parsing.
|
||||||
|
|
||||||
|
(defvar org-current-export-file) ; Dynamically scoped
|
||||||
|
(defvar org-export-current-backend) ; Dynamically scoped
|
||||||
(defun org-export-as
|
(defun org-export-as
|
||||||
(backend &optional subtreep visible-only body-only ext-plist noexpand)
|
(backend &optional subtreep visible-only body-only ext-plist noexpand)
|
||||||
"Transcode current Org buffer into BACKEND code.
|
"Transcode current Org buffer into BACKEND code.
|
||||||
|
@ -2288,7 +2290,11 @@ Return code as a string."
|
||||||
(let ((org-current-export-file buf))
|
(let ((org-current-export-file buf))
|
||||||
(org-export-blocks-preprocess)))
|
(org-export-blocks-preprocess)))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(run-hooks 'org-export-before-parsing-hook)
|
;; Run hook with `org-export-current-backend' set
|
||||||
|
;; to BACKEND.
|
||||||
|
(let ((org-export-current-backend backend))
|
||||||
|
(run-hooks 'org-export-before-parsing-hook))
|
||||||
|
;; Eventually parse buffer.
|
||||||
(org-element-parse-buffer nil visible-only)))))
|
(org-element-parse-buffer nil visible-only)))))
|
||||||
;; 3. Call parse-tree filters to get the final tree.
|
;; 3. Call parse-tree filters to get the final tree.
|
||||||
(setq tree
|
(setq tree
|
||||||
|
|
Loading…
Reference in New Issue