Jelajahi Sumber

org.el: org-babel-load-file loads first tangle file

(org-babel-load-file): When org-mode FILE has multiple target files
for tangle blocks, `exported-file' will be set to last found
target file, which might not be the `file'.

Therefore fix for this bug is to select the last element of that
tangled file list, which is the tangle target file of the first found
tangle block, most typically the `file'.

TINYCHANGE
Sami Airaksinen 11 tahun lalu
induk
melakukan
c90925be29
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      lisp/org.el

+ 3 - 1
lisp/org.el

@@ -235,8 +235,10 @@ file to byte-code before it is loaded."
     ;; tangle if the org-mode file is newer than the elisp file
     (unless (and (file-exists-p exported-file)
 		 (> (funcall age file) (funcall age exported-file)))
+      ;; Tangle-file traversal returns reversed list of tangled files
+      ;; and we want to evaluate the first target.
       (setq exported-file
-	    (car (org-babel-tangle-file file exported-file "emacs-lisp"))))
+	    (car (last (org-babel-tangle-file file exported-file "emacs-lisp")))))
     (message "%s %s"
 	     (if compile
 		 (progn (byte-compile-file exported-file 'load)