Re: [O] Feature proposal: Triple square brackets to create a link to a file AND include the file
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 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
Re: [O] Feature proposal: Triple square brackets to create a link to a file AND include the file
On Thu, Sep 27, 2018 at 11:03 AM Nicolas Goaziou wrote: > As I said, link syntax is inadequate here. I still think what Org > provides is enough. > +1. Also the proposed link syntax is too confusing with the existing and also for a very corner use case. And then we need to worry about fontifying those and existing links correctly, adding support to exporters, etc. Unrelated: @ST: btw also please update to the latest Org 9.1.x on maint branch or via Org Elpa. Version 8.x is too old.
Re: [O] Feature proposal: Triple square brackets to create a link to a file AND include the file
ST writes: > Aaa... I see. Actually I don't need it to be in the middle, only at > column 0. Then the link syntax is not adequate. What would you do if the triple bracket horror is on the middle of the line? > Starting with which version of Org? I have 8.2.10 and it doesn't seem to > work there... Not out of the box, but you can probably add a mouse event on INCLUDE keywords. And there's a function to visit the file already. >> Why do you need something else if there is already a way to do what you >> want? I'm not a big fan of extending syntax gratuitously. > > Well, triple square brackets is shorter and cleaner for wiki purposes... > I don't mind it to be able to include files only at column 0, it's > totally OK. As I said, link syntax is inadequate here. I still think what Org provides is enough.
Re: [O] Feature proposal: Triple square brackets to create a link to a file AND include the file
Hello, ST writes: > What do you mean by "inlined"? Roughly, I mean "located within a paragraph". > During an export such a link > [[[dir/file]]] should be replaced with the content of the "file", and > the link itself disappear. But in the source .org file it is just > shorter/cleaner way to write > > #+INCLUDE: "dir/file" This is different. It is easier to insert text at column 0 than at a random position in a line. You cannot do the latter in Org. > and be able to click the link to open the file in a separate buffer. This is already possible. > Why shouldn't it be possible to achieve just the same by ALSO clicking > on the URI? If you use .org files as a wiki - this feature is quite > useful. Why do you need something else if there is already a way to do what you want? I'm not a big fan of extending syntax gratuitously. Regards, -- Nicolas Goaziou0x80A93738
Re: [O] Feature proposal: Triple square brackets to create a link to a file AND include the file
> > What do you mean by "inlined"? > > Roughly, I mean "located within a paragraph". > > > During an export such a link > > [[[dir/file]]] should be replaced with the content of the "file", and > > the link itself disappear. But in the source .org file it is just > > shorter/cleaner way to write > > > > #+INCLUDE: "dir/file" > > This is different. It is easier to insert text at column 0 than at > a random position in a line. You cannot do the latter in Org. Aaa... I see. Actually I don't need it to be in the middle, only at column 0. > > and be able to click the link to open the file in a separate buffer. > > This is already possible. Starting with which version of Org? I have 8.2.10 and it doesn't seem to work there... > > > Why shouldn't it be possible to achieve just the same by ALSO clicking > > on the URI? If you use .org files as a wiki - this feature is quite > > useful. > > Why do you need something else if there is already a way to do what you > want? I'm not a big fan of extending syntax gratuitously. Well, triple square brackets is shorter and cleaner for wiki purposes... I don't mind it to be able to include files only at column 0, it's totally OK. Regards.
Re: [O] Feature proposal: Triple square brackets to create a link to a file AND include the file
On Thu, 2018-09-27 at 13:58 +0200, Nicolas Goaziou wrote: > Hello, > > ST writes: > > > 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? > > This does not make sense: include files are not meant to be inlined. > Links are. What do you mean by "inlined"? During an export such a link [[[dir/file]]] should be replaced with the content of the "file", and the link itself disappear. But in the source .org file it is just shorter/cleaner way to write #+INCLUDE: "dir/file" and be able to click the link to open the file in a separate buffer. > > > Or maybe there is already something like this, if yes > > - how can I achieve the same? > > Use `C-c '` on a file. Why shouldn't it be possible to achieve just the same by ALSO clicking on the URI? If you use .org files as a wiki - this feature is quite useful. Thank you!
Re: [O] Feature proposal: Triple square brackets to create a link to a file AND include the file
Hello, ST writes: > 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? This does not make sense: include files are not meant to be inlined. Links are. > Or maybe there is already something like this, if yes > - how can I achieve the same? Use `C-c '` on a file. Regards, -- Nicolas Goaziou