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:20:53 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11487df01bd0f6055eb48eab" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI7M9-0007D5-Od for emacs-orgmode@gnu.org; Fri, 24 Nov 2017 01:20:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eI7M8-0005YC-8x for emacs-orgmode@gnu.org; Fri, 24 Nov 2017 01:20:57 -0500 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:46912) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eI7M7-0005X6-UU for emacs-orgmode@gnu.org; Fri, 24 Nov 2017 01:20:56 -0500 Received: by mail-wm0-x22d.google.com with SMTP id u83so20408566wmb.5 for ; Thu, 23 Nov 2017 22:20:55 -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 --001a11487df01bd0f6055eb48eab Content-Type: text/plain; charset="UTF-8" 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 >> > > --001a11487df01bd0f6055eb48eab Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi again, i posted a separate issue on multiple code block= s in babel creating 1 config but then realized this actually is very approp= riate for this thread...apologize for that.

@Kaushal, th= e method you suggested works really well for 1 code block=3D1 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:

=C2=A0* tmux conf
=C2=A0:PROPERTIES:
=C2=A0= :header-args: :noweb yes=C2=A0 :tangle /zeltak@132.72.155.204:~/.tmux.conf<= /div>
=C2=A0:END:

***** 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=A0ba8ce7aa-2b3b-43be-816d-ea2ab515a999
= =C2=A0 =C2=A0 =C2=A0 :END:
#+BEGIN_SRC conf=C2=A0
#----= ---------->=C2=A0 mouse
setw -g mouse on
set-option = -g status-keys vi
#+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-a6df3afac= 1a5
=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 a= dd a name (#+NAME) argument that covers all the sub headers that will make = '.tmux.conf'.=C2=A0
and then using noweb how does o= ne reffer to that name <<tmux.conf>> that will cover all the ti= ny blocks that create the tmux.conf?

best!

Z

On Thu, Nov 23, 2017 at 8:16 AM, Xebar Saram <= span dir=3D"ltr"><zeltakc@gmail.com> wrote:
=
thx!

that works well for me :D

best and happy holidays :)

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

Hello

Im loo= king for a way to to mirror/auto populate a section of text in another loca= tion 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

#+BE= GIN_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 con= tent in the Org file itself.=C2=A0

But you can imp= lement that DRY model by using Noweb references (See the "Noweb refere= nce syntax" node in the Org manual).=C2=A0

Yo= u 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 = <<foo>>.=C2=A0

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

PS: For no= n-code mirroring (in exported files), there's also do:

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

(See the "Include files&= quot; node in the Org manual for more.)

--

Kaushal Modi



--001a11487df01bd0f6055eb48eab--