emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Can one tangle only the current blocks under header ?
@ 2016-07-30 17:55 Xebar Saram
  2016-07-30 18:38 ` Joon Ro
  0 siblings, 1 reply; 5+ messages in thread
From: Xebar Saram @ 2016-07-30 17:55 UTC (permalink / raw)
  To: org mode

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

Hi all

can one tangle only the current blocks under header or  can you only tangle
the whole file?
the issue is again for dotfiles managed by org that these files are not
proper org babel languages and look like this:

#+BEGIN_SRC conf :mkdirp yes :tangle ~/.config/mpv/mpv.conf
softvol-max=600
#+END_SRC

the manual (http://orgmode.org/manual/Extracting-source-code.html) only
shows how to tangle the whole file

any ideas?

thx!

Z

[-- Attachment #2: Type: text/html, Size: 740 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Can one tangle only the current blocks under header ?
  2016-07-30 17:55 Can one tangle only the current blocks under header ? Xebar Saram
@ 2016-07-30 18:38 ` Joon Ro
  2016-07-31 14:34   ` Grant Rettke
  0 siblings, 1 reply; 5+ messages in thread
From: Joon Ro @ 2016-07-30 18:38 UTC (permalink / raw)
  To: Xebar Saram, org mode

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]




can one tangle only the current blocks under header or  can you only tangle the whole file?the issue is again for dotfiles managed by org that these files are not proper org babel languages and look like this:
#+BEGIN_SRC conf :mkdirp yes :tangle ~/.config/mpv/mpv.confsoftvol-max=600  #+END_SRC
the manual (http://orgmode.org/manual/Extracting-source-code.html) only shows how to tangle the whole file
any ideas?
If you read the help for org-babel-tangle:
With one universal prefix argument, only tangle the block at point.When two universal prefix arguments, only tangle blocks for thetangle file of the block at point.
So if you do c-u first before org-babel-tangle, it will only tangle the code block at point.I use this a lot so I have the following in my init file:
(defun org-babel-tangle-block()  (interactive)  (let ((current-prefix-arg '(4)))     (call-interactively 'org-babel-tangle)))
(eval-after-load "org"  '(progn     (define-key org-mode-map (kbd "C-c b") 'org-babel-tangle-block)))
So I can just do C-c b and it will just tangle the code block at point.
And I agree with you I with the manual (http://orgmode.org/manual/Extracting-source-code.html) has this information.
Hope this helps,Joon

 		 	   		  

[-- Attachment #2: Type: text/html, Size: 4090 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Can one tangle only the current blocks under header ?
  2016-07-30 18:38 ` Joon Ro
@ 2016-07-31 14:34   ` Grant Rettke
  2016-08-02 12:26     ` Xebar Saram
  0 siblings, 1 reply; 5+ messages in thread
From: Grant Rettke @ 2016-07-31 14:34 UTC (permalink / raw)
  To: Joon Ro; +Cc: Xebar Saram, org mode

You can `:tangle no' on the source block to exclude it from tangling.

You can even tangle one source block to a different or as many files
as you like during tangling.
Sincerely,

Grant Rettke


On Sat, Jul 30, 2016 at 1:38 PM, Joon Ro <joon.ro@outlook.com> wrote:
> can one tangle only the current blocks under header or  can you only tangle
> the whole file?
> the issue is again for dotfiles managed by org that these files are not
> proper org babel languages and look like this:
>
> #+BEGIN_SRC conf :mkdirp yes :tangle ~/.config/mpv/mpv.conf
> softvol-max=600
> #+END_SRC
>
> the manual (http://orgmode.org/manual/Extracting-source-code.html) only
> shows how to tangle the whole file
>
> any ideas?
>
>
> If you read the help for org-babel-tangle:
>
> With one universal prefix argument, only tangle the block at point.
> When two universal prefix arguments, only tangle blocks for the
> tangle file of the block at point.
>
>
> So if you do c-u first before org-babel-tangle, it will only tangle the code
> block at point.
> I use this a lot so I have the following in my init file:
>
> (defun org-babel-tangle-block()
>   (interactive)
>   (let ((current-prefix-arg '(4)))
>      (call-interactively 'org-babel-tangle)))
>
> (eval-after-load "org"
>   '(progn
>      (define-key org-mode-map (kbd "C-c b") 'org-babel-tangle-block)))
>
>
> So I can just do C-c b and it will just tangle the code block at point.
>
> And I agree with you I with the manual
> (http://orgmode.org/manual/Extracting-source-code.html) has this
> information.
>
> Hope this helps,
> Joon
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Can one tangle only the current blocks under header ?
  2016-07-31 14:34   ` Grant Rettke
@ 2016-08-02 12:26     ` Xebar Saram
  2016-08-02 15:05       ` Joon Ro
  0 siblings, 1 reply; 5+ messages in thread
From: Xebar Saram @ 2016-08-02 12:26 UTC (permalink / raw)
  To: Grant Rettke; +Cc: Joon Ro, org mode

[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]

thx so much

Joon: thx this is great. one last question. suppose i have multiple code
blocks under  header like this:

**** main i3 conf
     :PROPERTIES:
     :ID:       f17b5518-2695-4484-a958-2fc7b8aa2479
     :tangle:   /home/zeltak/.i3/config
     :END:



is there a way to issue a tangle just for all below the header blocks?

best

Z

On Sun, Jul 31, 2016 at 5:34 PM, Grant Rettke <gcr@wisdomandwonder.com>
wrote:

> You can `:tangle no' on the source block to exclude it from tangling.
>
> You can even tangle one source block to a different or as many files
> as you like during tangling.
> Sincerely,
>
> Grant Rettke
>
>
> On Sat, Jul 30, 2016 at 1:38 PM, Joon Ro <joon.ro@outlook.com> wrote:
> > can one tangle only the current blocks under header or  can you only
> tangle
> > the whole file?
> > the issue is again for dotfiles managed by org that these files are not
> > proper org babel languages and look like this:
> >
> > #+BEGIN_SRC conf :mkdirp yes :tangle ~/.config/mpv/mpv.conf
> > softvol-max=600
> > #+END_SRC
> >
> > the manual (http://orgmode.org/manual/Extracting-source-code.html) only
> > shows how to tangle the whole file
> >
> > any ideas?
> >
> >
> > If you read the help for org-babel-tangle:
> >
> > With one universal prefix argument, only tangle the block at point.
> > When two universal prefix arguments, only tangle blocks for the
> > tangle file of the block at point.
> >
> >
> > So if you do c-u first before org-babel-tangle, it will only tangle the
> code
> > block at point.
> > I use this a lot so I have the following in my init file:
> >
> > (defun org-babel-tangle-block()
> >   (interactive)
> >   (let ((current-prefix-arg '(4)))
> >      (call-interactively 'org-babel-tangle)))
> >
> > (eval-after-load "org"
> >   '(progn
> >      (define-key org-mode-map (kbd "C-c b") 'org-babel-tangle-block)))
> >
> >
> > So I can just do C-c b and it will just tangle the code block at point.
> >
> > And I agree with you I with the manual
> > (http://orgmode.org/manual/Extracting-source-code.html) has this
> > information.
> >
> > Hope this helps,
> > Joon
> >
>

[-- Attachment #2: Type: text/html, Size: 3263 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Can one tangle only the current blocks under header ?
  2016-08-02 12:26     ` Xebar Saram
@ 2016-08-02 15:05       ` Joon Ro
  0 siblings, 0 replies; 5+ messages in thread
From: Joon Ro @ 2016-08-02 15:05 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

[-- Attachment #1: Type: text/plain, Size: 2788 bytes --]




> Joon: thx this is great. 
You're welcome. 
> one last question. suppose i have multiple code blocks under  header like this:> > **** main i3 conf>      :PROPERTIES:>      :ID:       f17b5518-2695-4484-a958-2fc7b8aa2479>      :tangle:   /home/zeltak/.i3/config>      :END:>    > > > is there a way to issue a tangle just for all below the header blocks?
Again if you read the help: 
    When two universal prefix arguments, only tangle blocks for the tangle file of the block at point.
So if you give two universal prefix arguments and issue org-babel-tangle while you are at a code block with the tangle file /home/zeltak/.i3/config, it will only tangle code blocks with that particular code block. I think that is what you want. I'm sure you can modify the code I showed you to implement this.
Another way to do this is just `org-narrow-to-subtree` to narrow down to that subtree and and then just tangle the whole thing.
-Joon



On Sun, Jul 31, 2016 at 5:34 PM, Grant Rettke <gcr@wisdomandwonder.com> wrote:
You can `:tangle no' on the source block to exclude it from tangling.



You can even tangle one source block to a different or as many files

as you like during tangling.

Sincerely,



Grant Rettke





On Sat, Jul 30, 2016 at 1:38 PM, Joon Ro <joon.ro@outlook.com> wrote:

> can one tangle only the current blocks under header or  can you only tangle

> the whole file?

> the issue is again for dotfiles managed by org that these files are not

> proper org babel languages and look like this:

>

> #+BEGIN_SRC conf :mkdirp yes :tangle ~/.config/mpv/mpv.conf

> softvol-max=600

> #+END_SRC

>

> the manual (http://orgmode.org/manual/Extracting-source-code.html) only

> shows how to tangle the whole file

>

> any ideas?

>

>

> If you read the help for org-babel-tangle:

>

> With one universal prefix argument, only tangle the block at point.

> When two universal prefix arguments, only tangle blocks for the

> tangle file of the block at point.

>

>

> So if you do c-u first before org-babel-tangle, it will only tangle the code

> block at point.

> I use this a lot so I have the following in my init file:

>

> (defun org-babel-tangle-block()

>   (interactive)

>   (let ((current-prefix-arg '(4)))

>      (call-interactively 'org-babel-tangle)))

>

> (eval-after-load "org"

>   '(progn

>      (define-key org-mode-map (kbd "C-c b") 'org-babel-tangle-block)))

>

>

> So I can just do C-c b and it will just tangle the code block at point.

>

> And I agree with you I with the manual

> (http://orgmode.org/manual/Extracting-source-code.html) has this

> information.

>

> Hope this helps,

> Joon

>



 		 	   		  

[-- Attachment #2: Type: text/html, Size: 4832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-02 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-30 17:55 Can one tangle only the current blocks under header ? Xebar Saram
2016-07-30 18:38 ` Joon Ro
2016-07-31 14:34   ` Grant Rettke
2016-08-02 12:26     ` Xebar Saram
2016-08-02 15:05       ` Joon Ro

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).