diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-07-20 13:11:44 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-07-20 13:48:05 +0200 |
commit | 8478fac4a509c009de1d32b460acec210c9dac93 (patch) | |
tree | c8686ca513fe73e700302290eb8d7370828e6212 | |
parent | 99ef5728a2a3e22a95d2c8cb06d0dd6960229e9c (diff) | |
download | org-mode-8478fac4a509c009de1d32b460acec210c9dac93.tar.gz |
Add autoload and a commands to export to temporary buffer in export back-ends
* contrib/lisp/org-e-ascii.el (org-e-ascii-export-as-ascii): New
function.
(org-e-ascii-export-to-ascii): Now autoloaded.
* contrib/lisp/org-e-latex.el (org-e-latex-export-as-latex): New
function.
(org-e-latex-export-to-pdf): Now autoloaded.
(org-e-latex--collect-errors): Renamed from
`org-e-latex-collect-errors'.
(org-e-latex-compile): Apply renaming.
* contrib/lisp/org-e-html.el (org-e-html-export-as-html): New
function.
(org-e-html-export-to-html): Fix docstring.
* contrib/lisp/org-export.el (org-export-dispatch): Use new functions.
-rw-r--r-- | contrib/lisp/org-e-ascii.el | 37 | ||||
-rw-r--r-- | contrib/lisp/org-e-beamer.el | 6 | ||||
-rw-r--r-- | contrib/lisp/org-e-html.el | 42 | ||||
-rw-r--r-- | contrib/lisp/org-e-latex.el | 41 | ||||
-rw-r--r-- | contrib/lisp/org-export.el | 32 |
5 files changed, 127 insertions, 31 deletions
diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el index c6a10fb..0881e94 100644 --- a/contrib/lisp/org-e-ascii.el +++ b/contrib/lisp/org-e-ascii.el @@ -1728,6 +1728,43 @@ For any other back-end, HEADLINE is returned as-is." ;;; Interactive function +;;;###autoload +(defun org-e-ascii-export-as-ascii + (&optional 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 +narrowed part. + +If a region is active, export that region. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, strip title, table +of contents and footnote definitions from output. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +Return output file's name." + (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)))) + +;;;###autoload (defun org-e-ascii-export-to-ascii (&optional subtreep visible-only body-only ext-plist pub-dir) "Export current buffer to a text file. diff --git a/contrib/lisp/org-e-beamer.el b/contrib/lisp/org-e-beamer.el index 1261997..ed7026a 100644 --- a/contrib/lisp/org-e-beamer.el +++ b/contrib/lisp/org-e-beamer.el @@ -915,9 +915,9 @@ 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-BEAMER Export*\". It -will be displayed if `org-export-show-temporary-export-buffer' is -non-nil." +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*" diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el index e5176d2..5cbcfb9 100644 --- a/contrib/lisp/org-e-html.el +++ b/contrib/lisp/org-e-html.el @@ -3065,6 +3065,46 @@ contextual information." ;;; Interactive functions ;;;###autoload +(defun org-e-html-export-as-html + (&optional subtreep visible-only body-only ext-plist pub-dir) + "Export current buffer to an HTML buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +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 \"<body>\" and \"</body>\" tags. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +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)))) + +;;;###autoload (defun org-e-html-export-to-html (&optional subtreep visible-only body-only ext-plist pub-dir) "Export current buffer to a HTML file. @@ -3082,7 +3122,7 @@ 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}\". +between \"<body>\" and \"</body>\" tags. EXT-PLIST, when provided, is a property list with external parameters overriding Org default settings, but still inferior to diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el index 736be26..f88e374 100644 --- a/contrib/lisp/org-e-latex.el +++ b/contrib/lisp/org-e-latex.el @@ -2496,6 +2496,42 @@ contextual information." ;;; Interactive functions +;;;###autoload +(defun org-e-latex-export-as-latex + (&optional 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 +narrowed part. + +If a region is active, export that region. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +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. + +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)))) + +;;;###autoload (defun org-e-latex-export-to-latex (&optional subtreep visible-only body-only ext-plist pub-dir) "Export current buffer to a LaTeX file. @@ -2528,6 +2564,7 @@ Return output file's name." (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 pub-dir) "Export current buffer to LaTeX then process through to PDF. @@ -2596,7 +2633,7 @@ Return PDF file name or an error if it couldn't be produced." outbuf)) org-e-latex-pdf-process) ;; Collect standard errors from output buffer. - (setq errors (org-e-latex-collect-errors outbuf)))) + (setq errors (org-e-latex--collect-errors outbuf)))) (t (error "No valid command to process to PDF"))) (let ((pdffile (concat base ".pdf"))) ;; Check for process failure. Provide collected errors if @@ -2617,7 +2654,7 @@ Return PDF file name or an error if it couldn't be produced." pdffile)) (set-window-configuration wconfig)))) -(defun org-e-latex-collect-errors (buffer) +(defun org-e-latex--collect-errors (buffer) "Collect some kind of errors from \"pdflatex\" command output. BUFFER is the buffer containing output. diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index 63d1395..662a449 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -4145,28 +4145,16 @@ Return an error if key pressed has no associated command." (?q nil) ;; Export with `e-ascii' back-end. ((?A ?N ?U) - (let ((outbuf - (org-export-to-buffer - 'e-ascii "*Org E-ASCII Export*" - (memq 'subtree optns) (memq 'visible optns) (memq 'body optns) - `(:ascii-charset - ,(case raw-key (?A 'ascii) (?N 'latin1) (t 'utf-8)))))) - (with-current-buffer outbuf (text-mode)) - (when org-export-show-temporary-export-buffer - (switch-to-buffer-other-window outbuf)))) + (org-e-ascii-export-as-ascii + (memq 'subtree optns) (memq 'visible optns) (memq 'body optns) + `(:ascii-charset ,(case raw-key (?A 'ascii) (?N 'latin1) (t 'utf-8))))) ((?a ?n ?u) (org-e-ascii-export-to-ascii (memq 'subtree optns) (memq 'visible optns) (memq 'body optns) `(:ascii-charset ,(case raw-key (?a 'ascii) (?n 'latin1) (t 'utf-8))))) ;; Export with `e-latex' back-end. - (?L - (let ((outbuf - (org-export-to-buffer - 'e-latex "*Org E-LaTeX Export*" - (memq 'subtree optns) (memq 'visible optns) (memq 'body optns)))) - (with-current-buffer outbuf (latex-mode)) - (when org-export-show-temporary-export-buffer - (switch-to-buffer-other-window outbuf)))) + (?L (org-e-latex-export-as-latex + (memq 'subtree optns) (memq 'visible optns) (memq 'body optns))) (?l (org-e-latex-export-to-latex (memq 'subtree optns) (memq 'visible optns) (memq 'body optns))) @@ -4179,14 +4167,8 @@ Return an error if key pressed has no associated command." (memq 'subtree optns) (memq 'visible optns) (memq 'body optns)))) ;; Export with `e-html' back-end. (?H - (let ((outbuf - (org-export-to-buffer - 'e-html "*Org E-HTML Export*" - (memq 'subtree optns) (memq 'visible optns) (memq 'body optns)))) - ;; set major mode - (with-current-buffer outbuf (nxml-mode)) - (when org-export-show-temporary-export-buffer - (switch-to-buffer-other-window outbuf)))) + (org-e-html-export-as-html + (memq 'subtree optns) (memq 'visible optns) (memq 'body optns))) (?h (org-e-html-export-to-html (memq 'subtree optns) (memq 'visible optns) (memq 'body optns))) |