From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Can one tangle only the current blocks under header ? Date: Tue, 2 Aug 2016 10:05:02 -0500 Message-ID: References: , , , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_ea844735-f125-4fe8-ade2-b8883a9168b2_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUbFl-0000ml-T3 for emacs-orgmode@gnu.org; Tue, 02 Aug 2016 11:05:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUbFh-0002uC-7M for emacs-orgmode@gnu.org; Tue, 02 Aug 2016 11:05:09 -0400 Received: from col004-omc3s18.hotmail.com ([65.55.34.157]:57736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUbFg-0002u5-Rf for emacs-orgmode@gnu.org; Tue, 02 Aug 2016 11:05:05 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Xebar Saram Cc: org mode --_ea844735-f125-4fe8-ade2-b8883a9168b2_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =0A= =0A= =0A= > Joon: thx this is great.=20 You're welcome.=20 > one last question. suppose i have multiple code blocks under header like= this:> > **** main i3 conf> :PROPERTIES:> :ID: f17b5518-26= 95-4484-a958-2fc7b8aa2479> :tangle: /home/zeltak/.i3/config> :E= ND:> > > > is there a way to issue a tangle just for all below the heade= r blocks? Again if you read the help:=20 When two universal prefix arguments=2C only tangle blocks for the tangl= e file of the block at point. So if you give two universal prefix arguments and issue org-babel-tangle wh= ile you are at a code block with the tangle file /home/zeltak/.i3/config=2C= it will only tangle code blocks with that particular code block. I think t= hat is what you want. I'm sure you can modify the code I showed you to impl= ement this. Another way to do this is just `org-narrow-to-subtree` to narrow down to th= at subtree and and then just tangle the whole thing. -Joon On Sun=2C Jul 31=2C 2016 at 5:34 PM=2C Grant Rettke wrote: You can `:tangle no' on the source block to exclude it from tangling. =0A= =0A= You can even tangle one source block to a different or as many files =0A= as you like during tangling. =0A= Sincerely=2C =0A= =0A= Grant Rettke =0A= =0A= =0A= On Sat=2C Jul 30=2C 2016 at 1:38 PM=2C Joon Ro wrote: =0A= > can one tangle only the current blocks under header or can you only tang= le =0A= > the whole file? =0A= > the issue is again for dotfiles managed by org that these files are not =0A= > proper org babel languages and look like this: =0A= > =0A= > #+BEGIN_SRC conf :mkdirp yes :tangle ~/.config/mpv/mpv.conf =0A= > softvol-max=3D600 =0A= > #+END_SRC =0A= > =0A= > the manual (http://orgmode.org/manual/Extracting-source-code.html) only =0A= > shows how to tangle the whole file =0A= > =0A= > any ideas? =0A= > =0A= > =0A= > If you read the help for org-babel-tangle: =0A= > =0A= > With one universal prefix argument=2C only tangle the block at point. =0A= > When two universal prefix arguments=2C only tangle blocks for the =0A= > tangle file of the block at point. =0A= > =0A= > =0A= > So if you do c-u first before org-babel-tangle=2C it will only tangle the= code =0A= > block at point. =0A= > I use this a lot so I have the following in my init file: =0A= > =0A= > (defun org-babel-tangle-block() =0A= > (interactive) =0A= > (let ((current-prefix-arg '(4))) =0A= > (call-interactively 'org-babel-tangle))) =0A= > =0A= > (eval-after-load "org" =0A= > '(progn =0A= > (define-key org-mode-map (kbd "C-c b") 'org-babel-tangle-block))) =0A= > =0A= > =0A= > So I can just do C-c b and it will just tangle the code block at point. =0A= > =0A= > And I agree with you I with the manual =0A= > (http://orgmode.org/manual/Extracting-source-code.html) has this =0A= > information. =0A= > =0A= > Hope this helps=2C =0A= > Joon =0A= > =0A= =0A= = --_ea844735-f125-4fe8-ade2-b8883a9168b2_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
=0A= =0A= =0A=
>=3B Joon: thx this is great.=  =3B

You're welcome. =3B

>=3B one last question. suppose i have multiple code blocks under=  =3Bheader like this:
>=3B =3B
>=3B **** m= ain i3 conf
>=3B  =3B  =3B  =3B:PROPERTIES:
>=3B  =3B  =3B  =3B:ID:  =3B  =3B  =3B f17b551= 8-2695-4484-a958-2fc7b8aa2479
>=3B  =3B  =3B  =3B:t= angle:  =3B /home/zeltak/.i3/config
>=3B  =3B  =3B =  =3B:END:
>=3B  =3B  =3B
>=3B =3B
>=3B =3B
>=3B is there a way to issue a tangle j= ust for all below the header blocks?

Again i= f you read the help: =3B

 =3B  =3B When two universal prefix arguments=2C only= tangle blocks for the =3Btan= gle file of the block at point.

So if you g= ive two universal prefix arguments and issue org-babel-tangle while you are= at a code block with the tangle file =3B/home/zeltak/.i3/config=2C =3Bit will only tangle code blocks with that particular code bloc= k. 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-subt= ree` to narrow down to that subtree and and then just tangle the whole thin= g.

-Joon




On Sun=2C Jul 31=2C 2016 at 5:34 PM=2C Grant Rettke <= span dir=3D"ltr"><=3Bgcr@wisdomandwonder.com>=3B wrote:
You can `:tangle no' on the source block to exclude it from tangling.=
=0A=
=0A= You can even tangle one source block to a different or as many files
=0A= as you like during tangling.
=0A= Sincerely=2C
=0A=
=0A= Grant Rettke
=0A=

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

=0A=
= --_ea844735-f125-4fe8-ade2-b8883a9168b2_--