summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-05-18 11:40:39 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-05-18 11:42:16 +0200
commit507b3c937b3b06c279dad46efd76af23eb3fbb0c (patch)
treed05e42810833211638389c7f2142f4bb47ce1f31
parent51472b4d33f82e7661716380bb40ed1932c8d8b4 (diff)
downloadorg-mode-507b3c937b3b06c279dad46efd76af23eb3fbb0c.tar.gz
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'.
-rw-r--r--contrib/lisp/org-export.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el
index 8a104d2..45c6b1f 100644
--- a/contrib/lisp/org-export.el
+++ b/contrib/lisp/org-export.el
@@ -2228,6 +2228,8 @@ Return the updated communication channel."
;; why file inclusion should be done before any structure can be
;; 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
(backend &optional subtreep visible-only body-only ext-plist noexpand)
"Transcode current Org buffer into BACKEND code.
@@ -2288,7 +2290,11 @@ Return code as a string."
(let ((org-current-export-file buf))
(org-export-blocks-preprocess)))
(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)))))
;; 3. Call parse-tree filters to get the final tree.
(setq tree