From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Matt Price <moptop99@gmail.com>
Cc: David Talmage <david.talmage@shoutpoint.com>,
Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: transcluding some org-elements in multiple places
Date: Thu, 05 Jan 2017 11:37:55 -0500 [thread overview]
Message-ID: <m2a8b5tqcc.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <CAN_Dec8OkZ3tYEkGaWb-YW3Veo-u=COqrMgBoAD_EcmmBKJ4OA@mail.gmail.com>
I played with it a bit. Here is a link that displays file links as
overlays. Clicking on them jump to the source, and C-click will toggle
the overlay. It works ok, but I didn't test it a lot.
Say you have a table named like this in a file.
#+name: test
| 555 | 66 |
| te | tef |
| 555 | ftre 5f |
| 555 | ftre 5f |
This link will display the table.
transclude:file:transcluding-org-elements.org::test
This link will display the headline named archive.
transclude:file:transcluding-org-elements.org::*archive
Here is the code.
#+BEGIN_SRC emacs-lisp :results silent
(defvar *transclude* t "Put overlays on or not")
(setq *transclude* t)
(org-link-set-parameters
"transclude"
:face '(:background "gray80")
:follow (lambda (path)
(org-open-link-from-string path))
:keymap (let ((map (copy-keymap org-mouse-map)))
(define-key map [C-mouse-1] (lambda ()
(interactive)
(setq *transclude* (not *transclude*))
(unless *transclude*
(ov-clear 'transclude))
(font-lock-fontify-buffer)))
map)
:help-echo "Transcluded element. Click to open source. C-mouse-1 to toggle overlay."
:activate-func (lambda (start end path bracketp)
(if *transclude*
(let ((ov (make-overlay start end))
el disp)
(ov-put ov 'transclude t)
(save-window-excursion
(org-open-link-from-string path)
(setq el (org-element-context))
(setq disp (buffer-substring
(org-element-property :begin el)
(- (org-element-property :end el)
(or (org-element-property :post-blank el) 0))))
(ov-put ov 'display disp)))
(ov-clear 'transclude 'any start end))))
#+END_SRC
Matt Price writes:
> On Wed, Dec 14, 2016 at 11:55 AM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>>
>> David Talmage writes:
>>
>> > On Fri, Dec 9, 2016 at 11:28 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>> >
>> >> On Friday, 9 Dec 2016 at 15:29, John Kitchin wrote:
>> >> > Hi all,
>> >> >
>> >> > I have an idea for how I could transclude "copies" or links to
>> >>
>> >> [...]
>> >>
>> >> > Any thoughts? Do you see any potential issues?
>> >>
>> >> Potentially very interesting and useful idea. Some thoughts/issues:
>> >>
>> >>
>> > I'm interested in this, too. In my lab notebook org file, I have a
>> section
>> > that should be put into its own file and either linked or transcluded in
>> > several places. Transclusion would be better because I could see the
>> text
>> > without following a link. It suits my lazy nature. ;-)
>>
>> It turns out to be pretty easy to see the text; that can be done with a
>> simple overlay. What is not easy, is to be able to edit the text, or use
>> the text with org-machinery, e.g. org-map-entries. The text in the
>> overlay is not visible to the org-machinery, so you can not get
>> properties, edit it, etc... Editing could be made possible with a
>> special buffer, but it doesn't seem likely that you can make the overlay
>> display work with many org-functions.
>>
> Have you had an opportunity to work o nthis at all? For my purposes, even
> having the transcluded text visible in a buffer + included in an export
> would be a major improvement over, say, a link. attempting to edit would,
> I guess, pop up a special narrowed buffer that edits the original text.
> Those 3 features together would cover maybe 90% of what I personally need,
> so if you have the code for this, I would really love to see it. Thank you!
>
> Matt
--
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
next prev parent reply other threads:[~2017-01-05 16:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3d4bfe3d30ae4c5a8be905fa6b15f350@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-12-09 16:28 ` transcluding some org-elements in multiple places Eric S Fraga
2016-12-14 15:55 ` David Talmage
2016-12-14 16:55 ` John Kitchin
2017-01-05 13:26 ` Matt Price
2017-01-05 16:37 ` John Kitchin [this message]
[not found] ` <CAN_Dec8C386-+mNODfrXZkMpoRt30xEUkjSMCZDOhpi-ydRDeg@mail.gmail.com>
[not found] ` <m2zij5qbci.fsf@Johns-MacBook-Air.local>
2017-01-06 2:17 ` Matt Price
2017-01-06 2:19 ` John Kitchin
2017-01-06 14:30 ` Matt Price
2016-12-09 15:29 John Kitchin
2016-12-16 0:26 ` Matt Price
2016-12-16 16:51 ` Matt Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2a8b5tqcc.fsf@andrew.cmu.edu \
--to=jkitchin@andrew.cmu.edu \
--cc=david.talmage@shoutpoint.com \
--cc=emacs-orgmode@gnu.org \
--cc=moptop99@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.