org-latex.el: Bugfix: run export commands from the right buffer.

This commit is contained in:
Bastien Guerry 2011-07-16 19:08:40 +02:00
parent b93da58e1f
commit b9d5e7e85e
1 changed files with 22 additions and 20 deletions

View File

@ -1043,26 +1043,28 @@ when PUB-DIR is set, use this as the publishing directory."
(with-current-buffer outbuf (erase-buffer)) (with-current-buffer outbuf (erase-buffer))
(message (concat "Processing LaTeX file " file "...")) (message (concat "Processing LaTeX file " file "..."))
(setq output-dir (file-name-directory file)) (setq output-dir (file-name-directory file))
(if (and cmds (symbolp cmds)) (with-current-buffer lbuf
(funcall cmds (shell-quote-argument file)) (save-excursion
(while cmds (if (and cmds (symbolp cmds))
(setq cmd (pop cmds)) (funcall cmds (shell-quote-argument file))
(while (string-match "%b" cmd) (while cmds
(setq cmd (replace-match (setq cmd (pop cmds))
(save-match-data (while (string-match "%b" cmd)
(shell-quote-argument base)) (setq cmd (replace-match
t t cmd))) (save-match-data
(while (string-match "%f" cmd) (shell-quote-argument base))
(setq cmd (replace-match t t cmd)))
(save-match-data (while (string-match "%f" cmd)
(shell-quote-argument file)) (setq cmd (replace-match
t t cmd))) (save-match-data
(while (string-match "%o" cmd) (shell-quote-argument file))
(setq cmd (replace-match t t cmd)))
(save-match-data (while (string-match "%o" cmd)
(shell-quote-argument output-dir)) (setq cmd (replace-match
t t cmd))) (save-match-data
(shell-command cmd outbuf))) (shell-quote-argument output-dir))
t t cmd)))
(shell-command cmd outbuf)))))
(message (concat "Processing LaTeX file " file "...done")) (message (concat "Processing LaTeX file " file "...done"))
(setq errors (org-export-latex-get-error outbuf)) (setq errors (org-export-latex-get-error outbuf))
(if (not (file-exists-p pdffile)) (if (not (file-exists-p pdffile))