emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Feature proposal: Triple square brackets to create a link to a file AND include the file
@ 2018-09-27 11:35 ST
  2018-09-27 11:58 ` Nicolas Goaziou
  2018-09-27 16:55 ` John Kitchin
  0 siblings, 2 replies; 8+ messages in thread
From: ST @ 2018-09-27 11:35 UTC (permalink / raw)
  To: Emacs-orgmode

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!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature proposal: Triple square brackets to create a link to a file AND include the file
  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
  2018-09-27 16:55 ` John Kitchin
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2018-09-27 11:58 UTC (permalink / raw)
  To: ST; +Cc: Emacs-orgmode

Hello,

ST <smntov@gmail.com> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature proposal: Triple square brackets to create a link to a file AND include the file
  2018-09-27 11:58 ` Nicolas Goaziou
@ 2018-09-27 12:18   ` ST
       [not found]     ` <87k1n7jeuk.fsf@nicolasgoaziou.fr>
  2018-09-27 14:54     ` Nicolas Goaziou
  0 siblings, 2 replies; 8+ messages in thread
From: ST @ 2018-09-27 12:18 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Emacs-orgmode

On Thu, 2018-09-27 at 13:58 +0200, Nicolas Goaziou wrote:
> Hello,
> 
> ST <smntov@gmail.com> 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!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature proposal: Triple square brackets to create a link to a file AND include the file
       [not found]     ` <87k1n7jeuk.fsf@nicolasgoaziou.fr>
@ 2018-09-27 14:08       ` ST
  2018-09-27 15:02         ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: ST @ 2018-09-27 14:08 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Emacs-orgmode


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature proposal: Triple square brackets to create a link to a file AND include the file
  2018-09-27 12:18   ` ST
       [not found]     ` <87k1n7jeuk.fsf@nicolasgoaziou.fr>
@ 2018-09-27 14:54     ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2018-09-27 14:54 UTC (permalink / raw)
  To: ST; +Cc: Emacs-orgmode

Hello,

ST <smntov@gmail.com> 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 Goaziou                                                0x80A93738

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature proposal: Triple square brackets to create a link to a file AND include the file
  2018-09-27 14:08       ` ST
@ 2018-09-27 15:02         ` Nicolas Goaziou
  2018-09-27 15:11           ` Kaushal Modi
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2018-09-27 15:02 UTC (permalink / raw)
  To: ST; +Cc: Emacs-orgmode

ST <smntov@gmail.com> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature proposal: Triple square brackets to create a link to a file AND include the file
  2018-09-27 15:02         ` Nicolas Goaziou
@ 2018-09-27 15:11           ` Kaushal Modi
  0 siblings, 0 replies; 8+ messages in thread
From: Kaushal Modi @ 2018-09-27 15:11 UTC (permalink / raw)
  To: ST, emacs-org list

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

On Thu, Sep 27, 2018 at 11:03 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
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.

[-- Attachment #2: Type: text/html, Size: 837 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature proposal: Triple square brackets to create a link to a file AND include the file
  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 16:55 ` John Kitchin
  1 sibling, 0 replies; 8+ messages in thread
From: John Kitchin @ 2018-09-27 16:55 UTC (permalink / raw)
  To: ST; +Cc: Emacs-orgmode

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-09-27 16:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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