org-e-confluence: Add asynchronous export support

* contrib/lisp/org-e-confluence.el (org-e-confluence-export-as-confluence):
  Add asynchronous export support.
This commit is contained in:
Nicolas Goaziou 2012-12-15 20:22:46 +01:00
parent fa0e8feea8
commit 457c27d05b
1 changed files with 22 additions and 7 deletions

View File

@ -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)