Hi,

I use quite sophisticated (read complicated) initialization of my emacs.
Now I finally updated my emacs and org-mode upto date and found out that
org-babel-load-file doesn't work as previously.

I don't know if you have already noticed but if your tangled source
org-mode file has multiple target files for the tangle blocks, it loads
the file which was found last. This most often isn't the file name that
was given as input. There could be more generic solution to this, but I
though that it might be best to keep this patching simple as possible.

This is my first patch proposal so I hope I'm doing right and adding it
as an attachment to this post

-- 
Sami Airaksinen

From fe2c30fb06935ce871485b4e3816313d59d96cbe Mon Sep 17 00:00:00 2001
From: Sami Airaksinen <samia...@gmail.com>
Date: Thu, 29 Jan 2015 23:10:02 +0200
Subject: [PATCH] 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'.

Suggestion from a patch proposal by Sami Airaksinen

TINYCHANGE
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index b0e4380..2bc7f30 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -236,7 +236,7 @@ file to byte-code before it is loaded."
     (unless (and (file-exists-p exported-file)
 		 (> (funcall age file) (funcall age exported-file)))
       (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)
-- 
1.9.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to