emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: ST <smntov@gmail.com>
Cc: Emacs-orgmode@gnu.org
Subject: Re: Feature proposal: Triple square brackets to create a link to a file AND include the file
Date: Thu, 27 Sep 2018 12:55:51 -0400	[thread overview]
Message-ID: <m2ftxuev6w.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <1538048127.1873.26.camel@gmail.com>

You can get essentially what you want with a custom org-link in org-9 or
later.

#+BEGIN_SRC emacs-lisp
(org-link-set-parameters
 "wiki"
 :follow (lambda (path) (find-file path))
 :export (lambda (path description backend)
	   ;; do this for all exports
	   (with-temp-buffer
	     (insert-file-contents path)
	     (buffer-string))))
#+END_SRC

If you need extra syntax to support the lines below, see
http://kitchingroup.cheme.cmu.edu/blog/2015/02/05/Extending-the-org-mode-link-syntax-with-attributes/
for an approach to do that with the existing link syntax, so it might
look like:

[[wiki:dir/file :lines "5-10"]]

This link is clickable and inserts the file at the link point in the
export.



ST <smntov@gmail.com> writes:

> Hello,
>
> it would be nice to be able to make URIs to INCLUDEd files clickable. In
> order to make them also lightweight, readable and corresponding to
> current link syntax, I would suggest the following:
>
> [[[dir/file]]]
> [[[dir/file]] :lines "5-10"]
> [[[dir/file][My file]] :lines "5-10"]
>
> as clickable, including links.
>
> What do you think? Or maybe there is already something like this, if yes
> - how can I achieve the same?
>
> Thank you!


--
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

      parent reply	other threads:[~2018-09-27 16:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 11:35 Feature proposal: Triple square brackets to create a link to a file AND include the file ST
2018-09-27 11:58 ` Nicolas Goaziou
2018-09-27 12:18   ` ST
     [not found]     ` <87k1n7jeuk.fsf@nicolasgoaziou.fr>
2018-09-27 14:08       ` ST
2018-09-27 15:02         ` Nicolas Goaziou
2018-09-27 15:11           ` Kaushal Modi
2018-09-27 14:54     ` Nicolas Goaziou
2018-09-27 16:55 ` John Kitchin [this message]

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ftxuev6w.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=Emacs-orgmode@gnu.org \
    --cc=smntov@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).