org-e-latex: Fix publishing problems when compiling a TeX file
* contrib/lisp/org-e-latex.el (org-e-latex-compile): Fix compilation when default-directory from current buffer doesn't match directory from file being compiled. Small refactoring, too. Thanks to Robert Klein for reporting the problem and suggesting a fix.
This commit is contained in:
parent
0a99cf7249
commit
9b11e63e7a
|
@ -2667,13 +2667,14 @@ TEXFILE is the name of the file being compiled. Processing is
|
||||||
done through the command specified in `org-e-latex-pdf-process'.
|
done through the command specified in `org-e-latex-pdf-process'.
|
||||||
|
|
||||||
Return PDF file name or an error if it couldn't be produced."
|
Return PDF file name or an error if it couldn't be produced."
|
||||||
(let* ((wconfig (current-window-configuration))
|
(let* ((texfile (file-truename texfile))
|
||||||
(texfile (file-truename texfile))
|
|
||||||
(base (file-name-sans-extension texfile))
|
(base (file-name-sans-extension texfile))
|
||||||
|
;; Make sure `default-directory' is set to TEXFILE directory,
|
||||||
|
;; not to whatever value the current buffer may have.
|
||||||
|
(default-directory (file-name-directory texfile))
|
||||||
errors)
|
errors)
|
||||||
(message (format "Processing LaTeX file %s ..." texfile))
|
(message (format "Processing LaTeX file %s ..." texfile))
|
||||||
(unwind-protect
|
(save-window-excursion
|
||||||
(progn
|
|
||||||
(cond
|
(cond
|
||||||
;; A function is provided: Apply it.
|
;; A function is provided: Apply it.
|
||||||
((functionp org-e-latex-pdf-process)
|
((functionp org-e-latex-pdf-process)
|
||||||
|
@ -2682,7 +2683,7 @@ Return PDF file name or an error if it couldn't be produced."
|
||||||
;; values in each command before applying it. Output is
|
;; values in each command before applying it. Output is
|
||||||
;; redirected to "*Org PDF LaTeX Output*" buffer.
|
;; redirected to "*Org PDF LaTeX Output*" buffer.
|
||||||
((consp org-e-latex-pdf-process)
|
((consp org-e-latex-pdf-process)
|
||||||
(let* ((out-dir (or (file-name-directory texfile) "./"))
|
(let* ((out-dir (file-name-directory texfile))
|
||||||
(outbuf (get-buffer-create "*Org PDF LaTeX Output*")))
|
(outbuf (get-buffer-create "*Org PDF LaTeX Output*")))
|
||||||
(mapc
|
(mapc
|
||||||
(lambda (command)
|
(lambda (command)
|
||||||
|
@ -2714,8 +2715,7 @@ Return PDF file name or an error if it couldn't be produced."
|
||||||
(if (not errors) "."
|
(if (not errors) "."
|
||||||
(concat " with errors: " errors)))))
|
(concat " with errors: " errors)))))
|
||||||
;; Return output file name.
|
;; Return output file name.
|
||||||
pdffile))
|
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.
|
"Collect some kind of errors from \"pdflatex\" command output.
|
||||||
|
|
Loading…
Reference in New Issue