From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: mirror text in same/other org buffer Date: Wed, 22 Nov 2017 11:40:35 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="089e08264bb060ad96055e90ca58" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHTOf-0000H4-Tk for emacs-orgmode@gnu.org; Wed, 22 Nov 2017 06:40:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHTOa-0007Ro-9O for emacs-orgmode@gnu.org; Wed, 22 Nov 2017 06:40:53 -0500 Received: from mail-yb0-x236.google.com ([2607:f8b0:4002:c09::236]:46324) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHTOa-0007Ri-3n for emacs-orgmode@gnu.org; Wed, 22 Nov 2017 06:40:48 -0500 Received: by mail-yb0-x236.google.com with SMTP id 188so5755477ybd.13 for ; Wed, 22 Nov 2017 03:40:47 -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: Xebar Saram Cc: emacs-org list --089e08264bb060ad96055e90ca58 Content-Type: text/plain; charset="UTF-8" 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 --089e08264bb060ad96055e90ca58 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Nov 22, 2017, 4:55 AM X= ebar Saram <zeltakc@gmail.com&g= t; wrote:
Hi alll<= /div>

Hello

= Im looking for a way to to mirror/auto popul= ate a section of text in another location in the same org buffer and/or oth= er org file.

for example, i manage my = config files in org mode for multiple machines. i want to have a section li= ke this

#+BEGIN_SRC conf :mkdirp yes :tangle ~/mac= hine 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
<= div>CODE
#+END_SRC

is this in anyway pos= sible?

You cannot h= ave real-time mirroring of content in the Org file itself.=C2=A0
=
But you can implement that DRY model by using Noweb referenc= es (See the "Noweb reference syntax" node in the Org manual).=C2= =A0

You can put the CODE in a separate src block w= ith :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 bu= ffer. But you will see the mirroring done in the exported files.=C2=A0

PS: For non-code mirroring (in exported files), there&= #39;s also do:

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

(Se= e the "Include files" node in the Org manual for more.)

--

Kaushal Modi

--089e08264bb060ad96055e90ca58--