emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org link to OCaml comment
@ 2020-02-06 14:47 Alan Schmitt
  2020-02-06 14:58 ` John Kitchin
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2020-02-06 14:47 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I'm trying to create an org link to a specific place in an OCaml file. I
thought I would use some specific target in an OCaml comment, but it
does not work.

Here is an OCaml comment:

(* Object projection functions *)

Here is the link create by `org-store-link` (I put it here with no
description)

[[file:~/work/jsexplain/jsexplain/jsref/JsSyntax.ml::(* Object projection functions *)]]

When I try to follow this link, I get the following error (note the
missing parentheses):

org-open-file: No match for coderef: * Object projection functions *

and I am moved to the top of the file (instead of where I stored the
link).

Is there an escape problem here? And if so, is it a bug of
`org-store-link` of not doing the escaping?

Thanks,

Alan

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

* Re: org link to OCaml comment
  2020-02-06 14:47 org link to OCaml comment Alan Schmitt
@ 2020-02-06 14:58 ` John Kitchin
  2020-02-06 15:39   ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: John Kitchin @ 2020-02-06 14:58 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

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

I think you need to do it like this:


#+BEGIN_SRC test.ml -r

(* Object projection functions  *) (ref:opf)


#+END_SRC


[[file:2020-02-05.org::(opf)]]

The -r in the header removes the coderef when you run it.

John

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



On Thu, Feb 6, 2020 at 9:48 AM Alan Schmitt <alan.schmitt@polytechnique.org>
wrote:

> Hello,
>
> I'm trying to create an org link to a specific place in an OCaml file. I
> thought I would use some specific target in an OCaml comment, but it
> does not work.
>
> Here is an OCaml comment:
>
> (* Object projection functions *)
>
> Here is the link create by `org-store-link` (I put it here with no
> description)
>
> [[file:~/work/jsexplain/jsexplain/jsref/JsSyntax.ml::(* Object projection
> functions *)]]
>
> When I try to follow this link, I get the following error (note the
> missing parentheses):
>
> org-open-file: No match for coderef: * Object projection functions *
>
> and I am moved to the top of the file (instead of where I stored the
> link).
>
> Is there an escape problem here? And if so, is it a bug of
> `org-store-link` of not doing the escaping?
>
> Thanks,
>
> Alan
>
>

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

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

* Re: org link to OCaml comment
  2020-02-06 14:58 ` John Kitchin
@ 2020-02-06 15:39   ` Alan Schmitt
  2020-02-06 17:10     ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2020-02-06 15:39 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

Hello John,

On 2020-02-06 09:58, John Kitchin <jkitchin@andrew.cmu.edu> writes:

> I think you need to do it like this:
>
> #+BEGIN_SRC test.ml -r
>
> (* Object projection functions  *) (ref:opf)
>
>
> #+END_SRC
>
> [[file:2020-02-05.org::(opf)]]
>
> The -r in the header removes the coderef when you run it.

Thank you for the suggestion. Unfortunately I need to link to an
external ml file. I can change it, but I need to get a syntactically
valid file.

I tried putting the ref part inside the comment and unfortunately it
does not work.

The strange part is that linking to arbitrary code works. It seems that
the OCaml comment syntax is problematic here.

Best,

Alan

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

* Re: org link to OCaml comment
  2020-02-06 15:39   ` Alan Schmitt
@ 2020-02-06 17:10     ` Nicolas Goaziou
  2020-02-06 18:33       ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2020-02-06 17:10 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode, John Kitchin

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> The strange part is that linking to arbitrary code works. It seems that
> the OCaml comment syntax is problematic here.

Link enclosed within parens meant coderef links, i.e., the syntax is
reserved. You can probably remove the closing parenthesis to avoid this.

Regards,

-- 
Nicolas Goaziou

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

* Re: org link to OCaml comment
  2020-02-06 17:10     ` Nicolas Goaziou
@ 2020-02-06 18:33       ` Alan Schmitt
  2020-02-07 14:33         ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2020-02-06 18:33 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, John Kitchin

Hello Nicolas,

On 2020-02-06 18:10, Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Link enclosed within parens meant coderef links, i.e., the syntax is
> reserved. You can probably remove the closing parenthesis to avoid this.

Thank you for the explanation. Is there a way to either escape the
parentheses (maybe url-encode them), or to automatically not include the
closing one as you suggest when creating the link?

(I'm asking someone who does not know org-mode to document his code, use
links to point to the relevant code. I'm afraid it will be tricky to ask
him to tweak the links that org create so that they work.)

Thanks again,

Alan

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

* Re: org link to OCaml comment
  2020-02-06 18:33       ` Alan Schmitt
@ 2020-02-07 14:33         ` Nicolas Goaziou
  2020-02-07 15:25           ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2020-02-07 14:33 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode, John Kitchin

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Thank you for the explanation. Is there a way to either escape the
> parentheses (maybe url-encode them),

*shivers* Please never suggest again url-encoding links in Org! ;) We
only got out of this hell recently. I don't want to dive in again.

> or to automatically not include the closing one as you suggest when
> creating the link?

There is some specific syntax in links. More specifically, the
following are meaningful:

- a star at the beginning of the link (or search option)
- a hash at the beginning of the link
- forward slashes around the link
- parenthesis around the link

I think that `org-store-link' should be careful about it and prevent
these pathological cases if necessary.

In any other situation, however, I think the user is responsible for
not using these specific constructs.

WDYT?

Regards,

-- 
Nicolas Goaziou

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

* Re: org link to OCaml comment
  2020-02-07 14:33         ` Nicolas Goaziou
@ 2020-02-07 15:25           ` Alan Schmitt
  2020-02-19 17:49             ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2020-02-07 15:25 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, John Kitchin

On 2020-02-07 15:33, Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> *shivers* Please never suggest again url-encoding links in Org! ;) We
> only got out of this hell recently. I don't want to dive in again.

Sorry, I should have put a smiley there.

> There is some specific syntax in links. More specifically, the
> following are meaningful:
>
> - a star at the beginning of the link (or search option)
> - a hash at the beginning of the link
> - forward slashes around the link
> - parenthesis around the link
>
> I think that `org-store-link' should be careful about it and prevent
> these pathological cases if necessary.
>
> In any other situation, however, I think the user is responsible for
> not using these specific constructs.
>
> WDYT?

I understand, and I can be careful (and easily fix the link if needed).
If `org-store-link' could do it for me, that would be perfect.

Thanks again for the explanation.

Best,

Alan

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

* Re: org link to OCaml comment
  2020-02-07 15:25           ` Alan Schmitt
@ 2020-02-19 17:49             ` Nicolas Goaziou
  2020-02-20  8:20               ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2020-02-19 17:49 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode, John Kitchin

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> I understand, and I can be careful (and easily fix the link if needed).
> If `org-store-link' could do it for me, that would be perfect.

I pushed some changes to `org-store-link' in order to fix this.  Please
report if there is anything wrong.

Regards,

-- 
Nicolas Goaziou

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

* Re: org link to OCaml comment
  2020-02-19 17:49             ` Nicolas Goaziou
@ 2020-02-20  8:20               ` Alan Schmitt
  0 siblings, 0 replies; 9+ messages in thread
From: Alan Schmitt @ 2020-02-20  8:20 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, John Kitchin

On 2020-02-19 18:49, Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> I understand, and I can be careful (and easily fix the link if needed).
>> If `org-store-link' could do it for me, that would be perfect.
>
> I pushed some changes to `org-store-link' in order to fix this.  Please
> report if there is anything wrong.

Thanks a lot!

Best,

Alan

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

end of thread, other threads:[~2020-02-20  8:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 14:47 org link to OCaml comment Alan Schmitt
2020-02-06 14:58 ` John Kitchin
2020-02-06 15:39   ` Alan Schmitt
2020-02-06 17:10     ` Nicolas Goaziou
2020-02-06 18:33       ` Alan Schmitt
2020-02-07 14:33         ` Nicolas Goaziou
2020-02-07 15:25           ` Alan Schmitt
2020-02-19 17:49             ` Nicolas Goaziou
2020-02-20  8:20               ` Alan Schmitt

Code repositories for project(s) associated with this 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).