Procházet zdrojové kódy

Fix `org-compile-file' error

* lisp/org.el (org-compile-file): Fix error when source file is not
  located in current directory.

Reported-by: "Charles C. Berry" <ccberry@ucsd.edu>
<http://permalink.gmane.org/gmane.emacs.orgmode/108245>
Nicolas Goaziou před 8 roky
rodič
revize
e1f24f537e
1 změnil soubory, kde provedl 18 přidání a 19 odebrání
  1. 18 19
      lisp/org.el

+ 18 - 19
lisp/org.el

@@ -22645,28 +22645,27 @@ process."
 	 (base-name (file-name-sans-extension source-name))
 	 (full-name (file-truename source))
 	 (out-dir (file-name-directory source))
-	 ;; Properly set working directory for compilation.
-	 (default-directory (file-name-directory full-name))
 	 (time (current-time))
 	 (err-msg (if (stringp err-msg) (concat ".  " err-msg) "")))
     (save-window-excursion
-      (pcase process
-        ((pred functionp) (funcall process (shell-quote-argument source)))
-        ((pred consp)
-         (let ((log-buf (and log-buf (get-buffer-create log-buf)))
-               (spec (append spec
-			     `((?b . ,(shell-quote-argument base-name))
-			       (?f . ,(shell-quote-argument source-name))
-			       (?F . ,(shell-quote-argument full-name))
-			       (?o . ,(shell-quote-argument out-dir))))))
-           (dolist (command process)
-             (shell-command (format-spec command spec) log-buf))))
-        (_ (error "No valid command to process %S%s" source err-msg)))
-      ;; Check for process failure.
-      (let ((output (concat out-dir base-name "." ext)))
-	(unless (org-file-newer-than-p output time)
-	  (error (format "File %S wasn't produced%s" output err-msg)))
-	output))))
+      (let ((default-directory (file-name-directory full-name)))
+	(pcase process
+	  ((pred functionp) (funcall process (shell-quote-argument source)))
+	  ((pred consp)
+	   (let ((log-buf (and log-buf (get-buffer-create log-buf)))
+		 (spec (append spec
+			       `((?b . ,(shell-quote-argument base-name))
+				 (?f . ,(shell-quote-argument source-name))
+				 (?F . ,(shell-quote-argument full-name))
+				 (?o . ,(shell-quote-argument out-dir))))))
+	     (dolist (command process)
+	       (shell-command (format-spec command spec) log-buf))))
+	  (_ (error "No valid command to process %S%s" source err-msg)))))
+    ;; Check for process failure.
+    (let ((output (concat out-dir base-name "." ext)))
+      (unless (org-file-newer-than-p output time)
+	(error (format "File %S wasn't produced%s" output err-msg)))
+      output)))
 
 ;;; Indentation