emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Tangle only current code block?


From: Bill White
Subject: Re: [O] Tangle only current code block?
Date: Mon, 08 Oct 2012 17:32:48 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

On Sun Oct 07 2012 at 18:39, Eric Schulte <address@hidden> wrote:

> Yann Le Du <address@hidden> 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 . address@hidden
"No ma'am, we're musicians."




reply via email to

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