1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

export back-ends: Activate asynchronous export

* contrib/lisp/org-e-ascii.el (org-e-ascii-export-as-ascii,
  org-e-ascii-export-to-ascii): Activate asynchronous export.
* contrib/lisp/org-e-beamer.el (org-e-beamer-export-as-latex,
  org-e-beamer-export-to-latex): Activate asynchronous export.
* contrib/lisp/org-e-groff.el (org-e-groff-export-to-groff,
  org-e-groff-export-to-pdf): Activate asynchronous export.
* contrib/lisp/org-e-html.el (org-e-html-export-as-html,
  org-e-html-export-to-html): Activate asynchronous export.
* contrib/lisp/org-e-icalendar.el (org-e-icalendar-export-to-ics):
  Activate asynchronous export.
* contrib/lisp/org-e-latex.el (org-e-latex-export-as-latex,
  org-e-latex-export-to-latex, org-e-latex-export-to-pdf): Activate
  asynchronous export.
* contrib/lisp/org-e-man.el (org-e-man-export-to-man,
  org-e-man-export-to-pdf): Activate asynchronous export.
* contrib/lisp/org-e-odt.el (org-e-odt-export-to-odt): Activate
  asynchronous export.  Remove body-only argument.
* contrib/lisp/org-e-texinfo.el (org-e-texinfo-export-to-texinfo,
  org-e-texinfo-export-to-info): Activate asynchronous export.
* contrib/lisp/org-md.el (org-md-export-as-markdown,
  org-md-export-to-markdown): Activate asynchronous export.
This commit is contained in:
Nicolas Goaziou 2012-12-02 17:24:19 +01:00
parent 5319cec24e
commit 06872a4570
10 changed files with 456 additions and 146 deletions

View File

@ -104,23 +104,23 @@
:menu-entry
(?t "Export to Plain Text"
((?A "As ASCII buffer"
(lambda (s v b)
(org-e-ascii-export-as-ascii s v b '(:ascii-charset ascii))))
(lambda (a s v b)
(org-e-ascii-export-as-ascii a s v b '(:ascii-charset ascii))))
(?a "As ASCII file"
(lambda (s v b)
(org-e-ascii-export-to-ascii s v b '(:ascii-charset ascii))))
(lambda (a s v b)
(org-e-ascii-export-to-ascii a s v b '(:ascii-charset ascii))))
(?L "As Latin1 buffer"
(lambda (s v b)
(org-e-ascii-export-as-ascii s v b '(:ascii-charset latin1))))
(lambda (a s v b)
(org-e-ascii-export-as-ascii a s v b '(:ascii-charset latin1))))
(?l "As Latin1 file"
(lambda (s v b)
(org-e-ascii-export-to-ascii s v b '(:ascii-charset latin1))))
(lambda (a s v b)
(org-e-ascii-export-to-ascii a s v b '(:ascii-charset latin1))))
(?U "As UTF-8 buffer"
(lambda (s v b)
(org-e-ascii-export-as-ascii s v b '(:ascii-charset utf-8))))
(lambda (a s v b)
(org-e-ascii-export-as-ascii a s v b '(:ascii-charset utf-8))))
(?u "As UTF-8 file"
(lambda (s v b)
(org-e-ascii-export-to-ascii s v b '(:ascii-charset utf-8))))))
(lambda (a s v b)
(org-e-ascii-export-to-ascii a s v b '(:ascii-charset utf-8))))))
:filters-alist ((:filter-headline . org-e-ascii-filter-headline-blank-lines)
(:filter-parse-tree . org-e-ascii-filter-paragraph-spacing)
(:filter-section . org-e-ascii-filter-headline-blank-lines))
@ -1780,7 +1780,7 @@ This function only applies to `e-ascii' back-end. See
;;;###autoload
(defun org-e-ascii-export-as-ascii
(&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
@ -1788,6 +1788,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.
@ -1806,16 +1810,27 @@ Export is done in a buffer named \"*Org E-ASCII Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(let ((outbuf (org-export-to-buffer
'e-ascii "*Org E-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))))
(if async
(org-export-async-start
(lambda (output)
(with-current-buffer (get-buffer-create "*Org E-ASCII Export*")
(erase-buffer)
(insert output)
(goto-char (point-min))
(text-mode)
(org-export-add-to-stack (current-buffer) 'e-ascii)))
`(org-export-as 'e-ascii ,subtreep ,visible-only ,body-only
',ext-plist))
(let ((outbuf (org-export-to-buffer
'e-ascii "*Org E-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)))))
;;;###autoload
(defun org-e-ascii-export-to-ascii
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a text file.
If narrowing is active in the current buffer, only export its
@ -1823,6 +1838,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 file 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.
@ -1840,8 +1859,14 @@ file-local settings.
Return output file's name."
(interactive)
(let ((outfile (org-export-output-file-name ".txt" subtreep)))
(org-export-to-file
'e-ascii outfile subtreep visible-only body-only ext-plist)))
(if async
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-ascii))
`(expand-file-name
(org-export-to-file
'e-ascii ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
(org-export-to-file
'e-ascii outfile subtreep visible-only body-only ext-plist))))
;;;###autoload
(defun org-e-ascii-publish-to-ascii (plist filename pub-dir)

View File

@ -273,8 +273,9 @@ brackets. Return overlay specification, as a string, or nil."
(?b "As TEX file (Beamer)" org-e-beamer-export-to-latex)
(?P "As PDF file (Beamer)" org-e-beamer-export-to-pdf)
(?O "As PDF file and open (Beamer)"
(lambda (s v b)
(org-open-file (org-e-beamer-export-to-pdf s v b))))))
(lambda (a s v b)
(if a (org-e-beamer-export-to-pdf t s v b)
(org-open-file (org-e-beamer-export-to-pdf nil s v b)))))))
:options-alist
((:beamer-theme "BEAMER_THEME" nil org-e-beamer-theme)
(:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t)
@ -980,7 +981,7 @@ value."
;;;###autoload
(defun org-e-beamer-export-as-latex
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer as a Beamer buffer.
If narrowing is active in the current buffer, only export its
@ -988,6 +989,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.
@ -1006,16 +1011,28 @@ Export is done in a buffer named \"*Org E-BEAMER Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(let ((outbuf (org-export-to-buffer
'e-beamer "*Org E-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))))
(if async
(org-export-async-start
(lambda (output)
(with-current-buffer (get-buffer-create "*Org E-BEAMER Export*")
(erase-buffer)
(insert output)
(goto-char (point-min))
(LaTeX-mode)
(when org-export-show-temporary-export-buffer
(org-export-add-to-stack (current-buffer) 'e-beamer))))
`(org-export-as 'e-beamer ,subtreep ,visible-only ,body-only
',ext-plist))
(let ((outbuf (org-export-to-buffer
'e-beamer "*Org E-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)))))
;;;###autoload
(defun org-e-beamer-export-to-latex
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer as a Beamer presentation (tex).
If narrowing is active in the current buffer, only export its
@ -1023,6 +1040,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 file 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.
@ -1040,12 +1061,19 @@ file-local settings.
Return output file's name."
(interactive)
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-to-file
'e-beamer outfile subtreep visible-only body-only ext-plist)))
(if async
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-beamer))
`(expand-file-name
(org-export-to-file
'e-beamer ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))
(org-export-to-file
'e-beamer outfile subtreep visible-only body-only ext-plist))))
;;;###autoload
(defun org-e-beamer-export-to-pdf
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer as a Beamer presentation (PDF).
If narrowing is active in the current buffer, only export its
@ -1053,6 +1081,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 file 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.
@ -1069,8 +1101,18 @@ file-local settings.
Return PDF file's name."
(interactive)
(org-e-latex-compile
(org-e-beamer-export-to-latex subtreep visible-only body-only ext-plist)))
(if async
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-beamer))
`(expand-file-name
(org-e-latex-compile
(org-export-to-file
'e-beamer ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
(org-e-latex-compile
(org-e-beamer-export-to-latex
nil subtreep visible-only body-only ext-plist))))
;;;###autoload
(defun org-e-beamer-select-environment ()

View File

@ -100,7 +100,9 @@
((?g "As GROFF file" org-e-groff-export-to-groff)
(?p "As PDF file" org-e-groff-export-to-pdf)
(?o "As PDF file and open"
(lambda (s v b) (org-open-file (org-e-groff-export-to-pdf s v b))))))
(lambda (a s v b)
(if a (org-e-groff-export-to-pdf t s v b)
(org-open-file (org-e-groff-export-to-pdf nil s v b)))))))
:options-alist
((:groff-class "GROFF_CLASS" nil org-e-groff-default-class t)
(:groff-class-options "GROFF_CLASS_OPTIONS" nil nil t)
@ -1886,7 +1888,7 @@ contextual information."
;;; Interactive functions
(defun org-e-groff-export-to-groff
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a Groff file.
If narrowing is active in the current buffer, only export its
@ -1894,6 +1896,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 file 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.
@ -1907,14 +1913,23 @@ file-local settings.
Return output file's name."
(interactive)
(setq org-e-groff-registered-references nil)
(setq org-e-groff-special-content nil)
(let ((outfile (org-export-output-file-name ".groff" subtreep)))
(org-export-to-file
'e-groff outfile subtreep visible-only body-only ext-plist)))
(if async
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-groff))
(let ((org-e-groff-registered-references nil)
(org-e-groff-special-content nil))
`(expand-file-name
(org-export-to-file
'e-groff ,outfile ,subtreep ,visible-only ,body-only
',ext-plist))))
(let ((org-e-groff-registered-references nil)
(org-e-groff-special-content nil))
(org-export-to-file
'e-groff outfile subtreep visible-only body-only ext-plist)))))
(defun org-e-groff-export-to-pdf
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to Groff then process through to PDF.
If narrowing is active in the current buffer, only export its
@ -1922,6 +1937,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 file 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.
@ -1935,8 +1954,18 @@ file-local settings.
Return PDF file's name."
(interactive)
(org-e-groff-compile
(org-e-groff-export-to-groff subtreep visible-only body-only ext-plist)))
(if async
(let ((outfile (org-export-output-file-name ".groff" subtreep)))
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-groff))
`(expand-file-name
(org-e-groff-compile
(org-export-to-file
'e-groff ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
(org-e-groff-compile
(org-e-groff-export-to-groff
nil subtreep visible-only body-only ext-plist))))
(defun org-e-groff-compile (file)
"Compile a Groff file.

View File

@ -108,7 +108,9 @@
((?H "To temporary buffer" org-e-html-export-as-html)
(?h "To file" org-e-html-export-to-html)
(?o "To file and open"
(lambda (s v b) (org-open-file (org-e-html-export-to-html s v b))))))
(lambda (a s v b)
(if a (org-e-html-export-to-html t s v b)
(org-open-file (org-e-html-export-to-html nil s v b)))))))
:options-alist
;; FIXME: Prefix KEYWORD and OPTION with "HTML_". Prefix
;; corresponding properties with `:html-". If such a renaming is
@ -2746,7 +2748,7 @@ contextual information."
;;;###autoload
(defun org-e-html-export-as-html
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to an HTML buffer.
If narrowing is active in the current buffer, only export its
@ -2754,6 +2756,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.
@ -2772,18 +2778,28 @@ Export is done in a buffer named \"*Org E-HTML Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(let ((outbuf
(org-export-to-buffer
'e-html "*Org E-HTML 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))))
(if async
(org-export-async-start
(lambda (output)
(with-current-buffer (get-buffer-create "*Org E-HTML Export*")
(erase-buffer)
(insert output)
(goto-char (point-min))
(nxml-mode)
(when org-export-show-temporary-export-buffer
(org-export-add-to-stack (current-buffer) 'e-html))))
`(org-export-as 'e-html ,subtreep ,visible-only ,body-only ',ext-plist))
(let ((outbuf (org-export-to-buffer
'e-html "*Org E-HTML 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)))))
;;;###autoload
(defun org-e-html-export-to-html
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a HTML file.
If narrowing is active in the current buffer, only export its
@ -2791,6 +2807,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 file 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.
@ -2810,8 +2830,16 @@ Return output file's name."
(let* ((extension (concat "." org-e-html-extension))
(file (org-export-output-file-name extension subtreep))
(org-export-coding-system org-e-html-coding-system))
(org-export-to-file
'e-html file subtreep visible-only body-only ext-plist)))
(if async
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-latex))
(let ((org-export-coding-system org-e-html-coding-system))
`(expand-file-name
(org-export-to-file
'e-html ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
(let ((org-export-coding-system org-e-html-coding-system))
(org-export-to-file
'e-html file subtreep visible-only body-only ext-plist)))))
;;;###autoload
(defun org-e-html-publish-to-html (plist filename pub-dir)

View File

@ -274,12 +274,11 @@ re-read the iCalendar file.")
((:filter-headline . org-e-icalendar-clear-blank-lines))
:menu-entry
(?c "Export to iCalendar"
((?f "Current file"
(lambda (s v b) (org-e-icalendar-export-to-ics s v b)))
((?f "Current file" org-e-icalendar-export-to-ics)
(?a "All agenda files"
(lambda (s v b) (org-e-icalendar-export-agenda-files)))
(lambda (a s v b) (org-e-icalendar-export-agenda-files a)))
(?c "Combine all agenda files"
(lambda (s v b) (org-e-icalendar-combine-agenda-files))))))
(lambda (a s v b) (org-e-icalendar-combine-agenda-files a))))))
@ -789,7 +788,8 @@ CALSCALE:GREGORIAN\n"
;;; Interactive Functions
;;;###autoload
(defun org-e-icalendar-export-to-ics (&optional subtreep visible-only body-only)
(defun org-e-icalendar-export-to-ics
(&optional async subtreep visible-only body-only)
"Export current buffer to an iCalendar file.
If narrowing is active in the current buffer, only export its
@ -797,6 +797,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 file 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.
@ -814,35 +818,76 @@ Return ICS file name."
(org-e-icalendar-create-uid file 'warn-user)))
;; Export part. Since this back-end is backed up by `e-ascii',
;; ensure links will not be collected at the end of sections.
(let ((outfile (org-export-output-file-name ".ics" subtreep))
(org-e-ascii-links-to-notes nil))
(org-export-to-file 'e-icalendar outfile subtreep visible-only body-only
'(:ascii-charset utf-8))
(run-hook-with-args 'org-e-icalendar-after-save-hook outfile)
outfile))
(let ((outfile (org-export-output-file-name ".ics" subtreep)))
(if async
(org-export-async-start
(lambda (f)
(org-export-add-to-stack f 'e-icalendar)
(run-hook-with-args 'org-e-icalendar-after-save-hook f))
`(let ((org-e-ascii-links-to-notes nil))
(expand-file-name
(org-export-to-file
'e-icalendar ,outfile ,subtreep ,visible-only ,body-only
'(:ascii-charset utf-8)))))
(let ((org-e-ascii-links-to-notes nil))
(org-export-to-file 'e-icalendar outfile subtreep visible-only body-only
'(:ascii-charset utf-8)))
(run-hook-with-args 'org-e-icalendar-after-save-hook outfile)
outfile)))
;;;###autoload
(defun org-e-icalendar-export-agenda-files ()
"Export all agenda files to iCalendar files."
(defun org-e-icalendar-export-agenda-files (&optional async)
"Export all agenda files to iCalendar files.
When optional argument ASYNC is non-nil, export happens in an
external process."
(interactive)
(let ((files (org-agenda-files t)))
(org-agenda-prepare-buffers files)
(unwind-protect
(mapc (lambda (file)
(catch 'nextfile
(org-check-agenda-file file)
(with-current-buffer (org-get-agenda-file-buffer file)
(org-e-icalendar-export-to-ics))))
files)
(org-release-buffers org-agenda-new-buffers))))
(if async
;; Asynchronous export is not interactive, so we will not call
;; `org-check-agenda-file'. Instead we remove any non-existent
;; agenda file from the list.
(let ((files (org-remove-if-not 'file-exists-p (org-agenda-files t))))
(org-export-async-start
(lambda (results)
(mapc (lambda (f) (org-export-add-to-stack f 'icalendar))
results))
`(let (output-files)
(mapc (lambda (file)
(with-current-buffer (org-get-agenda-file-buffer file)
(push (expand-file-name (org-e-icalendar-export-to-ics))
output-files)))
',files)
output-files)))
(let ((files (org-agenda-files t)))
(org-agenda-prepare-buffers files)
(unwind-protect
(mapc (lambda (file)
(catch 'nextfile
(org-check-agenda-file file)
(with-current-buffer (org-get-agenda-file-buffer file)
(org-e-icalendar-export-to-ics))))
files)
(org-release-buffers org-agenda-new-buffers)))))
;;;###autoload
(defun org-e-icalendar-combine-agenda-files ()
(defun org-e-icalendar-combine-agenda-files (&optional async)
"Combine all agenda files into a single iCalendar file.
The file is stored under the name
A non-nil optional argument ASYNC means the process should happen
asynchronously. The resulting file should be accessible through
the `org-export-stack' interface.
The file is stored under the name chosen in
`org-e-icalendar-combined-agenda-file'."
(interactive)
(apply 'org-e-icalendar--combine-files nil (org-agenda-files t)))
(if async
(let ((files (org-remove-if-not 'file-exists-p (org-agenda-files t))))
(org-export-async-start
(lambda (dummy)
(org-export-add-to-stack
(expand-file-name org-e-icalendar-combined-agenda-file)
'e-icalendar))
`(apply 'org-e-icalendar--combine-files nil ',files)))
(apply 'org-e-icalendar--combine-files nil (org-agenda-files t))))
(defun org-e-icalendar-export-current-agenda ()
"Export current agenda view to an iCalendar file.

View File

@ -156,7 +156,9 @@
(?l "As TEX file" org-e-latex-export-to-latex)
(?p "As PDF file" org-e-latex-export-to-pdf)
(?o "As PDF file and open"
(lambda (s v b) (org-open-file (org-e-latex-export-to-pdf s v b))))))
(lambda (a s v b)
(if a (org-e-latex-export-to-pdf t s v b)
(org-open-file (org-e-latex-export-to-pdf nil s v b)))))))
:options-alist ((:date "DATE" nil org-e-latex-date-format t)
(:latex-class "LATEX_CLASS" nil org-e-latex-default-class t)
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
@ -2639,7 +2641,7 @@ contextual information."
;;;###autoload
(defun org-e-latex-export-as-latex
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer as a LaTeX buffer.
If narrowing is active in the current buffer, only export its
@ -2647,6 +2649,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.
@ -2665,16 +2671,27 @@ Export is done in a buffer named \"*Org E-LATEX Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(let ((outbuf (org-export-to-buffer
'e-latex "*Org E-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))))
(if async
(org-export-async-start
(lambda (output)
(with-current-buffer (get-buffer-create "*Org E-LATEX Export*")
(erase-buffer)
(insert output)
(goto-char (point-min))
(LaTeX-mode)
(org-export-add-to-stack (current-buffer) 'e-latex)))
`(org-export-as 'e-latex ,subtreep ,visible-only ,body-only
',ext-plist))
(let ((outbuf
(org-export-to-buffer 'e-latex "*Org E-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)))))
;;;###autoload
(defun org-e-latex-export-to-latex
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a LaTeX file.
If narrowing is active in the current buffer, only export its
@ -2682,6 +2699,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 file 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.
@ -2699,12 +2720,18 @@ file-local settings.
Return output file's name."
(interactive)
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-to-file
'e-latex outfile subtreep visible-only body-only ext-plist)))
(if async
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-latex))
`(expand-file-name
(org-export-to-file
'e-latex ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
(org-export-to-file
'e-latex outfile subtreep visible-only body-only ext-plist))))
;;;###autoload
(defun org-e-latex-export-to-pdf
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to LaTeX then process through to PDF.
If narrowing is active in the current buffer, only export its
@ -2712,6 +2739,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 file 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.
@ -2728,8 +2759,18 @@ file-local settings.
Return PDF file's name."
(interactive)
(org-e-latex-compile
(org-e-latex-export-to-latex subtreep visible-only body-only ext-plist)))
(if async
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-latex))
`(expand-file-name
(org-e-latex-compile
(org-export-to-file
'e-latex ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
(org-e-latex-compile
(org-e-latex-export-to-latex
nil subtreep visible-only body-only ext-plist))))
(defun org-e-latex-compile (texfile)
"Compile a TeX file.

View File

@ -108,7 +108,9 @@
((?m "As MAN file" org-e-man-export-to-man)
(?p "As PDF file" org-e-man-export-to-pdf)
(?o "As PDF file and open"
(lambda (s v b) (org-open-file (org-e-man-export-to-pdf s v b))))))
(lambda (a s v b)
(if a (org-e-man-export-to-pdf t s v b)
(org-open-file (org-e-man-export-to-pdf nil s v b)))))))
:options-alist
((:man-class "MAN_CLASS" nil nil t)
(:man-class-options "MAN_CLASS_OPTIONS" nil nil t)
@ -1146,7 +1148,7 @@ contextual information."
;;; Interactive functions
(defun org-e-man-export-to-man
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a Man file.
If narrowing is active in the current buffer, only export its
@ -1154,6 +1156,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 file 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.
@ -1171,11 +1177,17 @@ file-local settings.
Return output file's name."
(interactive)
(let ((outfile (org-export-output-file-name ".man" subtreep)))
(org-export-to-file
'e-man outfile subtreep visible-only body-only ext-plist)))
(if async
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-man))
`(expand-file-name
(org-export-to-file
'e-man ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
(org-export-to-file
'e-man outfile subtreep visible-only body-only ext-plist))))
(defun org-e-man-export-to-pdf
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to Groff then process through to PDF.
If narrowing is active in the current buffer, only export its
@ -1183,6 +1195,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 file 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.
@ -1199,8 +1215,17 @@ file-local settings.
Return PDF file's name."
(interactive)
(org-e-man-compile
(org-e-man-export-to-man subtreep visible-only body-only ext-plist)))
(if async
(let ((outfile (org-export-output-file-name ".man" subtreep)))
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-man))
`(expand-file-name
(org-e-man-compile
(org-export-to-file
'e-man ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
(org-e-man-compile
(org-e-man-export-to-man nil subtreep visible-only body-only ext-plist))))
(defun org-e-man-compile (file)
"Compile a Groff file.

View File

@ -91,8 +91,9 @@
(?o "Export to ODT"
((?o "As ODT file" org-e-odt-export-to-odt)
(?O "As ODT file and open"
(lambda (s v b)
(org-open-file (org-e-odt-export-to-odt s v b) 'system)))))
(lambda (a s v b)
(if a (org-e-odt-export-to-odt t s v)
(org-open-file (org-e-odt-export-to-odt nil s v) 'system))))))
:options-alist
((:odt-styles-file "ODT_STYLES_FILE" nil nil t)
(:LaTeX-fragments nil "LaTeX" org-export-with-LaTeX-fragments)))
@ -3828,8 +3829,7 @@ formula file."
;;;; Export to OpenDocument Text
;;;###autoload
(defun org-e-odt-export-to-odt
(&optional subtreep visible-only body-only ext-plist)
(defun org-e-odt-export-to-odt (&optional async subtreep visible-only ext-plist)
"Export current buffer to a HTML file.
If narrowing is active in the current buffer, only export its
@ -3837,6 +3837,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 file 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.
@ -3844,31 +3848,52 @@ first.
When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.
When optional argument BODY-ONLY is non-nil, only write code
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."
(interactive)
(org-e-odt--export-wrap
(org-export-output-file-name ".odt" subtreep)
(let* ((org-e-odt-embedded-images-count 0)
(org-e-odt-embedded-formulas-count 0)
(org-e-odt-automatic-styles nil)
(org-e-odt-object-counters nil)
;; Let `htmlfontify' know that we are interested in collecting
;; styles.
(hfy-user-sheet-assoc nil))
;; Initialize content.xml and kick-off the export process.
(let ((out-buf (progn
(require 'nxml-mode)
(let ((nxml-auto-insert-xml-declaration-flag nil))
(find-file-noselect
(concat org-e-odt-zip-dir "content.xml") t)))))
(org-export-to-buffer 'e-odt out-buf subtreep visible-only body-only)))))
(let ((outfile (org-export-output-file-name ".odt" subtreep)))
(if async
(org-export-async-start (lambda (f) (org-export-add-to-stack f 'e-odt))
`(expand-file-name
(org-e-odt--export-wrap
,outfile
(let* ((org-e-odt-embedded-images-count 0)
(org-e-odt-embedded-formulas-count 0)
(org-e-odt-automatic-styles nil)
(org-e-odt-object-counters nil)
;; Let `htmlfontify' know that we are interested in
;; collecting styles.
(hfy-user-sheet-assoc nil))
;; Initialize content.xml and kick-off the export
;; process.
(let ((out-buf
(progn
(require 'nxml-mode)
(let ((nxml-auto-insert-xml-declaration-flag nil))
(find-file-noselect
(concat org-e-odt-zip-dir "content.xml") t)))))
(org-export-to-buffer
'e-odt out-buf ,subtreep ,visible-only nil ',ext-plist))))))
(org-e-odt--export-wrap
outfile
(let* ((org-e-odt-embedded-images-count 0)
(org-e-odt-embedded-formulas-count 0)
(org-e-odt-automatic-styles nil)
(org-e-odt-object-counters nil)
;; Let `htmlfontify' know that we are interested in collecting
;; styles.
(hfy-user-sheet-assoc nil))
;; Initialize content.xml and kick-off the export process.
(let ((out-buf (progn
(require 'nxml-mode)
(let ((nxml-auto-insert-xml-declaration-flag nil))
(find-file-noselect
(concat org-e-odt-zip-dir "content.xml") t)))))
(org-export-to-buffer
'e-odt out-buf subtreep visible-only nil ext-plist)))))))
;;;; Convert between OpenDocument and other formats

View File

@ -1657,7 +1657,7 @@ contextual information."
;;; Interactive functions
(defun org-e-texinfo-export-to-texinfo
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a Texinfo file.
If narrowing is active in the current buffer, only export its
@ -1665,6 +1665,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 file 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.
@ -1682,11 +1686,18 @@ file-local settings.
Return output file's name."
(interactive)
(let ((outfile (org-export-output-file-name ".texi" subtreep)))
(org-export-to-file
'e-texinfo outfile subtreep visible-only body-only ext-plist)))
(if async
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-texinfo))
`(expand-file-name
(org-export-to-file
'e-texinfo ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))
(org-export-to-file
'e-texinfo outfile subtreep visible-only body-only ext-plist))))
(defun org-e-texinfo-export-to-info
(&optional subtreep visible-only body-only ext-plist)
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to Texinfo then process through to INFO.
If narrowing is active in the current buffer, only export its
@ -1694,6 +1705,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 file 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.
@ -1713,8 +1728,18 @@ directory.
Return INFO file's name."
(interactive)
(org-e-texinfo-compile
(org-e-texinfo-export-to-texinfo subtreep visible-only body-only ext-plist)))
(if async
(let ((outfile (org-export-output-file-name ".texi" subtreep)))
(org-export-async-start
(lambda (f) (org-export-add-to-stack f 'e-texinfo))
`(expand-file-name
(org-e-texinfo-compile
(org-export-to-file
'e-texinfo ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
(org-e-texinfo-compile
(org-e-texinfo-export-to-texinfo
nil subtreep visible-only body-only ext-plist))))
(defun org-e-texinfo-compile (file)
"Compile a texinfo file.

View File

@ -59,10 +59,12 @@ This variable can be set to either `atx' or `setext'."
:menu-entry
(?m "Export to Markdown"
((?M "To temporary buffer"
(lambda (s v b) (org-md-export-as-markdown s v)))
(?m "To file" (lambda (s v b) (org-md-export-to-markdown s v)))
(lambda (a s v b) (org-md-export-as-markdown a s v)))
(?m "To file" (lambda (a s v b) (org-md-export-to-markdown a s v)))
(?o "To file and open"
(lambda (s v b) (org-open-file (org-md-export-to-markdown s v))))))
(lambda (a s v b)
(if a (org-md-export-to-markdown t s v)
(org-open-file (org-md-export-to-markdown nil s v)))))))
:translate-alist ((bold . org-md-bold)
(code . org-md-verbatim)
(example-block . org-md-example-block)
@ -411,7 +413,7 @@ as a communication channel."
;;; Interactive function
;;;###autoload
(defun org-md-export-as-markdown (&optional subtreep visible-only)
(defun org-md-export-as-markdown (&optional async subtreep visible-only)
"Export current buffer to a text buffer.
If narrowing is active in the current buffer, only export its
@ -419,6 +421,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.
@ -430,15 +436,25 @@ 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)
(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))))
(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)))))
;;;###autoload
(defun org-md-export-to-markdown (&optional subtreep visible-only)
(defun org-md-export-to-markdown (&optional async subtreep visible-only)
"Export current buffer to a Markdown file.
If narrowing is active in the current buffer, only export its
@ -446,6 +462,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 file 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.
@ -456,7 +476,12 @@ contents of hidden elements.
Return output file's name."
(interactive)
(let ((outfile (org-export-output-file-name ".md" subtreep)))
(org-export-to-file 'md outfile subtreep visible-only)))
(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))))
(provide 'org-md)