summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-01-17 20:27:10 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2012-01-17 20:27:38 +0100
commitecfb12de1940249657b7ee020f8bde2bbc01f625 (patch)
tree164c6936eb792c7fc7f18295262417cec9f6ba91
parent418f63c8b1ab94e433a987a93ce1d5c52cf85862 (diff)
downloadorg-mode-ecfb12de1940249657b7ee020f8bde2bbc01f625.tar.gz
New interactive export functions for 'e-latex back-end
* EXPERIMENTAL/org-e-latex.el (org-e-latex-export-to-latex, org-e-latex-export-to-pdf): New functions. * contrib/lisp/org-export.el (org-export-dispatch): Make use of new functions.
-rw-r--r--EXPERIMENTAL/org-e-latex.el66
-rw-r--r--contrib/lisp/org-export.el32
2 files changed, 80 insertions, 18 deletions
diff --git a/EXPERIMENTAL/org-e-latex.el b/EXPERIMENTAL/org-e-latex.el
index 812c735..a4727c7 100644
--- a/EXPERIMENTAL/org-e-latex.el
+++ b/EXPERIMENTAL/org-e-latex.el
@@ -1911,7 +1911,71 @@ CONTENTS is nil. INFO is a plist holding contextual information."
-;;; Compilation
+;;; Interactive functions
+
+(defun org-e-latex-export-to-latex
+ (&optional subtreep visible-only body-only ext-plist pub-dir)
+ "Export current buffer to a LaTeX file.
+
+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.
+
+When optional argument PUB-DIR is set, use it as the publishing
+directory.
+
+Return output file's name."
+ (interactive)
+ (let ((outfile (org-export-output-file-name ".tex" subtreep pub-dir)))
+ (org-export-to-file
+ 'e-latex outfile subtreep visible-only body-only ext-plist)))
+
+(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.
+
+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.
+
+When optional argument PUB-DIR is set, use it as the publishing
+directory.
+
+Return PDF file's name."
+ (interactive)
+ (org-e-latex-compile
+ (org-e-latex-export-to-latex
+ subtreep visible-only body-only ext-plist pub-dir)))
(defun org-e-latex-compile (texfile)
"Compile a TeX file.
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el
index c165aed..dce1c11 100644
--- a/contrib/lisp/org-export.el
+++ b/contrib/lisp/org-export.el
@@ -2797,23 +2797,21 @@ Return an error if key pressed has no associated command."
;; depending on user's key pressed.
(case (if (< raw-key 27) (+ raw-key 96) raw-key)
;; Export with `e-latex' back-end.
- (?L (let ((outbuf (org-export-to-buffer
- 'e-latex "*Org E-latex Export*"
- (memq 'subtree scope)
- (memq 'visible scope)
- (memq 'body scope))))
- (with-current-buffer outbuf (latex-mode))
- (when org-export-show-temporary-export-buffer
- (switch-to-buffer-other-window outbuf))))
- ((?l ?p ?d)
- (org-export-to-file
- 'e-latex
- (cond ((eq raw-key ?p) #'org-e-latex-compile)
- ((eq raw-key ?d)
- (lambda (file) (org-open-file (org-e-latex-compile file)))))
- (memq 'subtree scope)
- (memq 'visible scope)
- (memq 'body scope)))
+ (?L
+ (let ((outbuf
+ (org-export-to-buffer
+ 'e-latex "*Org E-LaTeX Export*"
+ (memq 'subtree scope) (memq 'visible scope) (memq 'body scope))))
+ (with-current-buffer outbuf (latex-mode))
+ (when org-export-show-temporary-export-buffer
+ (switch-to-buffer-other-window outbuf))))
+ (?l (org-e-latex-export-to-latex
+ (memq 'subtree scope) (memq 'visible scope) (memq 'body scope)))
+ (?p (org-e-latex-export-to-pdf
+ (memq 'subtree scope) (memq 'visible scope) (memq 'body scope)))
+ (?d (org-open-file
+ (org-e-latex-export-to-pdf
+ (memq 'subtree scope) (memq 'visible scope) (memq 'body scope))))
;; Undefined command.
(t (error "No command associated with key %s"
(char-to-string raw-key))))))