emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Literate Programming - Continue a Source Block?


From: Achim Gratz
Subject: Re: [O] Literate Programming - Continue a Source Block?
Date: Tue, 14 Jun 2011 22:48:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Eric Schulte <address@hidden> writes:
> Thanks for sharing your thoughts.  How would you feel about moving away
> from special source block names and moving towards implementing this
> behavior with a header argument?

I'm not feeling strongly either way... I'm wanting to use Babel for some
stuff at work, but haven't got around to learn it well enough to set
things in motion.  So my current investment is still small.  :-)

>  Specifically two header arguments
> which would both take the name of a named code block, these header
> arguments would be as follows
>
> - append :: will append the current code block's body to the named code
>             block during tangling
>
> - overwrite :: will overwrite the named code block's body with the body
>                of the current code block
>
> for simple concatenate the value of the append header argument could be
> easily set on the file or subtree level.

This looks good, but it sort of turns the tables (I hope I get this
right, it was a longer day than I hoped).  With noweb references, you
need to resolve the name of the source block at the target.  With the
header arguments you propose you need to resolve the target block name
at the source.  Both ways are useful, but it seems that it would be
difficult to track all targets from a single source even if supposedly
one could have a list of targets (that would only be useful for
"overwrite" unless you are really lucky).  This asymmetry is
inescapeable when you try to use source blocks like "include files".
Another problem arises when you need to (again) reorder source blocks at
the target.  You can't do that from the source, since not only would the
source then need to know all targets, it would also need to know all
other sources and their ordering in all targets.

> I feel that for many reasons (most of which have been discussed in
> relation to a header argument solution earlier in this thread) such a
> solution would be simpler and more consistent with the rest of Babel
> than the current name-based solution.

I'd think if there was an API to get at the contents of the header
arguments (perhaps using or modeled after the properties API), both the
forward and backward resolution could use the same internal mechanism
and noweb references could be changed (or extended) to (optionally) use
a match with some header argument (e.g. :id or :srcname).  So let's say
that'd then allow:

  <<:id "bla">>

to build a list of all source blocks with that header argument and
tangle them in list order.  And since noweb references now really expect
a list, you can just as well feed them a custom function that cobbles
that list from multiple header arguments or properties.

Thinking along those lines I'm beginning to wonder if not the whole
header should be put into a drawer (I've often wished this was the case
for #+TBLFM).



Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




reply via email to

[Prev in Thread] Current Thread [Next in Thread]