emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH]


From: Evgeny Boykov
Subject: [O] [PATCH]
Date: Thu, 14 Jul 2011 01:13:08 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

===========================================================================

I want org-publish-current-file ~/git/org/filename.org in ~/pub/org/

Some setup:

(setq org-publish-project-alist
...
         :base-directory "~/git/org"
         :publishing-directory "~/pub/org"
         :publishing-function org-publish-org-to-pdf
...

or just

(org-export-as-pdf 3 nil nil "*Org LaTeX Export*" nil "~/pub/org")

Before patch, incorrectly: 

all pdf-creating files: filename.aux, filename.out, etc,
apart from filename.tex, are here:
../base-directory/

After patch, correctly:

all pdf-creating files are here:
../publishing-directory/

======================================================================

Solution:

All 'cmds' must be called in 'lbuf', but not in filename.org's buffer context.

======================================================================


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

__________________________

С уважением,
Бойков Евгений Алексеевич
сот. 8-924-202-25-65
e-mail: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]