* tangling order
@ 2016-02-16 10:19 Alan Schmitt
2016-02-16 11:42 ` John Kitchin
0 siblings, 1 reply; 5+ messages in thread
From: Alan Schmitt @ 2016-02-16 10:19 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]
Hello,
I thought the order source blocks were tangled was the order of the
file. I just discovered this is not necessarily the case. This file:
--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC foob :tangle foo.ml
let x = 1
#+END_SRC
#+BEGIN_SRC fooa :tangle foo.ml
let x = 2
#+END_SRC
--8<---------------cut here---------------end--------------->8---
is tangled to this file
--8<---------------cut here---------------start------------->8---
let x = 2
let x = 1
--8<---------------cut here---------------end--------------->8---
It seems that the language name determines the order of tangling in this
case. Is there a way to disable this and use file order?
(This question comes up in the setting of a more complex example, where
I'm using different language names to specify different default headers,
and this feature is breaking the tangling of the files.)
Thanks,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂ (2016-01, Mauna Loa Obs.): 402.52
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tangling order
2016-02-16 10:19 tangling order Alan Schmitt
@ 2016-02-16 11:42 ` John Kitchin
2016-02-16 15:22 ` Alan Schmitt
0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2016-02-16 11:42 UTC (permalink / raw)
To: Alan Schmitt; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
I think you are seeing that the blocks are tangled in reverse. If I add a
third arbitrary lang it comes in reverse.
If they are all the same language, they are in the right order. It looks
like org collects by language, so your strategy won't work with org-babel
tangle I guess.
On Tue, Feb 16, 2016 at 5:19 AM, Alan Schmitt <
alan.schmitt@polytechnique.org> wrote:
> #+BEGIN_SRC foob :tangle foo.ml
> let x = 1
> #+END_SRC
>
> #+BEGIN_SRC fooa :tangle foo.ml
> let x = 2
> #+END_SRC
>
John
-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
[-- Attachment #2: Type: text/html, Size: 1552 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tangling order
2016-02-16 11:42 ` John Kitchin
@ 2016-02-16 15:22 ` Alan Schmitt
2016-02-16 17:34 ` Charles C. Berry
0 siblings, 1 reply; 5+ messages in thread
From: Alan Schmitt @ 2016-02-16 15:22 UTC (permalink / raw)
To: John Kitchin; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 879 bytes --]
On 2016-02-16 12:42, John Kitchin <jkitchin@andrew.cmu.edu> writes:
> I think you are seeing that the blocks are tangled in reverse. If I add a third
> arbitrary lang it comes in reverse.
Interesting! Thanks a lot for trying it.
I see that I made the typical scientific method mistake of testing for
my hypothesis, instead of testing against.
> If they are all the same language, they are in the right order. It looks like
> org collects by language, so your strategy won't work with org-babel tangle I
> guess.
I've found a workaround, as it is only for a few blocks I manually
change their headers, so it is fine at the moment. I still think it
would be great to have better control on the order in which blocks are
tangled.
Thanks again,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂ (2016-01, Mauna Loa Obs.): 402.52
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tangling order
2016-02-16 15:22 ` Alan Schmitt
@ 2016-02-16 17:34 ` Charles C. Berry
2016-02-17 15:43 ` Alan Schmitt
0 siblings, 1 reply; 5+ messages in thread
From: Charles C. Berry @ 2016-02-16 17:34 UTC (permalink / raw)
To: Alan Schmitt; +Cc: emacs-orgmode, John Kitchin
On Tue, 16 Feb 2016, Alan Schmitt wrote:
> On 2016-02-16 12:42, John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>> I think you are seeing that the blocks are tangled in reverse. If I add a third
>> arbitrary lang it comes in reverse.
>
> Interesting! Thanks a lot for trying it.
>
> I see that I made the typical scientific method mistake of testing for
> my hypothesis, instead of testing against.
>
>> If they are all the same language, they are in the right order. It looks like
>> org collects by language, so your strategy won't work with org-babel tangle I
>> guess.
>
> I've found a workaround, as it is only for a few blocks I manually
> change their headers, so it is fine at the moment.
Another workaround would be to add after advice to
`org-babel-get-src-block-info' to map your faux languages to a common
variant.
> I still think it
> would be great to have better control on the order in which blocks are
> tangled.
If you want to do this inside org/emacs (and not stitch a bunch of tangled
files together with other tools), try this in your *.org file and execute
it. The result is what you might work with (i.e. customize or advice the
function below).
#+BEGIN_SRC emacs-lisp :results pp :tangle foo.ml
(org-babel-tangle-collect-blocks)
#+END_SRC
HTH,
Chuck
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tangling order
2016-02-16 17:34 ` Charles C. Berry
@ 2016-02-17 15:43 ` Alan Schmitt
0 siblings, 0 replies; 5+ messages in thread
From: Alan Schmitt @ 2016-02-17 15:43 UTC (permalink / raw)
To: Charles C. Berry; +Cc: emacs-orgmode, John Kitchin
[-- Attachment #1: Type: text/plain, Size: 1088 bytes --]
On 2016-02-16 18:34, "Charles C. Berry" <ccberry@ucsd.edu> writes:
>> I've found a workaround, as it is only for a few blocks I manually
>> change their headers, so it is fine at the moment.
>
> Another workaround would be to add after advice to
> `org-babel-get-src-block-info' to map your faux languages to a common
> variant.
>
>> I still think it
>> would be great to have better control on the order in which blocks are
>> tangled.
>
> If you want to do this inside org/emacs (and not stitch a bunch of tangled
> files together with other tools), try this in your *.org file and execute
> it. The result is what you might work with (i.e. customize or advice the
> function below).
>
> #+BEGIN_SRC emacs-lisp :results pp :tangle foo.ml
> (org-babel-tangle-collect-blocks)
> #+END_SRC
Thank you for the suggestions. Looking at what this function returns
(blocks sorted by language), I now understand better why this does not
do what I want.
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂ (2016-01, Mauna Loa Obs.): 402.52
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-17 15:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 10:19 tangling order Alan Schmitt
2016-02-16 11:42 ` John Kitchin
2016-02-16 15:22 ` Alan Schmitt
2016-02-16 17:34 ` Charles C. Berry
2016-02-17 15:43 ` Alan Schmitt
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.