diff --git a/EXPERIMENTAL/org-e-latex.el b/EXPERIMENTAL/org-e-latex.el index 812c7356f..a4727c734 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 c165aedd2..dce1c1174 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))))))