From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: mirror text in same/other org buffer Date: Fri, 24 Nov 2017 08:30:14 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11491a5e85d7d3055eb4afac" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI7VD-0001Lh-2V for emacs-orgmode@gnu.org; Fri, 24 Nov 2017 01:30:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eI7VB-0005CH-2X for emacs-orgmode@gnu.org; Fri, 24 Nov 2017 01:30:18 -0500 Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]:33582) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eI7VA-00059v-FT for emacs-orgmode@gnu.org; Fri, 24 Nov 2017 01:30:16 -0500 Received: by mail-wr0-x231.google.com with SMTP id 55so3100536wrx.0 for ; Thu, 23 Nov 2017 22:30:16 -0800 (PST) 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: Kaushal Modi Cc: emacs-org list --001a11491a5e85d7d3055eb4afac Content-Type: text/plain; charset="UTF-8" Ok found the answer "hidden" away in a org manual page.. :) The solution it so to use ':noweb-ref NAME' as an argument in the drawer sorry for the noise Z On Fri, Nov 24, 2017 at 8:20 AM, Xebar Saram wrote: > Hi again, i posted a separate issue on multiple code blocks in babel > creating 1 config but then realized this actually is very appropriate for > this thread...apologize for that. > > @Kaushal, the method you suggested works really well for 1 code block=1 > config file. but what happens when my config file is made out of 1 few > babel code blocks that i tangle together into 1 config file. for example: > > * tmux conf > :PROPERTIES: > :header-args: :noweb yes :tangle /zeltak@132.72.155.204:~/.tmux.conf > :END: > > ***** Mouse > :PROPERTIES: > :ID: ba8ce7aa-2b3b-43be-816d-ea2ab515a999 > :END: > #+BEGIN_SRC conf > #--------------> mouse > setw -g mouse on > set-option -g status-keys vi > #+END_SRC > > ***** Theme and look > :PROPERTIES: > :ID: 85257f51-1306-4caf-a055-a6df3afac1a5 > :END: > #+BEGIN_SRC conf > #--------------> THEME AND LOOK > #default theme picker > source /home/zeltak/.tmux/neonB > #source /home/zeltak/.tmux/solarized-dark > #+END_SRC > > how do i add a name (#+NAME) argument that covers all the sub headers that > will make '.tmux.conf'. > and then using noweb how does one reffer to that name <> that > will cover all the tiny blocks that create the tmux.conf? > > best! > > Z > > > On Thu, Nov 23, 2017 at 8:16 AM, Xebar Saram wrote: > >> thx! >> >> that works well for me :D >> >> best and happy holidays :) >> >> Z >> >> On Wed, Nov 22, 2017 at 1:40 PM, Kaushal Modi >> wrote: >> >>> On Wed, Nov 22, 2017, 4:55 AM Xebar Saram wrote: >>> >>>> Hi alll >>>> >>> >>> Hello >>> >>> Im looking for a way to to mirror/auto populate a section of text in >>>> another location in the same org buffer and/or other org file. >>>> >>>> for example, i manage my config files in org mode for multiple >>>> machines. i want to have a section like this >>>> >>>> #+BEGIN_SRC conf :mkdirp yes :tangle ~/machine A >>>> CODE >>>> #+END_SRC >>>> where the same content of CODE is mirroed/auto generated in another >>>> code block for machine B >>>> >>>> #+BEGIN_SRC conf :mkdirp yes :tangle ~/machine B >>>> CODE >>>> #+END_SRC >>>> >>>> is this in anyway possible? >>>> >>> >>> You cannot have real-time mirroring of content in the Org file itself. >>> >>> But you can implement that DRY model by using Noweb references (See the >>> "Noweb reference syntax" node in the Org manual). >>> >>> You can put the CODE in a separate src block with :noweb-ref set to foo, >>> and then wherever in other code blocks you want to mirror that, you simply >>> put <>. >>> >>> As I said you won't see the mirroring happen live in the Org buffer. But >>> you will see the mirroring done in the exported files. >>> >>> PS: For non-code mirroring (in exported files), there's also do: >>> >>> #+INCLUDE: "./can-be-same-file.org::#CUSTOM_ID" :only-contents t >>> >>> (See the "Include files" node in the Org manual for more.) >>> >>> -- >>> >>> Kaushal Modi >>> >> >> > --001a11491a5e85d7d3055eb4afac Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ok found the ans= wer "hidden" away in a org manual page.. :)

The solution it so to use ':noweb-ref NAME' as= an argument in the drawer

= sorry for the noise

Z

On F= ri, Nov 24, 2017 at 8:20 AM, Xebar Saram <zeltakc@gmail.com>= wrote:
Hi again, i post= ed a separate issue on multiple code blocks in babel creating 1 config but = then realized this actually is very appropriate for this thread...apologize= for that.

@Kaushal, the method you suggested works real= ly well for 1 code block=3D1 config file. but what happens when my config f= ile is made out of 1 few babel code blocks that i tangle together into 1 co= nfig file. for example:

=C2=A0* tmux conf
=C2=A0:PROPERTIES:
=C2=A0:header-args: :noweb yes=C2=A0 :t= angle /zeltak@132.72.155.204:~/.tmux.conf
=C2=A0:END:
<= div>
***** Mouse=C2=A0=C2=A0
=C2=A0 =C2=A0 =C2=A0 := PROPERTIES:
=C2=A0 =C2=A0 =C2=A0 :ID:=C2=A0 =C2=A0 =C2=A0 =C2=A0b= a8ce7aa-2b3b-43be-816d-ea2ab515a999
=C2=A0 =C2=A0 =C2=A0 :EN= D:
#+BEGIN_SRC conf=C2=A0
#-------------->=C2=A0 mou= se
setw -g mouse on
set-option -g status-keys vi
<= div>#+END_SRC

***** Theme and look
=C2= =A0 =C2=A0 =C2=A0 :PROPERTIES:
=C2=A0 =C2=A0 =C2=A0 :ID:=C2=A0 = =C2=A0 =C2=A0 =C2=A085257f51-1306-4caf-a055-a6df3afac1a5
=C2= =A0 =C2=A0 =C2=A0 :END:
#+BEGIN_SRC conf=C2=A0
#-------= -------> THEME AND LOOK
#default theme picker
source= /home/zeltak/.tmux/neonB
#source /home/zeltak/.tmux/solarized-dark
#+END_SRC

how do i add a name (#= +NAME) argument that covers all the sub headers that will make '.tmux.c= onf'.=C2=A0
and then using noweb how does one reffer to= that name <<tmux.conf>> that will cover all the tiny blocks th= at create the tmux.conf?

best!

Z

<= div class=3D"gmail_extra">
On Thu, Nov 23, 20= 17 at 8:16 AM, Xebar Saram <zeltakc@gmail.com> wrote:
thx!

that w= orks well for me :D

best and happy holidays :)

Z

On Wed, Nov 22, 2017 at 1:40 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
On Wed, Nov 22, 2017, 4:55= AM Xebar Saram <= zeltakc@gmail.com> wrote:
Hi alll

Hello

Im looking for = a way to to mirror/auto populate a section of text in another location in t= he same org buffer and/or other org file.

<= div>for example, i manage my config files in org mode for multiple machines= . i want to have a section like this

#+BEGIN_SRC c= onf :mkdirp yes :tangle ~/machine A
CODE
#+END_SRC
where the same content of CODE is mirroed/auto generated in another c= ode block for machine B

#+BEGIN_SRC conf :mkdirp y= es :tangle ~/machine B
CODE
#+END_SRC

is this in anyway possible?

You cannot have real-time mirroring of content in t= he Org file itself.=C2=A0

But you can implement th= at DRY model by using Noweb references (See the "Noweb reference synta= x" node in the Org manual).=C2=A0

You can put= the CODE in a separate src block with :noweb-ref set to foo, and then wher= ever in other code blocks you want to mirror that, you simply put <<f= oo>>.=C2=A0

As I said you won't see the = mirroring happen live in the Org buffer. But you will see the mirroring don= e in the exported files.=C2=A0

PS: For non-code mi= rroring (in exported files), there's also do:

= =C2=A0 #+INCLUDE: "./can-be-same-file.org::#CUSTOM_ID" :only= -contents t

(See the "Include files" nod= e in the Org manual for more.)

--

Kaushal Modi




--001a11491a5e85d7d3055eb4afac--