emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-store-link on document title
@ 2023-06-28 19:31 Anthony Carrico
  2023-06-28 19:56 ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Anthony Carrico @ 2023-06-28 19:31 UTC (permalink / raw)
  To: emacs-orgmode

On 6/28/23 12:48, Ihor Radchenko wrote:
 > I cannot reproduce.
 > Please provide more details and report this under a different email
 > subject, so that we can easily distinguish the two bugs.
 > See https://orgmode.org/manual/Feedback.html#Feedback

Ah, very sorry for the distraction on the "This link has already been 
stored" issue.

I'll describe the behavior I observe, and a more useful behavior. I'm 
not sure this constitutes an actual bug, since org-store-link isn't 
documented to work on the title line of a document.

Org mode version 9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)
GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, 
cairo version 1.17.6) of 2023-01-02

To duplicate:

Create file test.org as in this example:
#+begin_example
#+TITLE: test org title link
#+end_example

1. go to title line of test.org, and do org-store link: 'C-c l'
2. go to new file test2.org, and do org-insert-link: 'C-c C-l M-p <RET>'

Here is the actual file test2.org produced by this method:
#+begin_example
[[file:test.org::+TITLE: test org title link]]
#+end_example

This isn't great because there is no description.

1. Expected file test2.org:
#+begin_example
[[file:test.org::+TITLE: test org title link][test org title link]]
#+end_example

Or even better:

2. Desired file test2.org:
#+begin_example
[[file:test.org][test org title link]]
#+end_example

Here the title is used as the description, and the file itself is 
linked, rather than the title line.

The second option makes more sense to me. Why? Because at the title line 
I intend to store a link to the document labeled with the title, and at 
a headline I intend to store a link to a section of the document labeled 
with the headline.

This option also produces cleaner html output (at least a few years 
ago--see org mailing list around 2020-08-06 with subject "ISSUE: Unable 
to resolve link (html export)").

-- 
Anthony Carrico


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

* Re: [BUG] org-store-link on document title
  2023-06-28 19:31 [BUG] org-store-link on document title Anthony Carrico
@ 2023-06-28 19:56 ` Ihor Radchenko
  2023-06-28 20:05   ` Anthony Carrico
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-06-28 19:56 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

Anthony Carrico <acarrico@memebeam.org> writes:

> To duplicate:
>
> Create file test.org as in this example:
> #+begin_example
> #+TITLE: test org title link
> #+end_example
>
> 1. go to title line of test.org, and do org-store link: 'C-c l'
> 2. go to new file test2.org, and do org-insert-link: 'C-c C-l M-p <RET>'
>
> Here is the actual file test2.org produced by this method:
> #+begin_example
> [[file:test.org::+TITLE: test org title link]]
> #+end_example
>
> This isn't great because there is no description.

Org does not know if you want to store link to file or to this specific
line. The current default is trying to store link to current line,
stripping "#" to disambiguate from custom ID search string.
See 4.8 Search Options in File Links

> 1. Expected file test2.org:
> #+begin_example
> [[file:test.org::+TITLE: test org title link][test org title link]]
> #+end_example
>
> Or even better:
>
> 2. Desired file test2.org:
> #+begin_example
> [[file:test.org][test org title link]]
> #+end_example

You can set `org-id-link-to-org-use-id' to non-nil (4.5 Handling Links).
Then, Org will store link to current file/heading instead of more
generic link. Latest version of Org will also auto-assign TITLE as the
link description.

Canceled.
You may consider sending patch for Org manual if you think that we can
do a better job describing how Org handles links.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-store-link on document title
  2023-06-28 19:56 ` Ihor Radchenko
@ 2023-06-28 20:05   ` Anthony Carrico
  2023-06-28 20:16     ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Anthony Carrico @ 2023-06-28 20:05 UTC (permalink / raw)
  To: emacs-orgmode

On 6/28/23 15:56, Ihor Radchenko wrote:
> Latest version of Org will also auto-assign TITLE as the
> link description.

Nice, sound like this issue is already fixed. Looking forward to the 
upgrade.

--
Anthony Carrico



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

* Re: [BUG] org-store-link on document title
  2023-06-28 20:05   ` Anthony Carrico
@ 2023-06-28 20:16     ` Ihor Radchenko
  2023-06-29 13:06       ` Anthony Carrico
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-06-28 20:16 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

Anthony Carrico <acarrico@memebeam.org> writes:

> On 6/28/23 15:56, Ihor Radchenko wrote:
>> Latest version of Org will also auto-assign TITLE as the
>> link description.
>
> Nice, sound like this issue is already fixed. Looking forward to the 
> upgrade.

It has been added back in Org 9.5.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-store-link on document title
  2023-06-28 20:16     ` Ihor Radchenko
@ 2023-06-29 13:06       ` Anthony Carrico
  2023-06-29 13:20         ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Anthony Carrico @ 2023-06-29 13:06 UTC (permalink / raw)
  To: emacs-orgmode

On 6/28/23 16:16, Ihor Radchenko wrote:> It has been added back in Org 9.5.

Thanks, I'm on 9.5.5, so I can test it...

> You can set `org-id-link-to-org-use-id' to non-nil (4.5 Handling Links).
> Then, Org will store link to current file/heading instead of more
> generic link. Latest version of Org will also auto-assign TITLE as the
> link description.

#+begin_example
:PROPERTIES:
:ID:       5f4cdb46-d18d-41bb-914e-da7faa177772
:END:
#+TITLE: test org title link
#+end_example

#+begin_example
[[id:5f4cdb46-d18d-41bb-914e-da7faa177772][test org title link]]
#+end_example

...hmm, you are correct that this option does add the proper default 
description, but this is not a just plain file link anymore.

-- 
Anthony Carrico


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

* Re: [BUG] org-store-link on document title
  2023-06-29 13:06       ` Anthony Carrico
@ 2023-06-29 13:20         ` Ihor Radchenko
  2023-06-29 15:43           ` Anthony Carrico
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-06-29 13:20 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

Anthony Carrico <acarrico@memebeam.org> writes:

> #+begin_example
> [[id:5f4cdb46-d18d-41bb-914e-da7faa177772][test org title link]]
> #+end_example
>
> ...hmm, you are correct that this option does add the proper default 
> description, but this is not a just plain file link anymore.

Sure. And if it were a plain file link, there would be no reason to
assign TITLE as description. Because the link would be to a generic line
in file.

That said, existence of hard-coded parts of `org-store-link' are not
ideal. We should ideally make things more flexible. Patches welcome!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-store-link on document title
  2023-06-29 13:20         ` Ihor Radchenko
@ 2023-06-29 15:43           ` Anthony Carrico
  2023-06-29 15:54             ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Anthony Carrico @ 2023-06-29 15:43 UTC (permalink / raw)
  To: emacs-orgmode

On 6/29/23 09:20, Ihor Radchenko wrote:
> Sure. And if it were a plain file link, there would be no reason to
> assign TITLE as description. Because the link would be to a generic line
> in file.

What? The title is the perfect description for the file!

I would say that 90% of the links in my org notes are file links with 
the title as the description. I tend to use *deft* to search a lot of 
small pages without deep outlines.

-- 
Anthony Carrico



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

* Re: [BUG] org-store-link on document title
  2023-06-29 15:43           ` Anthony Carrico
@ 2023-06-29 15:54             ` Ihor Radchenko
  2023-06-29 16:11               ` Anthony Carrico
  2023-07-14 11:59               ` Max Nikulin
  0 siblings, 2 replies; 10+ messages in thread
From: Ihor Radchenko @ 2023-06-29 15:54 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

Anthony Carrico <acarrico@memebeam.org> writes:

> On 6/29/23 09:20, Ihor Radchenko wrote:
>> Sure. And if it were a plain file link, there would be no reason to
>> assign TITLE as description. Because the link would be to a generic line
>> in file.
>
> What? The title is the perfect description for the file!

That's because you expect Org to create a link to file.
But what Org does (by default) is a link to specific _line_ in file.

> I would say that 90% of the links in my org notes are file links with 
> the title as the description. I tend to use *deft* to search a lot of 
> small pages without deep outlines.

You can set :store property for "file" links in `org-link-parameters' to
adjust for your personal use case.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-store-link on document title
  2023-06-29 15:54             ` Ihor Radchenko
@ 2023-06-29 16:11               ` Anthony Carrico
  2023-07-14 11:59               ` Max Nikulin
  1 sibling, 0 replies; 10+ messages in thread
From: Anthony Carrico @ 2023-06-29 16:11 UTC (permalink / raw)
  To: emacs-orgmode

On 6/29/23 11:54, Ihor Radchenko wrote:
> You can set :store property for "file" links in `org-link-parameters' to
> adjust for your personal use case.
That is good advice.

-- 
Anthony Carrico




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

* Re: [BUG] org-store-link on document title
  2023-06-29 15:54             ` Ihor Radchenko
  2023-06-29 16:11               ` Anthony Carrico
@ 2023-07-14 11:59               ` Max Nikulin
  1 sibling, 0 replies; 10+ messages in thread
From: Max Nikulin @ 2023-07-14 11:59 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

On 29/06/2023 22:54, Ihor Radchenko wrote:
> Anthony Carrico writes:
> 
>> On 6/29/23 09:20, Ihor Radchenko wrote:
>>> Sure. And if it were a plain file link, there would be no reason to
>>> assign TITLE as description. Because the link would be to a generic line
>>> in file.
>>
>> What? The title is the perfect description for the file!
> 
> That's because you expect Org to create a link to file.
> But what Org does (by default) is a link to specific _line_ in file.

I find expectation to use the title property reasonable. Text search 
links are not created for lines after first heading. Current behavior is 
not documented and (if I understand it correctly) was introduced in

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=12c09be3a
2020-02-19 18:03:53 +0100 Nicolas Goaziou: Refactor context part in file 
links

However there is a number of unit tests, so it was certainly an intended 
change.

So my vote is for [[file:document.org][title property]] when the 
document has at least on heading.


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

end of thread, other threads:[~2023-07-14 12:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-28 19:31 [BUG] org-store-link on document title Anthony Carrico
2023-06-28 19:56 ` Ihor Radchenko
2023-06-28 20:05   ` Anthony Carrico
2023-06-28 20:16     ` Ihor Radchenko
2023-06-29 13:06       ` Anthony Carrico
2023-06-29 13:20         ` Ihor Radchenko
2023-06-29 15:43           ` Anthony Carrico
2023-06-29 15:54             ` Ihor Radchenko
2023-06-29 16:11               ` Anthony Carrico
2023-07-14 11:59               ` Max Nikulin

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