summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-10-07 14:47:51 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2013-10-07 14:58:20 (GMT)
commit58b157956c732c2909ca9dc6574b6718ad5c4735 (patch)
tree7d0c20f69b4e4159135efe4dfe35d84588e4372e
parent35e5e5b8b06cfab35ee59253bfb234b7e53f3e4a (diff)
downloadorg-mode-58b157956c732c2909ca9dc6574b6718ad5c4735.zip
org-mode-58b157956c732c2909ca9dc6574b6718ad5c4735.tar.gz
ox: Fix `org-export-with-backend'
* lisp/ox.el (org-export-with-backend): Ensure function will use provided back-end. * testing/lisp/test-ox.el: Add test.
-rw-r--r--lisp/ox.el14
-rw-r--r--testing/lisp/test-ox.el13
2 files changed, 22 insertions, 5 deletions
diff --git a/lisp/ox.el b/lisp/ox.el
index 07239a0..26bcb19 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3450,10 +3450,16 @@ the communication channel used for export, as a plist."
(org-export-barf-if-invalid-backend backend)
(let ((type (org-element-type data)))
(if (memq type '(nil org-data)) (error "No foreign transcoder available")
- (let ((transcoder
- (cdr (assq type (org-export-get-all-transcoders backend)))))
- (if (functionp transcoder) (funcall transcoder data contents info)
- (error "No foreign transcoder available"))))))
+ (let* ((all-transcoders (org-export-get-all-transcoders backend))
+ (transcoder (cdr (assq type all-transcoders))))
+ (if (not (functionp transcoder))
+ (error "No foreign transcoder available")
+ (funcall
+ transcoder data contents
+ (org-combine-plists
+ info (list :back-end backend
+ :translate-alist all-transcoders
+ :exported-data (make-hash-table :test 'eq :size 401)))))))))
;;;; For Export Snippets
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index b5a4d3a..d532eb5 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -1082,7 +1082,18 @@ body\n")))
'((plain-text . (lambda (text contents info) "Failure"))))
(org-export-define-backend 'test2
'((plain-text . (lambda (text contents info) "Success"))))
- (org-export-with-backend 'test2 "Test")))))
+ (org-export-with-backend 'test2 "Test"))))
+ ;; Provide correct back-end if transcoder needs to use recursive
+ ;; calls anyway.
+ (should
+ (equal "Success"
+ (let (org-export--registered-backends)
+ (org-export-define-backend 'test
+ '((plain-text . (lambda (bold contents info) "Success"))
+ (headline . (lambda (headline contents info)
+ (org-export-data
+ (org-element-property :title headline))))))
+ (org-export-with-backend 'test "* Test")))))
(ert-deftest test-org-export/data-with-backend ()
"Test `org-export-data-with-backend' specifications."