* Tangle only current code block?
@ 2012-10-07 23:00 Yann Le Du
2012-10-07 23:39 ` Eric Schulte
0 siblings, 1 reply; 5+ messages in thread
From: Yann Le Du @ 2012-10-07 23:00 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 605 bytes --]
Hi,
I have a bunch of code chunks with stuff like <<fun name>> and headers like
:tangle toto.c exporting to different files in noweb style
If I use C-c C-v t, it extracts all of those code chunks nicely
However, sometimes I would like to put my cursor inside one of those code
chunks and then extract only that one, not the others.
Is there a simple way ?
I narly found a solution, but to make it work nicely I need to put
org-babel-tangle inside a macro, but it fails: if I define a macro :
C-x (
M-x org-babel-tangle
C-x )
C-x e
it fails, saying wrong type argument stringp, nul
I'm lost.
Yann
[-- Attachment #2: Type: text/html, Size: 800 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tangle only current code block?
2012-10-07 23:00 Tangle only current code block? Yann Le Du
@ 2012-10-07 23:39 ` Eric Schulte
2012-10-08 6:21 ` Yann Le Du
2012-10-08 22:32 ` Bill White
0 siblings, 2 replies; 5+ messages in thread
From: Eric Schulte @ 2012-10-07 23:39 UTC (permalink / raw)
To: yann.ledu.fr; +Cc: emacs-orgmode
Yann Le Du <yann.ledu.fr@gmail.com> writes:
> Hi,
>
> I have a bunch of code chunks with stuff like <<fun name>> and headers like
> :tangle toto.c exporting to different files in noweb style
>
> If I use C-c C-v t, it extracts all of those code chunks nicely
>
> However, sometimes I would like to put my cursor inside one of those code
> chunks and then extract only that one, not the others.
>
> Is there a simple way ?
>
Yes, run the tangle with a prefix argument to tangle only the block
under your cursor e.g., C-u C-c C-v t.
Best,
>
> I narly found a solution, but to make it work nicely I need to put
> org-babel-tangle inside a macro, but it fails: if I define a macro :
>
> C-x (
> M-x org-babel-tangle
> C-x )
> C-x e
>
> it fails, saying wrong type argument stringp, nul
>
> I'm lost.
>
> Yann
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tangle only current code block?
2012-10-07 23:39 ` Eric Schulte
@ 2012-10-08 6:21 ` Yann Le Du
2012-10-09 2:28 ` Eric Schulte
2012-10-08 22:32 ` Bill White
1 sibling, 1 reply; 5+ messages in thread
From: Yann Le Du @ 2012-10-08 6:21 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]
On Mon, Oct 8, 2012 at 1:39 AM, Eric Schulte <eric.schulte@gmx.com> wrote:
> Yann Le Du <yann.ledu.fr@gmail.com> writes:
>
> > Hi,
> >
> > I have a bunch of code chunks with stuff like <<fun name>> and headers
> like
> > :tangle toto.c exporting to different files in noweb style
> >
> > If I use C-c C-v t, it extracts all of those code chunks nicely
> >
> > However, sometimes I would like to put my cursor inside one of those code
> > chunks and then extract only that one, not the others.
> >
> > Is there a simple way ?
> >
>
> Yes, run the tangle with a prefix argument to tangle only the block
> under your cursor e.g., C-u C-c C-v t.
>
>
Very nice! Is that documented? It's not in
http://orgmode.org/manual/Extracting-source-code.html
> Best,
>
> >
> > I narly found a solution, but to make it work nicely I need to put
> > org-babel-tangle inside a macro, but it fails: if I define a macro :
> >
> > C-x (
> > M-x org-babel-tangle
> > C-x )
> > C-x e
> >
> > it fails, saying wrong type argument stringp, nul
> >
> > I'm lost.
> >
> > Yann
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte
>
[-- Attachment #2: Type: text/html, Size: 2060 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tangle only current code block?
2012-10-07 23:39 ` Eric Schulte
2012-10-08 6:21 ` Yann Le Du
@ 2012-10-08 22:32 ` Bill White
1 sibling, 0 replies; 5+ messages in thread
From: Bill White @ 2012-10-08 22:32 UTC (permalink / raw)
To: emacs-orgmode
On Sun Oct 07 2012 at 18:39, Eric Schulte <eric.schulte@gmx.com> wrote:
> Yann Le Du <yann.ledu.fr@gmail.com> writes:
>
>> Hi,
>>
>> I have a bunch of code chunks with stuff like <<fun name>> and headers like
>> :tangle toto.c exporting to different files in noweb style
>>
>> If I use C-c C-v t, it extracts all of those code chunks nicely
>>
>> However, sometimes I would like to put my cursor inside one of those code
>> chunks and then extract only that one, not the others.
>>
>> Is there a simple way ?
>>
>
> Yes, run the tangle with a prefix argument to tangle only the block
> under your cursor e.g., C-u C-c C-v t.
And you can tangle a consecutive subset of code blocks by narrowing your
org buffer to only those blocks before tangling. It happens to me so
often I wrote a bit of code to avoid it. From my emacs.org:
#+begin_src emacs-lisp :tangle yes
(defadvice org-babel-tangle (before widen-before-tangling)
"Widen a buffer before calling org-babel-tangle."
(widen))
(ad-activate 'org-babel-tangle)
#+end_src
Cheers -
bw
--
Bill White . billw@wolfram.com
"No ma'am, we're musicians."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tangle only current code block?
2012-10-08 6:21 ` Yann Le Du
@ 2012-10-09 2:28 ` Eric Schulte
0 siblings, 0 replies; 5+ messages in thread
From: Eric Schulte @ 2012-10-09 2:28 UTC (permalink / raw)
To: yann.ledu.fr; +Cc: emacs-orgmode, Eric Schulte
Yann Le Du <yann.ledu.fr@gmail.com> writes:
> On Mon, Oct 8, 2012 at 1:39 AM, Eric Schulte <eric.schulte@gmx.com> wrote:
>
>> Yann Le Du <yann.ledu.fr@gmail.com> writes:
>>
>> > Hi,
>> >
>> > I have a bunch of code chunks with stuff like <<fun name>> and headers
>> like
>> > :tangle toto.c exporting to different files in noweb style
>> >
>> > If I use C-c C-v t, it extracts all of those code chunks nicely
>> >
>> > However, sometimes I would like to put my cursor inside one of those code
>> > chunks and then extract only that one, not the others.
>> >
>> > Is there a simple way ?
>> >
>>
>> Yes, run the tangle with a prefix argument to tangle only the block
>> under your cursor e.g., C-u C-c C-v t.
>>
>>
> Very nice! Is that documented? It's not in
> http://orgmode.org/manual/Extracting-source-code.html
>
This is now mentioned in the documentation. Cheers,
>
>
>> Best,
>>
>> >
>> > I narly found a solution, but to make it work nicely I need to put
>> > org-babel-tangle inside a macro, but it fails: if I define a macro :
>> >
>> > C-x (
>> > M-x org-babel-tangle
>> > C-x )
>> > C-x e
>> >
>> > it fails, saying wrong type argument stringp, nul
>> >
>> > I'm lost.
>> >
>> > Yann
>>
>> --
>> Eric Schulte
>> http://cs.unm.edu/~eschulte
>>
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-09 2:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-07 23:00 Tangle only current code block? Yann Le Du
2012-10-07 23:39 ` Eric Schulte
2012-10-08 6:21 ` Yann Le Du
2012-10-09 2:28 ` Eric Schulte
2012-10-08 22:32 ` Bill White
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).