From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: mirror text in same/other org buffer Date: Thu, 23 Nov 2017 08:16:53 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a113c1806eb5272055ea061c8" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHkoi-0003O1-FC for emacs-orgmode@gnu.org; Thu, 23 Nov 2017 01:16:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHkoh-0004Jn-H8 for emacs-orgmode@gnu.org; Thu, 23 Nov 2017 01:16:56 -0500 Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]:35848) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHkoh-0004Iz-76 for emacs-orgmode@gnu.org; Thu, 23 Nov 2017 01:16:55 -0500 Received: by mail-wr0-x236.google.com with SMTP id y42so16608104wrd.3 for ; Wed, 22 Nov 2017 22:16: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 --001a113c1806eb5272055ea061c8 Content-Type: text/plain; charset="UTF-8" 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 > --001a113c1806eb5272055ea061c8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
thx!

that works well for me :D

best and happy holidays :)

Z

On Wed, No= v 22, 2017 at 1:40 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
<= div dir=3D"ltr">On Wed, Nov 22, 2017, 4:55 AM Xebar Saram <zeltakc@gmail.com> wrote:<= br>
Hi alll

Hello

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

for example, i man= age my config files in org mode for multiple machines. i want to have a sec= tion like this

#+BEGIN_SRC conf :mkdirp yes :tangl= e ~/machine A
CODE
#+END_SRC
where the same c= ontent 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 any= way possible?

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

But you can implement that DRY model by using = Noweb references (See the "Noweb reference syntax" node in the Or= g manual).=C2=A0

You can put the CODE in a separat= e src block with :noweb-ref set to foo, and then wherever in other code blo= cks 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 mirroring done in the exported file= s.=C2=A0

PS: For non-code mirroring (in exported f= iles), there's also do:

=C2=A0 #+INCLUDE: &quo= t;./can-be-same-file.org::#CUSTOM_ID" :only-contents t
=
(See the "Include files" node in the Org manual fo= r more.)

--

Kaushal Modi


--001a113c1806eb5272055ea061c8--