Browse Source

Export back-ends: Apply changes to export functions

* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
  org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
  org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
  org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
  org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
  org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
  org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
  org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
  org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
  org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
  org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
Nicolas Goaziou 11 years ago
parent
commit
9154c70a04

+ 3 - 18
contrib/lisp/ox-confluence.el

@@ -166,26 +166,11 @@ EXT-PLIST, when provided, is a property list with external
 parameters overriding Org default settings, but still inferior to
 file-local settings.
 
-Export is done in a buffer named \"*Org E-Confluence Export*\", which
+Export is done in a buffer named \"*Org CONFLUENCE Export*\", which
 will be displayed when `org-export-show-temporary-export-buffer'
 is non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-	  (lambda (output)
-	    (with-current-buffer (get-buffer-create "*Org E-Confluence Export*")
-	      (erase-buffer)
-	      (insert output)
-	      (goto-char (point-min))
-	      (text-mode)
-	      (org-export-add-to-stack (current-buffer) 'confluence)))
-	`(org-export-as 'confluence ,subtreep ,visible-only ,body-only
-			',ext-plist))
-    (let ((outbuf (org-export-to-buffer
-		   'confluence "*Org E-Confluence Export*"
-		   subtreep visible-only body-only ext-plist)))
-      (with-current-buffer outbuf (text-mode))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'confluence "*org CONFLUENCE Export*"
+    async subtreep visible-only body-only external (lambda () (text-mode))))
 
 (provide 'ox-confluence)

+ 5 - 28
contrib/lisp/ox-deck.el

@@ -524,23 +524,8 @@ Export is done in a buffer named \"*Org deck.js Export*\", which
 will be displayed when `org-export-show-temporary-export-buffer'
 is non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-          (lambda (output)
-            (with-current-buffer (get-buffer-create "*Org deck.js Export*")
-              (erase-buffer)
-              (insert output)
-              (goto-char (point-min))
-              (nxml-mode)
-              (org-export-add-to-stack (current-buffer) 'deck)))
-        `(org-export-as 'deck ,subtreep ,visible-only ,body-only ',ext-plist))
-    (let ((outbuf (org-export-to-buffer
-                   'deck "*Org deck.js Export*"
-                   subtreep visible-only body-only ext-plist)))
-      ;; Set major mode.
-      (with-current-buffer outbuf (nxml-mode))
-      (when org-export-show-temporary-export-buffer
-        (switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'deck "*Org deck.js Export*"
+    async subtreep visible-only body-only ext-plist (lambda () (nxml-mode))))
 
 (defun org-deck-export-to-html
   (&optional async subtreep visible-only body-only ext-plist)
@@ -573,17 +558,9 @@ Return output file's name."
   (interactive)
   (let* ((extension (concat "." org-html-extension))
          (file (org-export-output-file-name extension subtreep))
-         (org-export-coding-system org-html-coding-system))
-    (if async
-        (org-export-async-start
-            (lambda (f) (org-export-add-to-stack f 'deck))
-          (let ((org-export-coding-system org-html-coding-system))
-            `(expand-file-name
-              (org-export-to-file
-               'deck ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
-      (let ((org-export-coding-system org-html-coding-system))
-        (org-export-to-file
-         'deck file subtreep visible-only body-only ext-plist)))))
+	 (org-export-coding-system org-html-coding-system))
+    (org-export-to-file 'deck file
+      async subtreep visible-only body-only ext-plist)))
 
 (defun org-deck-publish-to-html (plist filename pub-dir)
   "Publish an org file to deck.js HTML Presentation.

+ 4 - 11
contrib/lisp/ox-freemind.el

@@ -518,17 +518,10 @@ file-local settings.
 Return output file's name."
   (interactive)
   (let* ((extension (concat ".mm" ))
-	 (file (org-export-output-file-name extension subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'freemind))
-	  (let ((org-export-coding-system 'utf-8))
-	    `(expand-file-name
-	      (org-export-to-file
-	       'freemind ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
-      (let ((org-export-coding-system 'utf-8))
-	(org-export-to-file
-	 'freemind file subtreep visible-only body-only ext-plist)))))
+	 (file (org-export-output-file-name extension subtreep))
+	 (org-export-coding-system 'utf-8))
+    (org-export-to-file 'freemind ,file
+      async subtreep visible-only body-only ext-plist)))
 
 (provide 'ox-freemind)
 

+ 9 - 26
contrib/lisp/ox-groff.el

@@ -1855,20 +1855,11 @@ file-local settings.
 
 Return output file's name."
   (interactive)
-  (let ((outfile (org-export-output-file-name ".groff" subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'groff))
-	  (let ((org-groff-registered-references nil)
-		(org-groff-special-content nil))
-	    `(expand-file-name
-	      (org-export-to-file
-	       'groff ,outfile ,subtreep ,visible-only ,body-only
-	       ',ext-plist))))
-      (let ((org-groff-registered-references nil)
-	    (org-groff-special-content nil))
-	(org-export-to-file
-	 'groff outfile subtreep visible-only body-only ext-plist)))))
+  (let ((outfile (org-export-output-file-name ".groff" subtreep))
+	(org-groff-registered-references nil)
+	(org-groff-special-content nil))
+    (org-export-to-file 'groff outfile
+      async subtreep visible-only body-only ext-plist)))
 
 (defun org-groff-export-to-pdf
   (&optional async subtreep visible-only body-only ext-plist)
@@ -1896,18 +1887,10 @@ file-local settings.
 
 Return PDF file's name."
   (interactive)
-  (if async
-      (let ((outfile (org-export-output-file-name ".groff" subtreep)))
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'groff))
-	  `(expand-file-name
-	    (org-groff-compile
-	     (org-export-to-file
-	      'groff ,outfile ,subtreep ,visible-only ,body-only
-	      ',ext-plist)))))
-    (org-groff-compile
-     (org-groff-export-to-groff
-      nil subtreep visible-only body-only ext-plist))))
+  (let ((outfile (org-export-output-file-name ".groff" subtreep)))
+    (org-export-to-file 'groff outfile
+      async subtreep visible-only body-only ext-plist
+      (lambda (file) (org-groff-compile file)))))
 
 (defun org-groff-compile (file)
   "Compile a Groff file.

+ 11 - 39
contrib/lisp/ox-koma-letter.el

@@ -635,23 +635,9 @@ will be displayed if `org-export-show-temporary-export-buffer' is
 non-nil."
   (interactive)
   (let (org-koma-letter-special-contents)
-  (if async
-      (org-export-async-start
-	  (lambda (output)
-	    (with-current-buffer (get-buffer-create "*Org KOMA-LETTER Export*")
-	      (erase-buffer)
-	      (insert output)
-	      (goto-char (point-min))
-	      (LaTeX-mode)
-	      (org-export-add-to-stack (current-buffer) 'koma-letter)))
-	`(org-export-as 'koma-letter ,subtreep ,visible-only ,body-only
-			',ext-plist))
-    (let ((outbuf (org-export-to-buffer
-		   'koma-letter "*Org KOMA-LETTER Export*"
-		   subtreep visible-only body-only ext-plist)))
-      (with-current-buffer outbuf (LaTeX-mode))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf))))))
+    (org-export-to-buffer 'koma-letter "*Org KOMA-LETTER Export*"
+      async subtreep visible-only body-only ext-plist
+      (lambda () (LaTeX-mode)))))
 
 ;;;###autoload
 (defun org-koma-letter-export-to-latex
@@ -687,16 +673,9 @@ directory.
 Return output file's name."
   (interactive)
   (let ((outfile (org-export-output-file-name ".tex" subtreep))
-	org-koma-letter-special-contents)
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'koma-letter))
-	  `(expand-file-name
-	    (org-export-to-file
-	     'koma-letter ,outfile ,subtreep ,visible-only ,body-only
-	     ',ext-plist)))
-      (org-export-to-file
-       'koma-letter outfile subtreep visible-only body-only ext-plist))))
+	(org-koma-letter-special-contents))
+    (org-export-to-file 'koma-letter outfile
+      async subtreep visible-only body-only ext-plist)))
 
 ;;;###autoload
 (defun org-koma-letter-export-to-pdf
@@ -728,18 +707,11 @@ file-local settings.
 
 Return PDF file's name."
   (interactive)
-  (if async
-      (let ((outfile (org-export-output-file-name ".tex" subtreep)))
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'koma-letter))
-	  `(expand-file-name
-	    (org-latex-compile
-	     (org-export-to-file
-	      'koma-letter ,outfile ,subtreep ,visible-only ,body-only
-	      ',ext-plist)))))
-    (org-latex-compile
-     (org-koma-letter-export-to-latex
-      nil subtreep visible-only body-only ext-plist))))
+  (let ((file (org-export-output-file-name ".tex" subtreep))
+	(org-koma-letter-special-contents))
+    (org-export-to-file 'koma-letter file
+      async subtreep visible-only body-only ext-plist
+      (lambda (file) (org-latex-compile file)))))
 
 
 (provide 'ox-koma-letter)

+ 3 - 21
contrib/lisp/ox-rss.el

@@ -160,21 +160,8 @@ non-nil."
   (let ((file (buffer-file-name (buffer-base-buffer))))
     (org-icalendar-create-uid file 'warn-user)
     (org-rss-add-pubdate-property))
-  (if async
-      (org-export-async-start
-	  (lambda (output)
-	    (with-current-buffer (get-buffer-create "*Org RSS Export*")
-	      (erase-buffer)
-	      (insert output)
-	      (goto-char (point-min))
-	      (text-mode)
-	      (org-export-add-to-stack (current-buffer) 'rss)))
-	`(org-export-as 'rss ,subtreep ,visible-only))
-    (let ((outbuf (org-export-to-buffer
-		   'rss "*Org RSS Export*" subtreep visible-only)))
-      (with-current-buffer outbuf (text-mode))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'rss "*Org RSS Export*"
+    async subtreep visible-only nil nil (lambda () (text-mode))))
 
 ;;;###autoload
 (defun org-rss-export-to-rss (&optional async subtreep visible-only)
@@ -203,12 +190,7 @@ Return output file's name."
     (org-rss-add-pubdate-property))
   (let ((outfile (org-export-output-file-name
 		  (concat "." org-rss-extension) subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'rss))
-	  `(expand-file-name
-	    (org-export-to-file 'rss ,outfile ,subtreep ,visible-only)))
-      (org-export-to-file 'rss outfile subtreep visible-only))))
+    (org-export-to-file 'rss outfile async subtreep visible-only)))
 
 ;;;###autoload
 (defun org-rss-publish-to-rss (plist filename pub-dir)

+ 4 - 27
contrib/lisp/ox-s5.el

@@ -369,23 +369,8 @@ Export is done in a buffer named \"*Org S5 Export*\", which
 will be displayed when `org-export-show-temporary-export-buffer'
 is non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-          (lambda (output)
-            (with-current-buffer (get-buffer-create "*Org S5 Export*")
-              (erase-buffer)
-              (insert output)
-              (goto-char (point-min))
-              (nxml-mode)
-              (org-export-add-to-stack (current-buffer) 's5)))
-        `(org-export-as 's5 ,subtreep ,visible-only ,body-only ',ext-plist))
-    (let ((outbuf (org-export-to-buffer
-                   's5 "*Org S5 Export*"
-                   subtreep visible-only body-only ext-plist)))
-      ;; Set major mode.
-      (with-current-buffer outbuf (nxml-mode))
-      (when org-export-show-temporary-export-buffer
-        (switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 's5 "*Org S5 Export*"
+    async subtreep visible-only body-only ext-plist (lambda () (nxml-mode))))
 
 (defun org-s5-export-to-html
   (&optional async subtreep visible-only body-only ext-plist)
@@ -419,16 +404,8 @@ Return output file's name."
   (let* ((extension (concat "." org-html-extension))
          (file (org-export-output-file-name extension subtreep))
          (org-export-coding-system org-html-coding-system))
-    (if async
-        (org-export-async-start
-            (lambda (f) (org-export-add-to-stack f 's5))
-          (let ((org-export-coding-system org-html-coding-system))
-            `(expand-file-name
-              (org-export-to-file
-               's5 ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
-      (let ((org-export-coding-system org-html-coding-system))
-        (org-export-to-file
-         's5 file subtreep visible-only body-only ext-plist)))))
+    (org-export-to-file 's5 file
+      async subtreep visible-only body-only ext-plist)))
 
 (defun org-s5-publish-to-html (plist filename pub-dir)
   "Publish an org file to S5 HTML Presentation.

+ 4 - 10
contrib/lisp/ox-taskjuggler.el

@@ -894,16 +894,10 @@ Return output file's name."
   (interactive)
   (let ((outfile
          (org-export-output-file-name org-taskjuggler-extension subtreep)))
-    (if async
-        (org-export-async-start
-            (lambda (f)
-              (org-export-add-to-stack f 'taskjuggler)
-              (run-hook-with-args 'org-taskjuggler-final-hook f))
-          `(expand-file-name
-            (org-export-to-file 'taskjuggler ,outfile ,subtreep ,visible-only)))
-      (org-export-to-file 'taskjuggler outfile subtreep visible-only)
-      (run-hook-with-args 'org-taskjuggler-final-hook outfile)
-      outfile)))
+    (org-export-to-file 'taskjuggler outfile
+      async subtreep visible-only nil nil
+      (lambda (file)
+	(run-hook-with-args 'org-taskjuggler-final-hook file) nil))))
 
 ;;;###autoload
 (defun org-taskjuggler-export-and-process (&optional subtreep visible-only)

+ 1 - 1
lisp/ob-haskell.el

@@ -149,7 +149,7 @@ specifying a variable of the same value."
 (defvar org-src-preserve-indentation)
 (declare-function org-export-to-file "ox"
 		  (backend file
-			   &optional subtreep visible-only body-only ext-plist))
+			   &optional async subtreep visible-only body-only ext-plist))
 (defun org-babel-haskell-export-to-lhs (&optional arg)
   "Export to a .lhs file with all haskell code blocks escaped.
 When called with a prefix argument the resulting

+ 5 - 26
lisp/ox-ascii.el

@@ -1901,23 +1901,8 @@ Export is done in a buffer named \"*Org ASCII Export*\", which
 will be displayed when `org-export-show-temporary-export-buffer'
 is non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-       (lambda (output)
-	 (with-current-buffer (get-buffer-create "*Org ASCII Export*")
-	   (erase-buffer)
-	   (insert output)
-	   (goto-char (point-min))
-	   (text-mode)
-	   (org-export-add-to-stack (current-buffer) 'ascii)))
-       `(org-export-as 'ascii ,subtreep ,visible-only ,body-only
-		       ',ext-plist))
-    (let ((outbuf (org-export-to-buffer
-		   'ascii "*Org ASCII Export*"
-		   subtreep visible-only body-only ext-plist)))
-      (with-current-buffer outbuf (text-mode))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'ascii "*Org ASCII Export*"
+    async subtreep visible-only body-only ext-plist (lambda () (text-mode))))
 
 ;;;###autoload
 (defun org-ascii-export-to-ascii
@@ -1949,15 +1934,9 @@ file-local settings.
 
 Return output file's name."
   (interactive)
-  (let ((outfile (org-export-output-file-name ".txt" subtreep)))
-    (if async
-	(org-export-async-start
-	 (lambda (f) (org-export-add-to-stack f 'ascii))
-	 `(expand-file-name
-	   (org-export-to-file
-	    'ascii ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
-      (org-export-to-file
-       'ascii outfile subtreep visible-only body-only ext-plist))))
+  (let ((file (org-export-output-file-name ".txt" subtreep)))
+    (org-export-to-file 'ascii file
+      async subtreep visible-only body-only ext-plist)))
 
 ;;;###autoload
 (defun org-ascii-publish-to-ascii (plist filename pub-dir)

+ 9 - 39
lisp/ox-beamer.el

@@ -1063,23 +1063,8 @@ Export is done in a buffer named \"*Org BEAMER Export*\", which
 will be displayed when `org-export-show-temporary-export-buffer'
 is non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-	  (lambda (output)
-	    (with-current-buffer (get-buffer-create "*Org BEAMER Export*")
-	      (erase-buffer)
-	      (insert output)
-	      (goto-char (point-min))
-	      (LaTeX-mode)
-	      (org-export-add-to-stack (current-buffer) 'beamer)))
-	`(org-export-as 'beamer ,subtreep ,visible-only ,body-only
-			',ext-plist))
-    (let ((outbuf (org-export-to-buffer
-		   'beamer "*Org BEAMER Export*"
-		   subtreep visible-only body-only ext-plist)))
-      (with-current-buffer outbuf (LaTeX-mode))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'beamer "*Org BEAMER Export*"
+    async subtreep visible-only body-only ext-plist (lambda () (LaTeX-mode))))
 
 ;;;###autoload
 (defun org-beamer-export-to-latex
@@ -1111,16 +1096,9 @@ file-local settings.
 
 Return output file's name."
   (interactive)
-  (let ((outfile (org-export-output-file-name ".tex" subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'beamer))
-	  `(expand-file-name
-	    (org-export-to-file
-	     'beamer ,outfile ,subtreep ,visible-only ,body-only
-	     ',ext-plist)))
-      (org-export-to-file
-       'beamer outfile subtreep visible-only body-only ext-plist))))
+  (let ((file (org-export-output-file-name ".tex" subtreep)))
+    (org-export-to-file 'beamer file
+      async subtreep visible-only body-only ext-plist)))
 
 ;;;###autoload
 (defun org-beamer-export-to-pdf
@@ -1152,18 +1130,10 @@ file-local settings.
 
 Return PDF file's name."
   (interactive)
-  (if async
-      (let ((outfile (org-export-output-file-name ".tex" subtreep)))
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'beamer))
-	  `(expand-file-name
-	    (org-latex-compile
-	     (org-export-to-file
-	      'beamer ,outfile ,subtreep ,visible-only ,body-only
-	      ',ext-plist)))))
-    (org-latex-compile
-     (org-beamer-export-to-latex
-      nil subtreep visible-only body-only ext-plist))))
+  (let ((file (org-export-output-file-name ".tex" subtreep)))
+    (org-export-to-file 'beamer file
+      async subtreep visible-only body-only ext-plist
+      (lambda (file) (org-latex-compile file)))))
 
 ;;;###autoload
 (defun org-beamer-select-environment ()

+ 5 - 27
lisp/ox-html.el

@@ -3336,23 +3336,9 @@ Export is done in a buffer named \"*Org HTML Export*\", which
 will be displayed when `org-export-show-temporary-export-buffer'
 is non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-	  (lambda (output)
-	    (with-current-buffer (get-buffer-create "*Org HTML Export*")
-	      (erase-buffer)
-	      (insert output)
-	      (goto-char (point-min))
-	      (set-auto-mode t)
-	      (org-export-add-to-stack (current-buffer) 'html)))
-	`(org-export-as 'html ,subtreep ,visible-only ,body-only ',ext-plist))
-    (let ((outbuf (org-export-to-buffer
-		   'html "*Org HTML Export*"
-		   subtreep visible-only body-only ext-plist)))
-      ;; Set major mode.
-      (with-current-buffer outbuf (set-auto-mode t))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'html "*Org HTML Export*"
+    async subtreep visible-only body-only ext-plist
+    (lambda () (set-auto-mode t))))
 
 ;;;###autoload
 (defun org-html-convert-region-to-html ()
@@ -3396,16 +3382,8 @@ Return output file's name."
   (let* ((extension (concat "." org-html-extension))
 	 (file (org-export-output-file-name extension subtreep))
 	 (org-export-coding-system org-html-coding-system))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'html))
-	  (let ((org-export-coding-system org-html-coding-system))
-	    `(expand-file-name
-	      (org-export-to-file
-	       'html ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
-      (let ((org-export-coding-system org-html-coding-system))
-	(org-export-to-file
-	 'html file subtreep visible-only body-only ext-plist)))))
+    (org-export-to-file 'html file
+      async subtreep visible-only body-only ext-plist)))
 
 ;;;###autoload
 (defun org-html-publish-to-html (plist filename pub-dir)

+ 4 - 15
lisp/ox-icalendar.el

@@ -826,21 +826,10 @@ Return ICS file name."
   ;; Export part.  Since this back-end is backed up by `ascii', ensure
   ;; links will not be collected at the end of sections.
   (let ((outfile (org-export-output-file-name ".ics" subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f)
-	      (org-export-add-to-stack f 'icalendar)
-	      (run-hook-with-args 'org-icalendar-after-save-hook f))
-	  `(let ((org-ascii-links-to-notes nil))
-	     (expand-file-name
-	      (org-export-to-file
-	       'icalendar ,outfile ,subtreep ,visible-only ,body-only
-	       '(:ascii-charset utf-8)))))
-      (let ((org-ascii-links-to-notes nil))
-	(org-export-to-file 'icalendar outfile subtreep visible-only body-only
-			    '(:ascii-charset utf-8)))
-      (run-hook-with-args 'org-icalendar-after-save-hook outfile)
-      outfile)))
+    (org-export-to-file 'icalendar outfile
+      async subtreep visible-only body-only '(:ascii-charset utf-8)
+      (lambda (file)
+	(run-hook-with-args 'org-icalendar-after-save-hook file) nil))))
 
 ;;;###autoload
 (defun org-icalendar-export-agenda-files (&optional async)

+ 9 - 40
lisp/ox-latex.el

@@ -2719,23 +2719,8 @@ Export is done in a buffer named \"*Org LATEX Export*\", which
 will be displayed when `org-export-show-temporary-export-buffer'
 is non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-	  (lambda (output)
-	    (with-current-buffer (get-buffer-create "*Org LATEX Export*")
-	      (erase-buffer)
-	      (insert output)
-	      (goto-char (point-min))
-	      (LaTeX-mode)
-	      (org-export-add-to-stack (current-buffer) 'latex)))
-	`(org-export-as 'latex ,subtreep ,visible-only ,body-only
-			',ext-plist))
-    (let ((outbuf
-	   (org-export-to-buffer 'latex "*Org LATEX Export*"
-				 subtreep visible-only body-only ext-plist)))
-      (with-current-buffer outbuf (LaTeX-mode))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'latex "*Org LATEX Export*"
+    async subtreep visible-only body-only ext-plist (lambda () (LaTeX-mode))))
 
 ;;;###autoload
 (defun org-latex-convert-region-to-latex ()
@@ -2772,19 +2757,11 @@ between \"\\begin{document}\" and \"\\end{document}\".
 
 EXT-PLIST, when provided, is a property list with external
 parameters overriding Org default settings, but still inferior to
-file-local settings.
-
-Return output file's name."
+file-local settings."
   (interactive)
   (let ((outfile (org-export-output-file-name ".tex" subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'latex))
-	  `(expand-file-name
-	    (org-export-to-file
-	     'latex ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
-      (org-export-to-file
-       'latex outfile subtreep visible-only body-only ext-plist))))
+    (org-export-to-file 'latex outfile
+      async subtreep visible-only body-only ext-plist)))
 
 ;;;###autoload
 (defun org-latex-export-to-pdf
@@ -2816,18 +2793,10 @@ file-local settings.
 
 Return PDF file's name."
   (interactive)
-  (if async
-      (let ((outfile (org-export-output-file-name ".tex" subtreep)))
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'latex))
-	  `(expand-file-name
-	    (org-latex-compile
-	     (org-export-to-file
-	      'latex ,outfile ,subtreep ,visible-only ,body-only
-	      ',ext-plist)))))
-    (org-latex-compile
-     (org-latex-export-to-latex
-      nil subtreep visible-only body-only ext-plist))))
+  (let ((outfile (org-export-output-file-name ".tex" subtreep)))
+    (org-export-to-file 'latex outfile
+      async subtreep visible-only body-only ext-plist
+      (lambda (file) (org-latex-compile file)))))
 
 (defun org-latex-compile (texfile &optional snippet)
   "Compile a TeX file.

+ 6 - 19
lisp/ox-man.el

@@ -1144,14 +1144,8 @@ file-local settings.
 Return output file's name."
   (interactive)
   (let ((outfile (org-export-output-file-name ".man" subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'man))
-	  `(expand-file-name
-	    (org-export-to-file
-	     'man ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
-      (org-export-to-file
-       'man outfile subtreep visible-only body-only ext-plist))))
+    (org-export-to-file 'man outfile
+      async subtreep visible-only body-only ext-plist)))
 
 (defun org-man-export-to-pdf
   (&optional async subtreep visible-only body-only ext-plist)
@@ -1182,17 +1176,10 @@ file-local settings.
 
 Return PDF file's name."
   (interactive)
-  (if async
-      (let ((outfile (org-export-output-file-name ".man" subtreep)))
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'man))
-	  `(expand-file-name
-	    (org-man-compile
-	     (org-export-to-file
-	      'man ,outfile ,subtreep ,visible-only ,body-only
-	      ',ext-plist)))))
-    (org-man-compile
-     (org-man-export-to-man nil subtreep visible-only body-only ext-plist))))
+  (let ((outfile (org-export-output-file-name ".man" subtreep)))
+    (org-export-to-file 'man outfile
+      async subtreep visible-only body-only ext-plist
+      (lambda (file) (org-latex-compile file)))))
 
 (defun org-man-compile (file)
   "Compile a Groff file.

+ 3 - 21
lisp/ox-md.el

@@ -438,21 +438,8 @@ Export is done in a buffer named \"*Org MD Export*\", which will
 be displayed when `org-export-show-temporary-export-buffer' is
 non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-	  (lambda (output)
-	    (with-current-buffer (get-buffer-create "*Org MD Export*")
-	      (erase-buffer)
-	      (insert output)
-	      (goto-char (point-min))
-	      (text-mode)
-	      (org-export-add-to-stack (current-buffer) 'md)))
-	`(org-export-as 'md ,subtreep ,visible-only))
-    (let ((outbuf (org-export-to-buffer
-		   'md "*Org MD Export*" subtreep visible-only)))
-      (with-current-buffer outbuf (text-mode))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'md "*Org MD Export*"
+    async subtreep visible-only nil nil (lambda () (text-mode))))
 
 ;;;###autoload
 (defun org-md-convert-region-to-md ()
@@ -487,12 +474,7 @@ contents of hidden elements.
 Return output file's name."
   (interactive)
   (let ((outfile (org-export-output-file-name ".md" subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'md))
-	  `(expand-file-name
-	    (org-export-to-file 'md ,outfile ,subtreep ,visible-only)))
-      (org-export-to-file 'md outfile subtreep visible-only))))
+    (org-export-to-file 'md outfile async subtreep visible-only)))
 
 
 (provide 'ox-md)

+ 9 - 6
lisp/ox-odt.el

@@ -4255,9 +4255,12 @@ Return output file's name."
 			(require 'nxml-mode)
 			(let ((nxml-auto-insert-xml-declaration-flag nil))
 			  (find-file-noselect
-			   (concat org-odt-zip-dir "content.xml") t)))))
-		 (org-export-to-buffer
-		  'odt out-buf ,subtreep ,visible-only nil ',ext-plist))))))
+			   (concat org-odt-zip-dir "content.xml") t))))
+		     (output (org-export-as
+			      'odt ,subtreep ,visible-only nil ,ext-plist)))
+		 (with-current-buffer out-buf
+		   (erase-buffer)
+		   (insert output)))))))
       (org-odt--export-wrap
        outfile
        (let* ((org-odt-embedded-images-count 0)
@@ -4268,13 +4271,13 @@ Return output file's name."
 	      ;; styles.
 	      (hfy-user-sheet-assoc nil))
 	 ;; Initialize content.xml and kick-off the export process.
-	 (let ((out-buf (progn
+	 (let ((output (org-export-as 'odt subtreep visible-only nil ext-plist))
+	       (out-buf (progn
 			  (require 'nxml-mode)
 			  (let ((nxml-auto-insert-xml-declaration-flag nil))
 			    (find-file-noselect
 			     (concat org-odt-zip-dir "content.xml") t)))))
-	   (org-export-to-buffer
-	    'odt out-buf subtreep visible-only nil ext-plist)))))))
+	   (with-current-buffer out-buf (erase-buffer) (insert output))))))))
 
 
 ;;;; Convert between OpenDocument and other formats

+ 4 - 23
lisp/ox-org.el

@@ -172,22 +172,8 @@ Export is done in a buffer named \"*Org ORG Export*\", which will
 be displayed when `org-export-show-temporary-export-buffer' is
 non-nil."
   (interactive)
-  (if async
-      (org-export-async-start
-	  (lambda (output)
-	    (with-current-buffer (get-buffer-create "*Org ORG Export*")
-	      (erase-buffer)
-	      (insert output)
-	      (goto-char (point-min))
-	      (org-mode)
-	      (org-export-add-to-stack (current-buffer) 'org)))
-	`(org-export-as 'org ,subtreep ,visible-only nil ',ext-plist))
-    (let ((outbuf
-	   (org-export-to-buffer
-	    'org "*Org ORG Export*" subtreep visible-only nil ext-plist)))
-      (with-current-buffer outbuf (org-mode))
-      (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+  (org-export-to-buffer 'org "*Org ORG Export*"
+    async subtreep visible-only ext-plist (lambda () (org-mode))))
 
 ;;;###autoload
 (defun org-org-export-to-org (&optional async subtreep visible-only ext-plist)
@@ -216,13 +202,8 @@ file-local settings.
 Return output file name."
   (interactive)
   (let ((outfile (org-export-output-file-name ".org" subtreep)))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'org))
-	  `(expand-file-name
-	    (org-export-to-file
-	     'org ,outfile ,subtreep ,visible-only nil ',ext-plist)))
-      (org-export-to-file 'org outfile subtreep visible-only nil ext-plist))))
+    (org-export-to-file 'org outfile
+      async subtreep visible-only nil ext-plist)))
 
 ;;;###autoload
 (defun org-org-publish-to-org (plist filename pub-dir)

+ 13 - 13
lisp/ox-publish.el

@@ -572,19 +572,19 @@ Return output file name."
 	     (let ((output-file
 		    (org-export-output-file-name extension nil pub-dir))
 		   (body-p (plist-get plist :body-only)))
-	       (org-export-to-file
-		backend output-file nil nil body-p
-		;; Add `org-publish-collect-numbering' and
-		;; `org-publish-collect-index' to final output
-		;; filters.  The latter isn't dependent on
-		;; `:makeindex', since we want to keep it up-to-date
-		;; in cache anyway.
-		(org-combine-plists
-		 plist
-		 `(:filter-final-output
-		   ,(cons 'org-publish-collect-numbering
-			  (cons 'org-publish-collect-index
-				(plist-get plist :filter-final-output))))))))
+	       (org-export-to-file backend output-file
+		 nil nil nil body-p
+		 ;; Add `org-publish-collect-numbering' and
+		 ;; `org-publish-collect-index' to final output
+		 ;; filters.  The latter isn't dependent on
+		 ;; `:makeindex', since we want to keep it up-to-date
+		 ;; in cache anyway.
+		 (org-combine-plists
+		  plist
+		  `(:filter-final-output
+		    ,(cons 'org-publish-collect-numbering
+			   (cons 'org-publish-collect-index
+				 (plist-get plist :filter-final-output))))))))
       ;; Remove opened buffer in the process.
       (unless visitingp (kill-buffer work-buffer)))))
 

+ 8 - 27
lisp/ox-texinfo.el

@@ -1710,18 +1710,9 @@ file-local settings.
 Return output file's name."
   (interactive)
   (let ((outfile (org-export-output-file-name ".texi" subtreep))
-	(org-export-coding-system org-texinfo-coding-system))
-    (if async
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'texinfo))
-	  (let ((org-export-coding-system org-texinfo-coding-system))
-	    `(expand-file-name
-	      (org-export-to-file
-	       'texinfo ,outfile ,subtreep ,visible-only ,body-only
-	       ',ext-plist))))
-      (let ((org-export-coding-system org-texinfo-coding-system))
-	(org-export-to-file
-	 'texinfo outfile subtreep visible-only body-only ext-plist)))))
+	(org-export-coding-system ',org-texinfo-coding-system))
+    (org-export-to-file 'texinfo outfile
+      async subtreep visible-only body-only ext-plist)))
 
 (defun org-texinfo-export-to-info
   (&optional async subtreep visible-only body-only ext-plist)
@@ -1755,21 +1746,11 @@ directory.
 
 Return INFO file's name."
   (interactive)
-  (if async
-      (let ((outfile (org-export-output-file-name ".texi" subtreep))
-	    (org-export-coding-system org-texinfo-coding-system))
-	(org-export-async-start
-	    (lambda (f) (org-export-add-to-stack f 'texinfo))
-	  (let ((org-export-coding-system org-texinfo-coding-system))
-	    `(expand-file-name
-	      (org-texinfo-compile
-	       (org-export-to-file
-		'texinfo ,outfile ,subtreep ,visible-only ,body-only
-		',ext-plist))))))
-    (org-texinfo-compile
-     (let ((org-export-coding-system org-texinfo-coding-system))
-       (org-texinfo-export-to-texinfo
-	nil subtreep visible-only body-only ext-plist)))))
+  (let ((outfile (org-export-output-file-name ".texi" subtreep))
+	(org-export-coding-system ',org-texinfo-coding-system))
+    (org-export-to-file 'texinfo outfile
+      async subtreep visible-only body-only ext-plist
+      (lambda (file) (org-texinfo-compile file)))))
 
 ;;;###autoload
 (defun org-texinfo-publish-to-texinfo (plist filename pub-dir)

+ 1 - 1
testing/lisp/test-ob-exp.el

@@ -57,7 +57,7 @@ Current buffer is a copy of the original buffer."
   (require 'ox-html)
   (let ((name (generate-new-buffer-name "*Org HTML Export*")))
     (org-test-in-example-file nil
-      (org-export-to-buffer 'html name nil nil t))
+      (org-export-to-buffer 'html name nil nil nil t))
     ;; Should create a HTML buffer.
     (should (buffer-live-p (get-buffer name)))
     ;; Should contain the content of the buffer.