Skip to main content
deleted 7 characters in body
Source Link
147pm
  • 3.1k
  • 1
  • 22
  • 44

Let's say I'm creating many babel code blocks in a growing org-mode buffer and I'm tangling them all to a single file. However, I want certain blocks to appear above others. For example,

#+begin_src haskell :eval never :exports code :tangle fp41.hs module FP41 where import Data.List #+end_src #+begin_src haskell :eval never :exports code :tangle fp41.hs data Mood = Blah | Woot deriving (Show, Eq) changeMood Blah = Woot changeMood _ = Blah #+end_src 

This works wonderfully, but I always have to watch what order the blocks are int to avoid spaghetti code. So what if I want to add another import way down in the buffer

#+begin_src haskell :eval never :exports code :tangle fp41.hs import import GHC.Int #+end_src 

but not have it below regular code in the tangled file? That is, I want it going to the header block in the tangled code file fp41.hs, grouped/following the previous last import. I could tangle them to separate files -- one for "header" stuff, one for code. If that's the route, is there any way then to automate combining them into a single file?

Let's say I'm creating many babel code blocks in a growing org-mode buffer and I'm tangling them all to a single file. However, I want certain blocks to appear above others. For example,

#+begin_src haskell :eval never :exports code :tangle fp41.hs module FP41 where import Data.List #+end_src #+begin_src haskell :eval never :exports code :tangle fp41.hs data Mood = Blah | Woot deriving (Show, Eq) changeMood Blah = Woot changeMood _ = Blah #+end_src 

This works wonderfully, but I always have to watch what order the blocks are int to avoid spaghetti code. So what if I want to add another import way down in the buffer

#+begin_src haskell :eval never :exports code :tangle fp41.hs import import GHC.Int #+end_src 

but not have it below regular code in the tangled file? That is, I want it going to the header block in the tangled code file fp41.hs, grouped/following the previous last import. I could tangle them to separate files -- one for "header" stuff, one for code. If that's the route, is there any way then to automate combining them into a single file?

Let's say I'm creating many babel code blocks in a growing org-mode buffer and I'm tangling them all to a single file. However, I want certain blocks to appear above others. For example,

#+begin_src haskell :eval never :exports code :tangle fp41.hs module FP41 where import Data.List #+end_src #+begin_src haskell :eval never :exports code :tangle fp41.hs data Mood = Blah | Woot deriving (Show, Eq) changeMood Blah = Woot changeMood _ = Blah #+end_src 

This works wonderfully, but I always have to watch what order the blocks are int to avoid spaghetti code. So what if I want to add another import way down in the buffer

#+begin_src haskell :eval never :exports code :tangle fp41.hs import GHC.Int #+end_src 

but not have it below regular code in the tangled file? That is, I want it going to the header block in the tangled code file fp41.hs, grouped/following the previous last import. I could tangle them to separate files -- one for "header" stuff, one for code. If that's the route, is there any way then to automate combining them into a single file?

Source Link
147pm
  • 3.1k
  • 1
  • 22
  • 44

Tangle babel code to specific location in source file?

Let's say I'm creating many babel code blocks in a growing org-mode buffer and I'm tangling them all to a single file. However, I want certain blocks to appear above others. For example,

#+begin_src haskell :eval never :exports code :tangle fp41.hs module FP41 where import Data.List #+end_src #+begin_src haskell :eval never :exports code :tangle fp41.hs data Mood = Blah | Woot deriving (Show, Eq) changeMood Blah = Woot changeMood _ = Blah #+end_src 

This works wonderfully, but I always have to watch what order the blocks are int to avoid spaghetti code. So what if I want to add another import way down in the buffer

#+begin_src haskell :eval never :exports code :tangle fp41.hs import import GHC.Int #+end_src 

but not have it below regular code in the tangled file? That is, I want it going to the header block in the tangled code file fp41.hs, grouped/following the previous last import. I could tangle them to separate files -- one for "header" stuff, one for code. If that's the route, is there any way then to automate combining them into a single file?