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.
This commit is contained in:
parent
418f63c8b1
commit
ecfb12de19
|
@ -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)
|
(defun org-e-latex-compile (texfile)
|
||||||
"Compile a TeX file.
|
"Compile a TeX file.
|
||||||
|
|
|
@ -2797,23 +2797,21 @@ Return an error if key pressed has no associated command."
|
||||||
;; depending on user's key pressed.
|
;; depending on user's key pressed.
|
||||||
(case (if (< raw-key 27) (+ raw-key 96) raw-key)
|
(case (if (< raw-key 27) (+ raw-key 96) raw-key)
|
||||||
;; Export with `e-latex' back-end.
|
;; Export with `e-latex' back-end.
|
||||||
(?L (let ((outbuf (org-export-to-buffer
|
(?L
|
||||||
'e-latex "*Org E-latex Export*"
|
(let ((outbuf
|
||||||
(memq 'subtree scope)
|
(org-export-to-buffer
|
||||||
(memq 'visible scope)
|
'e-latex "*Org E-LaTeX Export*"
|
||||||
(memq 'body scope))))
|
(memq 'subtree scope) (memq 'visible scope) (memq 'body scope))))
|
||||||
(with-current-buffer outbuf (latex-mode))
|
(with-current-buffer outbuf (latex-mode))
|
||||||
(when org-export-show-temporary-export-buffer
|
(when org-export-show-temporary-export-buffer
|
||||||
(switch-to-buffer-other-window outbuf))))
|
(switch-to-buffer-other-window outbuf))))
|
||||||
((?l ?p ?d)
|
(?l (org-e-latex-export-to-latex
|
||||||
(org-export-to-file
|
(memq 'subtree scope) (memq 'visible scope) (memq 'body scope)))
|
||||||
'e-latex
|
(?p (org-e-latex-export-to-pdf
|
||||||
(cond ((eq raw-key ?p) #'org-e-latex-compile)
|
(memq 'subtree scope) (memq 'visible scope) (memq 'body scope)))
|
||||||
((eq raw-key ?d)
|
(?d (org-open-file
|
||||||
(lambda (file) (org-open-file (org-e-latex-compile file)))))
|
(org-e-latex-export-to-pdf
|
||||||
(memq 'subtree scope)
|
(memq 'subtree scope) (memq 'visible scope) (memq 'body scope))))
|
||||||
(memq 'visible scope)
|
|
||||||
(memq 'body scope)))
|
|
||||||
;; Undefined command.
|
;; Undefined command.
|
||||||
(t (error "No command associated with key %s"
|
(t (error "No command associated with key %s"
|
||||||
(char-to-string raw-key))))))
|
(char-to-string raw-key))))))
|
||||||
|
|
Loading…
Reference in New Issue