From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sami Airaksinen Subject: Re: [PATCH] org.el: org-babel-load-file loads first tangle file Date: Sun, 01 Feb 2015 00:20:01 +0200 Message-ID: <54CD5511.7010205@gmail.com> References: <54CAAAE0.208@gmail.com> <87y4okpppx.fsf@nicolasgoaziou.fr> <87twz8p4yf.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SPJpP1EEBDjN9AaSxBHkmjWNAii7j8cRG" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHgOl-0000hr-Ht for emacs-orgmode@gnu.org; Sat, 31 Jan 2015 17:20:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHgOg-0006Eq-IH for emacs-orgmode@gnu.org; Sat, 31 Jan 2015 17:20:15 -0500 Received: from mail-la0-x22e.google.com ([2a00:1450:4010:c03::22e]:45051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHgOg-0006Ei-B7 for emacs-orgmode@gnu.org; Sat, 31 Jan 2015 17:20:10 -0500 Received: by mail-la0-f46.google.com with SMTP id s18so30991074lam.5 for ; Sat, 31 Jan 2015 14:20:09 -0800 (PST) Received: from [10.0.1.8] (a91-156-176-206.elisa-laajakaista.fi. [91.156.176.206]) by mx.google.com with ESMTPSA id p10sm3500284lap.10.2015.01.31.14.20.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Jan 2015 14:20:07 -0800 (PST) In-Reply-To: <87twz8p4yf.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --SPJpP1EEBDjN9AaSxBHkmjWNAii7j8cRG Content-Type: multipart/mixed; boundary="------------010309010103020700020207" This is a multi-part message in MIME format. --------------010309010103020700020207 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 01/30/2015 07:13 PM, Nicolas Goaziou wrote: > Sami Airaksinen writes: > >> I got confused, do you want a comment in the source code or in the com= mit >> message? > The former. > >> So comment in the source code would be something like, >> "tangle-file traversal returns reversed list of tangled files and we w= ant >> to evaluate the first target" > That's fine. > >> If explanation is for car+last combo: (car (last ...)) the car is need= ed >> because (last ...) returns the last link which is list of one element.= > No it isn't about car+last but why we're interested in the last element= > instead of the first one. > > Thanks, --=20 Sami Airaksinen --------------010309010103020700020207 Content-Type: text/x-patch; name="0001-org.el-org-babel-load-file-loads-first-tangle-file.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-org.el-org-babel-load-file-loads-first-tangle-file.patc"; filename*1="h" =46rom 6fcb4b222e308c97d4c90b96ac73234c1951f307 Mon Sep 17 00:00:00 2001 From: Sami Airaksinen 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'. TINYCHANGE --- lisp/org.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index b0e4380..e87de90 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -235,8 +235,9 @@ 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 an= d 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) --=20 1.9.1 --------------010309010103020700020207-- --SPJpP1EEBDjN9AaSxBHkmjWNAii7j8cRG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUzVURAAoJELdhJChF8OS5eccH/AlZSsUPBEEPcD7ppabk5sBh smZuOgt+34JjyoxYMtEDLPBjqx9mcKFdChhh0CWO9wt17iQH2oKtS1ynXlMwjMPO AavVzG0lk5zluCE1E1TPnDD7lpj8K5oJmwfowajAbMJYHA59eWGGJOBi612d3jaf iLiLL00Sq2jDXl5K9PdoWFFfPn71r4CmBpKVknXMciwBNUFFb9++zGulMbppJcFE crJvI/MJpE6uYS4Lil0WMBK1REEV77s3Qc3q4AzuYvaxcJlOY32JHNj/ox2GbwnU hihMz+D0IzNwO4GnqLMEZ33a3Iqr2h2ubFGzJSftun3lhjjlF/R8nrDg+CfgBxA= =jv1/ -----END PGP SIGNATURE----- --SPJpP1EEBDjN9AaSxBHkmjWNAii7j8cRG--