From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: transcluding some org-elements in multiple places Date: Fri, 09 Dec 2016 10:29:15 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cFN7w-0006tN-RW for emacs-orgmode@gnu.org; Fri, 09 Dec 2016 10:30:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cFN7r-0004qr-1G for emacs-orgmode@gnu.org; Fri, 09 Dec 2016 10:30:24 -0500 Received: from mail-qk0-f171.google.com ([209.85.220.171]:33879) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cFN7q-0004qf-TD for emacs-orgmode@gnu.org; Fri, 09 Dec 2016 10:30:18 -0500 Received: by mail-qk0-f171.google.com with SMTP id q130so20597946qke.1 for ; Fri, 09 Dec 2016 07:30:18 -0800 (PST) Received: from johns-air.wv.cc.cmu.edu (Johns-Air.wv.cc.cmu.edu. [128.237.221.176]) by smtp.gmail.com with ESMTPSA id m30sm20055292qta.7.2016.12.09.07.29.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Dec 2016 07:29:17 -0800 (PST) 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: Org Mode Mailing List Hi all, I have an idea for how I could transclude "copies" or links to org-elements in multiple places and keep them up to date. A prototypical example of this is I have a set of org-contacts in one place, and I want to create a new list of people for a committee in a new place made of "copies" of the contact headlines. But I do not really want to duplicate the headlines, and if I modify one, I want it reflected in the other places. I do not want just links to those contacts, because then I can not do things with org-map-entries, and other org-machinery which needs the actual headlines/properties present. Another example might be I want a table in two places, but the contents of them should stay synchronized, ditto for a code block. This idea was inspired by https://github.com/gregdetre/emacs-freex. The idea starts with creating (wait for it...) a new link ;) In a document where I want to transclude a headline, I would enter something like: [[transclude:some-file.org::*headline title]] Then, I would rely on the font-lock system to replace that link with the headline and its contents (via the :activate-func link property), and to put an overlay on it with a bunch of useful properties, including modification hooks that would update the source if I change the the element in this document, and some visual indication that it is transcluded (e.g. light gray background/tooltip). I would create a kill-buffer hook function that would replace that transcluded content with the original link. A focus-in hook function would make sure the transcluded content is updated when you enter the frame. So when the file is not open, there is just a transclude link indicating what should be put there, and when it is open, the overlay modification hooks and focus hook should ensure everything stays synchronized (as long as external processes are not modifying the contents). It seems like this could work well for headlines, and named tables, src blocks, and probably any other element that can be addressed by a name/ID. Any thoughts? Do you see any potential issues? -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu