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'.
|
||||
|
||||
Return PDF file name or an error if it couldn't be produced."
|
||||
(let* ((wconfig (current-window-configuration))
|
||||
(texfile (file-truename texfile))
|
||||
(let* ((texfile (file-truename 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)
|
||||
(message (format "Processing LaTeX file %s ..." texfile))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(save-window-excursion
|
||||
(cond
|
||||
;; A function is provided: Apply it.
|
||||
((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
|
||||
;; redirected to "*Org PDF LaTeX Output*" buffer.
|
||||
((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*")))
|
||||
(mapc
|
||||
(lambda (command)
|
||||
|
@ -2714,8 +2715,7 @@ Return PDF file name or an error if it couldn't be produced."
|
|||
(if (not errors) "."
|
||||
(concat " with errors: " errors)))))
|
||||
;; Return output file name.
|
||||
pdffile))
|
||||
(set-window-configuration wconfig))))
|
||||
pdffile))))
|
||||
|
||||
(defun org-e-latex--collect-errors (buffer)
|
||||
"Collect some kind of errors from \"pdflatex\" command output.
|
||||
|
|
Loading…
Reference in New Issue