From 457c27d05b6e120025395b94509bc0b4d4546b91 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 15 Dec 2012 20:22:46 +0100 Subject: [PATCH] org-e-confluence: Add asynchronous export support * contrib/lisp/org-e-confluence.el (org-e-confluence-export-as-confluence): Add asynchronous export support. --- contrib/lisp/org-e-confluence.el | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/contrib/lisp/org-e-confluence.el b/contrib/lisp/org-e-confluence.el index 5806697ad..f3d46d33c 100644 --- a/contrib/lisp/org-e-confluence.el +++ b/contrib/lisp/org-e-confluence.el @@ -140,7 +140,7 @@ ;; main interactive entrypoint (defun org-e-confluence-export-as-confluence - (&optional subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to a text buffer. If narrowing is active in the current buffer, only export its @@ -148,6 +148,10 @@ narrowed part. If a region is active, export that region. +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + When optional argument SUBTREEP is non-nil, export the sub-tree at point, extracting information from the headline properties first. @@ -166,11 +170,22 @@ Export is done in a buffer named \"*Org E-Confluence Export*\", which will be displayed when `org-export-show-temporary-export-buffer' is non-nil." (interactive) - (let ((outbuf (org-export-to-buffer - 'e-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)))) + (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) 'e-confluence))) + `(org-export-as 'e-confluence ,subtreep ,visible-only ,body-only + ',ext-plist)) + (let ((outbuf (org-export-to-buffer + 'e-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))))) (provide 'org-e-confluence)