emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* what is the purpose of "This link has already been stored"?
@ 2023-06-28  1:35 Samuel Wales
  2023-06-28  9:32 ` Ihor Radchenko
  2023-07-01  4:48 ` org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?) Max Nikulin
  0 siblings, 2 replies; 52+ messages in thread
From: Samuel Wales @ 2023-06-28  1:35 UTC (permalink / raw)
  To: emacs-orgmode

in maint and bugfix i frequently do org-store-link on a
heading that has a properties drawer with an id in it.

my intent is to store it so that i can paste the link later
with org-insert-link.

i frequently get "This link has already been
stored".  perhaps this is meant to teach me that i can find
it in org-insert-link?  there are 2 problems with that for
me in practice:

1) i want to store it anyway so i can use the
   mindless store-insert combination.
2) org-insert-link, with my ido setup, and i am aware other
   completion mechanisms exist but find it difficult to
   switch, offers as completion candidates a completely
   useless list.

   idk how to show you the list but it looks kinda sorta like this:
     id:2134123-11234123-41234123--12341
     eww:
     gnus:
     ...
     id:44242423-23452-345-234-523452-345
     ...

   as there is no description and the presumably useful ids
   are near te bottom it is useless to try to use
   org-insert-link.  so idk what the solution is.

   i tried setting (setq org-link-make-description-function
   t) but that made no noticeable difference.  i am probably
   doing somethign wrong someplace.  i hope using ido is ok.
   i'd switch to vertico if i could get it closer to my ido.

   what i woul dlike to see is, for there to be no
   error/warning in org-store-link, and for org-insert-link
   to show me link descriptions and maybe id also.

   ideas?

   thanks.


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: what is the purpose of "This link has already been stored"?
  2023-06-28  1:35 what is the purpose of "This link has already been stored"? Samuel Wales
@ 2023-06-28  9:32 ` Ihor Radchenko
  2023-06-28 16:19   ` Anthony Carrico
  2023-06-28 23:59   ` Samuel Wales
  2023-07-01  4:48 ` org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?) Max Nikulin
  1 sibling, 2 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-06-28  9:32 UTC (permalink / raw)
  To: Samuel Wales, Bastien; +Cc: emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> in maint and bugfix i frequently do org-store-link on a
> heading that has a properties drawer with an id in it.
>
> ...
> i frequently get "This link has already been
> stored".  perhaps this is meant to teach me that i can find
> it in org-insert-link?  there are 2 problems with that for
> me in practice:
>
> 1) i want to store it anyway so i can use the
>    mindless store-insert combination.

This behaviour has been introduced in bb61b37ee

bb61b37ee223fd89cf951a5fbf62e35e606a4646
Author:     Bastien <bzg@gnu.org>
AuthorDate: Thu Dec 5 17:11:26 2019 +0100
ol.el: Don't store the same link twice

* lisp/ol.el (org-store-link): Don't store the same link twice.

I think that it will make a lot more sense to move the link in front of
the stored link list instead of just printing the message.

Bastien, others: any objections? (another possibility could be a
defcustom, but I cannot find how the current behaviour is useful for
anyone).

> 2) org-insert-link, with my ido setup, and i am aware other
>    completion mechanisms exist but find it difficult to
>    switch, offers as completion candidates a completely
>    useless list.
>
>    idk how to show you the list but it looks kinda sorta like this:
>      id:2134123-11234123-41234123--12341
>      eww:
>      gnus:
>      ...
>      id:44242423-23452-345-234-523452-345
>      ...
>
>    as there is no description and the presumably useful ids
>    are near te bottom it is useless to try to use
>    org-insert-link.  so idk what the solution is.

The descriptions are displayed in *Org Links* buffer.
The completing-read call could, however, be improved to display link
descriptions as well. 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] 52+ messages in thread

* Re: what is the purpose of "This link has already been stored"?
  2023-06-28  9:32 ` Ihor Radchenko
@ 2023-06-28 16:19   ` Anthony Carrico
  2023-06-28 16:48     ` Ihor Radchenko
  2023-06-28 23:59   ` Samuel Wales
  1 sibling, 1 reply; 52+ messages in thread
From: Anthony Carrico @ 2023-06-28 16:19 UTC (permalink / raw)
  To: emacs-orgmode

I agree that the current behavior is useless, and I agree that a good 
default would be to bring the link to the front of the list.

Storing the link is also currently somewhat buggy. I almost always link 
to the top of the page (the title), and org creates a table entry which 
looks like this:

<no description> <file:~/org/notes/2023-06-28T090115.org::+TITLE: Ref: 
Abstract Syntax Graphs for Domain Specific Languages>

Creating a link like this:

[[file:2023-06-24T161646.org::+TITLE: Ref: Functional Programming with 
Structured Graphs]]

Unfortunately the link doesn't automatically get a sensible default 
description. This would be a better table entry:

Ref: Abstract Syntax Graphs for Domain Specific Languages 
<file:~/org/notes/2023-06-28T090115.org>

Creating a link like this:

[[file:2023-06-24T161646.org][Ref: Functional Programming with 
Structured Graphs]]

I always do this transformation manually when creating links to my pages.

I'm in the habit of stripping the title from the link, because such 
links didn't used to work, maybe due to the pound sign, but apparently 
they are currently working, as I just discovered.

-- 
Anthony Carrico



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

* Re: what is the purpose of "This link has already been stored"?
  2023-06-28 16:19   ` Anthony Carrico
@ 2023-06-28 16:48     ` Ihor Radchenko
  0 siblings, 0 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-06-28 16:48 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

Anthony Carrico <acarrico@memebeam.org> writes:

> Storing the link is also currently somewhat buggy. I almost always link 
> to the top of the page (the title), and org creates a table entry which 
> looks like this:
>
> <no description> <file:~/org/notes/2023-06-28T090115.org::+TITLE: Ref: 
> Abstract Syntax Graphs for Domain Specific Languages>

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

-- 
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] 52+ messages in thread

* Re: what is the purpose of "This link has already been stored"?
  2023-06-28  9:32 ` Ihor Radchenko
  2023-06-28 16:19   ` Anthony Carrico
@ 2023-06-28 23:59   ` Samuel Wales
  2023-06-29  0:04     ` Samuel Wales
  1 sibling, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-06-28 23:59 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs-orgmode

On 6/28/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> This behaviour has been introduced in bb61b37ee
>
> bb61b37ee223fd89cf951a5fbf62e35e606a4646
> Author:     Bastien <bzg@gnu.org>
> AuthorDate: Thu Dec 5 17:11:26 2019 +0100
> ol.el: Don't store the same link twice
>
> * lisp/ol.el (org-store-link): Don't store the same link twice.

thanks for traking down.

>
> I think that it will make a lot more sense to move the link in front of
> the stored link list instead of just printing the message.

good idea.  after all you most recently stored it, duplicate or no.

>>      id:2134123-11234123-41234123--12341
>>      eww:
>>      gnus:
>>      ...
>>      id:44242423-23452-345-234-523452-345
>>      ...
>>
>>    as there is no description and the presumably useful ids
>>    are near te bottom it is useless to try to use
>>    org-insert-link.  so idk what the solution is.
>
> The descriptions are displayed in *Org Links* buffer.

all i see is the org buffer and the minibuffer.  perhaps for
accessibility reasons i made it so that i don't see an org links
bufer.  i maximize everything and one window where possibel.

idk what geeral use links buffer woul be in practice, but it wouln't
work for me.  orig, mini, and links buffers would be too small, frame
maximized.

> The completing-read call could, however, be improved to display link
> descriptions as well. Patches welcome!

sounds good but idk.  ido did ussed to do things like put files in
parens, although i removed that nad only have the basename heading in
my ido lists for olpaths for clarity.  but idk if ido integrates well
enough to work with such a fix or not.

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


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: what is the purpose of "This link has already been stored"?
  2023-06-28 23:59   ` Samuel Wales
@ 2023-06-29  0:04     ` Samuel Wales
  2023-06-29  0:07       ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-06-29  0:04 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs-orgmode

that is, if completing-read is changed, idk if ido will work with it
well or not  idk if proposed fix means

- include id and description in orig list for selection
- include id and description is for marginalia
- user selects description and id is returned
- another change

just showing the basename headings [or whatever has an org id] wold
wfm but there are probably other considerations.

at least, as long as the inserted link mainains the mapping of id with
description.

On 6/28/23, Samuel Wales <samologist@gmail.com> wrote:
> On 6/28/23, Ihor Radchenko <yantar92@posteo.net> wrote:
>> This behaviour has been introduced in bb61b37ee
>>
>> bb61b37ee223fd89cf951a5fbf62e35e606a4646
>> Author:     Bastien <bzg@gnu.org>
>> AuthorDate: Thu Dec 5 17:11:26 2019 +0100
>> ol.el: Don't store the same link twice
>>
>> * lisp/ol.el (org-store-link): Don't store the same link twice.
>
> thanks for traking down.
>
>>
>> I think that it will make a lot more sense to move the link in front of
>> the stored link list instead of just printing the message.
>
> good idea.  after all you most recently stored it, duplicate or no.
>
>>>      id:2134123-11234123-41234123--12341
>>>      eww:
>>>      gnus:
>>>      ...
>>>      id:44242423-23452-345-234-523452-345
>>>      ...
>>>
>>>    as there is no description and the presumably useful ids
>>>    are near te bottom it is useless to try to use
>>>    org-insert-link.  so idk what the solution is.
>>
>> The descriptions are displayed in *Org Links* buffer.
>
> all i see is the org buffer and the minibuffer.  perhaps for
> accessibility reasons i made it so that i don't see an org links
> bufer.  i maximize everything and one window where possibel.
>
> idk what geeral use links buffer woul be in practice, but it wouln't
> work for me.  orig, mini, and links buffers would be too small, frame
> maximized.
>
>> The completing-read call could, however, be improved to display link
>> descriptions as well. Patches welcome!
>
> sounds good but idk.  ido did ussed to do things like put files in
> parens, although i removed that nad only have the basename heading in
> my ido lists for olpaths for clarity.  but idk if ido integrates well
> enough to work with such a fix or not.
>
>>
>> --
>> 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>
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: what is the purpose of "This link has already been stored"?
  2023-06-29  0:04     ` Samuel Wales
@ 2023-06-29  0:07       ` Samuel Wales
  2023-06-29 10:28         ` Ihor Radchenko
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-06-29  0:07 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs-orgmode

i am not sure i am using store/insert to their full actual or
potential potential.

if you move the recent one to top of list, that would work for my
mindless store/insert, but it might not work for a user who has
carefully cultivated a set of links that are all to be inserted, or
such.  although idk if the mechanism supports.

On 6/28/23, Samuel Wales <samologist@gmail.com> wrote:
> that is, if completing-read is changed, idk if ido will work with it
> well or not  idk if proposed fix means
>
> - include id and description in orig list for selection
> - include id and description is for marginalia
> - user selects description and id is returned
> - another change
>
> just showing the basename headings [or whatever has an org id] wold
> wfm but there are probably other considerations.
>
> at least, as long as the inserted link mainains the mapping of id with
> description.
>
> On 6/28/23, Samuel Wales <samologist@gmail.com> wrote:
>> On 6/28/23, Ihor Radchenko <yantar92@posteo.net> wrote:
>>> This behaviour has been introduced in bb61b37ee
>>>
>>> bb61b37ee223fd89cf951a5fbf62e35e606a4646
>>> Author:     Bastien <bzg@gnu.org>
>>> AuthorDate: Thu Dec 5 17:11:26 2019 +0100
>>> ol.el: Don't store the same link twice
>>>
>>> * lisp/ol.el (org-store-link): Don't store the same link twice.
>>
>> thanks for traking down.
>>
>>>
>>> I think that it will make a lot more sense to move the link in front of
>>> the stored link list instead of just printing the message.
>>
>> good idea.  after all you most recently stored it, duplicate or no.
>>
>>>>      id:2134123-11234123-41234123--12341
>>>>      eww:
>>>>      gnus:
>>>>      ...
>>>>      id:44242423-23452-345-234-523452-345
>>>>      ...
>>>>
>>>>    as there is no description and the presumably useful ids
>>>>    are near te bottom it is useless to try to use
>>>>    org-insert-link.  so idk what the solution is.
>>>
>>> The descriptions are displayed in *Org Links* buffer.
>>
>> all i see is the org buffer and the minibuffer.  perhaps for
>> accessibility reasons i made it so that i don't see an org links
>> bufer.  i maximize everything and one window where possibel.
>>
>> idk what geeral use links buffer woul be in practice, but it wouln't
>> work for me.  orig, mini, and links buffers would be too small, frame
>> maximized.
>>
>>> The completing-read call could, however, be improved to display link
>>> descriptions as well. Patches welcome!
>>
>> sounds good but idk.  ido did ussed to do things like put files in
>> parens, although i removed that nad only have the basename heading in
>> my ido lists for olpaths for clarity.  but idk if ido integrates well
>> enough to work with such a fix or not.
>>
>>>
>>> --
>>> 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>
>>>
>>
>>
>> --
>> The Kafka Pandemic
>>
>> A blog about science, health, human rights, and misopathy:
>> https://thekafkapandemic.blogspot.com
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: what is the purpose of "This link has already been stored"?
  2023-06-29  0:07       ` Samuel Wales
@ 2023-06-29 10:28         ` Ihor Radchenko
  2023-06-29 13:02           ` Anthony Carrico
  0 siblings, 1 reply; 52+ messages in thread
From: Ihor Radchenko @ 2023-06-29 10:28 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Bastien, emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> i am not sure i am using store/insert to their full actual or
> potential potential.
>
> if you move the recent one to top of list, that would work for my
> mindless store/insert, but it might not work for a user who has
> carefully cultivated a set of links that are all to be inserted, or
> such.  although idk if the mechanism supports.

Makes sense. It is a +1 for a defcustom.
Although I still believe that we should change the current default, even
if leaving an option to fall back to previous behaviour.

-- 
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] 52+ messages in thread

* Re: what is the purpose of "This link has already been stored"?
  2023-06-29 10:28         ` Ihor Radchenko
@ 2023-06-29 13:02           ` Anthony Carrico
  2023-06-29 13:09             ` Ihor Radchenko
  0 siblings, 1 reply; 52+ messages in thread
From: Anthony Carrico @ 2023-06-29 13:02 UTC (permalink / raw)
  To: emacs-orgmode

On 6/29/23 06:28, Ihor Radchenko wrote:
> Samuel Wales <samologist@gmail.com> writes:
>> if you move the recent one to top of list, that would work for my
>> mindless store/insert, but it might not work for a user who has
>> carefully cultivated a set of links that are all to be inserted, or
>> such.  although idk if the mechanism supports.
> 
> Makes sense. It is a +1 for a defcustom.
> Although I still believe that we should change the current default, even
> if leaving an option to fall back to previous behaviour.

I don't think there is much reason to complicate the interface with a 
defcustom. The current default is an error, so changing the default 
doesn't break the workflow of anyone using it the way Samuel describes 
(unless I'm missing something).

-- 
Anthony Carrico



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

* Re: what is the purpose of "This link has already been stored"?
  2023-06-29 13:02           ` Anthony Carrico
@ 2023-06-29 13:09             ` Ihor Radchenko
  2023-06-30  3:00               ` Samuel Wales
  2023-07-05 10:19               ` [PATCH] " Ihor Radchenko
  0 siblings, 2 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-06-29 13:09 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

Anthony Carrico <acarrico@memebeam.org> writes:

>> Makes sense. It is a +1 for a defcustom.
>> Although I still believe that we should change the current default, even
>> if leaving an option to fall back to previous behaviour.
>
> I don't think there is much reason to complicate the interface with a 
> defcustom. The current default is an error, so changing the default 
> doesn't break the workflow of anyone using it the way Samuel describes 
> (unless I'm missing something).

What Samuel described is a sequence of M-x org-store-link followed by
M-x org-insert-all-links. With such workflow, user can expect that the
links are going to be stored in order. If we are instead shuffle the
stored links, M-x org-insert-all-links may result in unexpected
behaviour.

Currently, when link to place is already stored, not error is thrown, a
message is displayed, no link is stored, and the stored link list is not
altered.

-- 
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] 52+ messages in thread

* Re: what is the purpose of "This link has already been stored"?
  2023-06-29 13:09             ` Ihor Radchenko
@ 2023-06-30  3:00               ` Samuel Wales
  2023-06-30  3:26                 ` Samuel Wales
  2023-07-05 10:19               ` [PATCH] " Ihor Radchenko
  1 sibling, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-06-30  3:00 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

although i just store and insert now, i'd also welcome the ability to
collect links from various places and have them someplace like a
register where they can be pasted all at once.  or even edit the list
in the register, clear it, etc.


On 6/29/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> Anthony Carrico <acarrico@memebeam.org> writes:
>
>>> Makes sense. It is a +1 for a defcustom.
>>> Although I still believe that we should change the current default, even
>>> if leaving an option to fall back to previous behaviour.
>>
>> I don't think there is much reason to complicate the interface with a
>> defcustom. The current default is an error, so changing the default
>> doesn't break the workflow of anyone using it the way Samuel describes
>> (unless I'm missing something).
>
> What Samuel described is a sequence of M-x org-store-link followed by
> M-x org-insert-all-links. With such workflow, user can expect that the
> links are going to be stored in order. If we are instead shuffle the
> stored links, M-x org-insert-all-links may result in unexpected
> behaviour.
>
> Currently, when link to place is already stored, not error is thrown, a
> message is displayed, no link is stored, and the stored link list is not
> altered.
>
> --
> 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>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: what is the purpose of "This link has already been stored"?
  2023-06-30  3:00               ` Samuel Wales
@ 2023-06-30  3:26                 ` Samuel Wales
  0 siblings, 0 replies; 52+ messages in thread
From: Samuel Wales @ 2023-06-30  3:26 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

or to [/mere brainstorm alert/] get really fancy, to be able to mark a
place where links are to be inserted [perhas to become a plain list or
so] then collect llinks from all over, then hit store and they all go
to the place you marked.  crash-proof.


On 6/29/23, Samuel Wales <samologist@gmail.com> wrote:
> although i just store and insert now, i'd also welcome the ability to
> collect links from various places and have them someplace like a
> register where they can be pasted all at once.  or even edit the list
> in the register, clear it, etc.
>
>
> On 6/29/23, Ihor Radchenko <yantar92@posteo.net> wrote:
>> Anthony Carrico <acarrico@memebeam.org> writes:
>>
>>>> Makes sense. It is a +1 for a defcustom.
>>>> Although I still believe that we should change the current default,
>>>> even
>>>> if leaving an option to fall back to previous behaviour.
>>>
>>> I don't think there is much reason to complicate the interface with a
>>> defcustom. The current default is an error, so changing the default
>>> doesn't break the workflow of anyone using it the way Samuel describes
>>> (unless I'm missing something).
>>
>> What Samuel described is a sequence of M-x org-store-link followed by
>> M-x org-insert-all-links. With such workflow, user can expect that the
>> links are going to be stored in order. If we are instead shuffle the
>> stored links, M-x org-insert-all-links may result in unexpected
>> behaviour.
>>
>> Currently, when link to place is already stored, not error is thrown, a
>> message is displayed, no link is stored, and the stored link list is not
>> altered.
>>
>> --
>> 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>
>>
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-06-28  1:35 what is the purpose of "This link has already been stored"? Samuel Wales
  2023-06-28  9:32 ` Ihor Radchenko
@ 2023-07-01  4:48 ` Max Nikulin
  2023-07-01  5:15   ` Samuel Wales
  1 sibling, 1 reply; 52+ messages in thread
From: Max Nikulin @ 2023-07-01  4:48 UTC (permalink / raw)
  To: emacs-orgmode

On 28/06/2023 08:35, Samuel Wales wrote:
> 2) org-insert-link, with my ido setup, and i am aware other
>     completion mechanisms exist but find it difficult to
>     switch, offers as completion candidates a completely
>     useless list.

The Org version in the Anthony's report is 9.5. Samuel, could you, 
please, confirm that you use at least Org-9.6? It contains a number of 
fixes related to `org-store-link' and `org-insert-link' including a 
change related to completion by description.

Is it realistic for you to try the default completion function (emacs -q 
and load newer Org) instead of ido? I mean namely completion by 
description ignoring selection from the links buffer.

There is a number of issues with this pair of functions, however 
completion by description should work to some extent.



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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-01  4:48 ` org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?) Max Nikulin
@ 2023-07-01  5:15   ` Samuel Wales
  2023-07-01  5:26     ` Samuel Wales
  2023-07-01  6:12     ` Max Nikulin
  0 siblings, 2 replies; 52+ messages in thread
From: Samuel Wales @ 2023-07-01  5:15 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

yes, 9.6.7 has the bug as i described it, at least with my window and ido setup.

emacs -q 9.6.7, vaniila except for whatever -q loads, opens a links
window that shows descrtipition and truncated link.  idk what you do
to select.  idk what it does with completion setups.

one problem is  this means a 2 window setup.  i use VERY large fonts
and basically never have a 2 window setup even for completions.  i
spent 20y kludging emacs to get rid of other window stuff and still
there re many places where it creeps in [occur-like buffers are a big
one].  the new [years old actally] window mechanism might improvbe on
it in principle but i am not in a position to try that atm.  idk if it
would work with my ido setup.  and if it did all technically work idk
if the result would be accessible for me wrt window sizes.


On 6/30/23, Max Nikulin <manikulin@gmail.com> wrote:
> On 28/06/2023 08:35, Samuel Wales wrote:
>> 2) org-insert-link, with my ido setup, and i am aware other
>>     completion mechanisms exist but find it difficult to
>>     switch, offers as completion candidates a completely
>>     useless list.
>
> The Org version in the Anthony's report is 9.5. Samuel, could you,
> please, confirm that you use at least Org-9.6? It contains a number of
> fixes related to `org-store-link' and `org-insert-link' including a
> change related to completion by description.
>
> Is it realistic for you to try the default completion function (emacs -q
> and load newer Org) instead of ido? I mean namely completion by
> description ignoring selection from the links buffer.
>
> There is a number of issues with this pair of functions, however
> completion by description should work to some extent.
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-01  5:15   ` Samuel Wales
@ 2023-07-01  5:26     ` Samuel Wales
  2023-07-01  6:12     ` Max Nikulin
  1 sibling, 0 replies; 52+ messages in thread
From: Samuel Wales @ 2023-07-01  5:26 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

i guess i expected completion to show only description with recently
saved at top.  if i want, i can also select by ido's flex, c-spc,
arrow keys, etc.  ido is already set up for accessibility for me and
is used all the time for other purposes.

then there is the opportunity for fanciness with sets of links
gathered and pasted in one place.  i haven't considred what i would
need or what is possible there.  except the crash-proof editing and
register ideas which are almost orthogonal.


On 6/30/23, Samuel Wales <samologist@gmail.com> wrote:
> yes, 9.6.7 has the bug as i described it, at least with my window and ido
> setup.
>
> emacs -q 9.6.7, vaniila except for whatever -q loads, opens a links
> window that shows descrtipition and truncated link.  idk what you do
> to select.  idk what it does with completion setups.
>
> one problem is  this means a 2 window setup.  i use VERY large fonts
> and basically never have a 2 window setup even for completions.  i
> spent 20y kludging emacs to get rid of other window stuff and still
> there re many places where it creeps in [occur-like buffers are a big
> one].  the new [years old actally] window mechanism might improvbe on
> it in principle but i am not in a position to try that atm.  idk if it
> would work with my ido setup.  and if it did all technically work idk
> if the result would be accessible for me wrt window sizes.
>
>
> On 6/30/23, Max Nikulin <manikulin@gmail.com> wrote:
>> On 28/06/2023 08:35, Samuel Wales wrote:
>>> 2) org-insert-link, with my ido setup, and i am aware other
>>>     completion mechanisms exist but find it difficult to
>>>     switch, offers as completion candidates a completely
>>>     useless list.
>>
>> The Org version in the Anthony's report is 9.5. Samuel, could you,
>> please, confirm that you use at least Org-9.6? It contains a number of
>> fixes related to `org-store-link' and `org-insert-link' including a
>> change related to completion by description.
>>
>> Is it realistic for you to try the default completion function (emacs -q
>> and load newer Org) instead of ido? I mean namely completion by
>> description ignoring selection from the links buffer.
>>
>> There is a number of issues with this pair of functions, however
>> completion by description should work to some extent.
>>
>>
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-01  5:15   ` Samuel Wales
  2023-07-01  5:26     ` Samuel Wales
@ 2023-07-01  6:12     ` Max Nikulin
  2023-07-02  3:29       ` Max Nikulin
  1 sibling, 1 reply; 52+ messages in thread
From: Max Nikulin @ 2023-07-01  6:12 UTC (permalink / raw)
  To: emacs-orgmode

On 01/07/2023 12:15, Samuel Wales wrote:
> emacs -q 9.6.7, vaniila except for whatever -q loads, opens a links
> window that shows descrtipition and truncated link.

Ignore the links window and try to type first letter of a link 
description and TAB.



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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-01  6:12     ` Max Nikulin
@ 2023-07-02  3:29       ` Max Nikulin
  2023-07-02  5:02         ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Max Nikulin @ 2023-07-02  3:29 UTC (permalink / raw)
  To: emacs-orgmode

On 01/07/2023 13:12, Max Nikulin wrote:
> On 01/07/2023 12:15, Samuel Wales wrote:
>> emacs -q 9.6.7, vaniila except for whatever -q loads, opens a links
>> window that shows descrtipition and truncated link.
> 
> Ignore the links window and try to type first letter of a link 
> description and TAB.

...and TAB once more to make the completions window appeared. If default 
completion works then it is necessary to debug ido and customization to 
realize why data passed by `org-insert-link' is not enough for ido in 
your case.




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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-02  3:29       ` Max Nikulin
@ 2023-07-02  5:02         ` Samuel Wales
  2023-07-02  5:52           ` Max Nikulin
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-02  5:02 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

another window would not work for me but using completion as i do with
e.g. refile goto would.

On 7/1/23, Max Nikulin <manikulin@gmail.com> wrote:
> On 01/07/2023 13:12, Max Nikulin wrote:
>> On 01/07/2023 12:15, Samuel Wales wrote:
>>> emacs -q 9.6.7, vaniila except for whatever -q loads, opens a links
>>> window that shows descrtipition and truncated link.
>>
>> Ignore the links window and try to type first letter of a link
>> description and TAB.
>
> ...and TAB once more to make the completions window appeared. If default
> completion works then it is necessary to debug ido and customization to
> realize why data passed by `org-insert-link' is not enough for ido in
> your case.
>
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-02  5:02         ` Samuel Wales
@ 2023-07-02  5:52           ` Max Nikulin
  2023-07-02  6:03             ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Max Nikulin @ 2023-07-02  5:52 UTC (permalink / raw)
  To: emacs-orgmode

On 02/07/2023 12:02, Samuel Wales wrote:
> another window would not work for me but using completion as i do with
> e.g. refile goto would.

Samuel, you claimed that completion by description does not work for 
`org-insert-link'. I expect that it is fixed in Org-9.6 since I do not 
see the issue with the default completion. It is the reason why I asked 
you to confirm that *default completion* works for you as well. I 
suspect that the cause of your problem is either ido or your customization.

I see no connection of `org-refile' and `org-goto' with the code in 
`org-insert-link'.



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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-02  5:52           ` Max Nikulin
@ 2023-07-02  6:03             ` Samuel Wales
  2023-07-03 14:56               ` Max Nikulin
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-02  6:03 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

there is not supposed to be any connection between org refile or org
goto with the code in org insert link.

completion works to select ol paths for org refile and also for org
refile when it is doing goto.  i just want the same for links.

On 7/1/23, Max Nikulin <manikulin@gmail.com> wrote:
> On 02/07/2023 12:02, Samuel Wales wrote:
>> another window would not work for me but using completion as i do with
>> e.g. refile goto would.
>
> Samuel, you claimed that completion by description does not work for
> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do not
> see the issue with the default completion. It is the reason why I asked
> you to confirm that *default completion* works for you as well. I
> suspect that the cause of your problem is either ido or your customization.
>
> I see no connection of `org-refile' and `org-goto' with the code in
> `org-insert-link'.
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-02  6:03             ` Samuel Wales
@ 2023-07-03 14:56               ` Max Nikulin
  2023-07-03 23:28                 ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Max Nikulin @ 2023-07-03 14:56 UTC (permalink / raw)
  To: emacs-orgmode

On 02/07/2023 13:03, Samuel Wales wrote:
> there is not supposed to be any connection between org refile or org
> goto with the code in org insert link.
> 
> completion works to select ol paths for org refile and also for org
> refile when it is doing goto.  i just want the same for links.

I am giving up my attempts to clarify a possible issue with completion 
by description in `org-insert-link'. It works for me.

> On 7/1/23, Max Nikulin wrote:
>> On 02/07/2023 12:02, Samuel Wales wrote:
>>> another window would not work for me but using completion as i do with
>>> e.g. refile goto would.
>>
>> Samuel, you claimed that completion by description does not work for
>> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do not
>> see the issue with the default completion. It is the reason why I asked
>> you to confirm that *default completion* works for you as well. I
>> suspect that the cause of your problem is either ido or your customization.
>>
>> I see no connection of `org-refile' and `org-goto' with the code in
>> `org-insert-link'.




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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-03 14:56               ` Max Nikulin
@ 2023-07-03 23:28                 ` Samuel Wales
  2023-07-03 23:42                   ` Samuel Wales
  2023-07-03 23:48                   ` Samuel Wales
  0 siblings, 2 replies; 52+ messages in thread
From: Samuel Wales @ 2023-07-03 23:28 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
completion imnibuffer.  not useful for me.

On 7/3/23, Max Nikulin <manikulin@gmail.com> wrote:
> On 02/07/2023 13:03, Samuel Wales wrote:
>> there is not supposed to be any connection between org refile or org
>> goto with the code in org insert link.
>>
>> completion works to select ol paths for org refile and also for org
>> refile when it is doing goto.  i just want the same for links.
>
> I am giving up my attempts to clarify a possible issue with completion
> by description in `org-insert-link'. It works for me.
>
>> On 7/1/23, Max Nikulin wrote:
>>> On 02/07/2023 12:02, Samuel Wales wrote:
>>>> another window would not work for me but using completion as i do with
>>>> e.g. refile goto would.
>>>
>>> Samuel, you claimed that completion by description does not work for
>>> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do not
>>> see the issue with the default completion. It is the reason why I asked
>>> you to confirm that *default completion* works for you as well. I
>>> suspect that the cause of your problem is either ido or your
>>> customization.
>>>
>>> I see no connection of `org-refile' and `org-goto' with the code in
>>> `org-insert-link'.
>
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-03 23:28                 ` Samuel Wales
@ 2023-07-03 23:42                   ` Samuel Wales
  2023-07-03 23:48                   ` Samuel Wales
  1 sibling, 0 replies; 52+ messages in thread
From: Samuel Wales @ 2023-07-03 23:42 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

my reading was:

s> another window would not work for me but using completion as i do
with e.g. refile goto would

m> try again

s> creates another window.  ergo not work for me.

in fact, it is worse than that for me.  with my fonts, the links
window shows nothing useful on screen.  it is boilerplate.  orig is
smaller.  completion window -- not minibuffer -- shows bbdb: doi: and
other useless things.  the link i want to dinsert does not show in
either.  i would have to remember the link description then enter
that.  and learn a ew compoetion mechanism just for this one case?
not sure what you mean here  minibuffer says link.  unfamiliar
interface no flex no vertical no default of most recent stored.

On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
> completion imnibuffer.  not useful for me.
>
> On 7/3/23, Max Nikulin <manikulin@gmail.com> wrote:
>> On 02/07/2023 13:03, Samuel Wales wrote:
>>> there is not supposed to be any connection between org refile or org
>>> goto with the code in org insert link.
>>>
>>> completion works to select ol paths for org refile and also for org
>>> refile when it is doing goto.  i just want the same for links.
>>
>> I am giving up my attempts to clarify a possible issue with completion
>> by description in `org-insert-link'. It works for me.
>>
>>> On 7/1/23, Max Nikulin wrote:
>>>> On 02/07/2023 12:02, Samuel Wales wrote:
>>>>> another window would not work for me but using completion as i do with
>>>>> e.g. refile goto would.
>>>>
>>>> Samuel, you claimed that completion by description does not work for
>>>> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do not
>>>> see the issue with the default completion. It is the reason why I asked
>>>> you to confirm that *default completion* works for you as well. I
>>>> suspect that the cause of your problem is either ido or your
>>>> customization.
>>>>
>>>> I see no connection of `org-refile' and `org-goto' with the code in
>>>> `org-insert-link'.
>>
>>
>>
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-03 23:28                 ` Samuel Wales
  2023-07-03 23:42                   ` Samuel Wales
@ 2023-07-03 23:48                   ` Samuel Wales
  2023-07-03 23:49                     ` Samuel Wales
  1 sibling, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-03 23:48 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

scratch the expanded thing.

it ends up showing orig smaller less useful, links uselessly
boilerplate, completions -- 3 windows!  and a terse minibuffer i
wouldn't be able to use.  -q.  i cannot use such a ui.

in contrast, what i expected is orig, and then expanded minibuffer
with, instead of doi: and so on, has useful links as descriotions.
only 1 window, if you don't count minibuffer.

On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
> completion imnibuffer.  not useful for me.
>
> On 7/3/23, Max Nikulin <manikulin@gmail.com> wrote:
>> On 02/07/2023 13:03, Samuel Wales wrote:
>>> there is not supposed to be any connection between org refile or org
>>> goto with the code in org insert link.
>>>
>>> completion works to select ol paths for org refile and also for org
>>> refile when it is doing goto.  i just want the same for links.
>>
>> I am giving up my attempts to clarify a possible issue with completion
>> by description in `org-insert-link'. It works for me.
>>
>>> On 7/1/23, Max Nikulin wrote:
>>>> On 02/07/2023 12:02, Samuel Wales wrote:
>>>>> another window would not work for me but using completion as i do with
>>>>> e.g. refile goto would.
>>>>
>>>> Samuel, you claimed that completion by description does not work for
>>>> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do not
>>>> see the issue with the default completion. It is the reason why I asked
>>>> you to confirm that *default completion* works for you as well. I
>>>> suspect that the cause of your problem is either ido or your
>>>> customization.
>>>>
>>>> I see no connection of `org-refile' and `org-goto' with the code in
>>>> `org-insert-link'.
>>
>>
>>
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-03 23:48                   ` Samuel Wales
@ 2023-07-03 23:49                     ` Samuel Wales
  2023-07-03 23:50                       ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-03 23:49 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

please feel free to give up if that doesn't get it across.  i can't
continue a bac and forth for unrelated reasons.

On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
> scratch the expanded thing.
>
> it ends up showing orig smaller less useful, links uselessly
> boilerplate, completions -- 3 windows!  and a terse minibuffer i
> wouldn't be able to use.  -q.  i cannot use such a ui.
>
> in contrast, what i expected is orig, and then expanded minibuffer
> with, instead of doi: and so on, has useful links as descriotions.
> only 1 window, if you don't count minibuffer.
>
> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
>> completion imnibuffer.  not useful for me.
>>
>> On 7/3/23, Max Nikulin <manikulin@gmail.com> wrote:
>>> On 02/07/2023 13:03, Samuel Wales wrote:
>>>> there is not supposed to be any connection between org refile or org
>>>> goto with the code in org insert link.
>>>>
>>>> completion works to select ol paths for org refile and also for org
>>>> refile when it is doing goto.  i just want the same for links.
>>>
>>> I am giving up my attempts to clarify a possible issue with completion
>>> by description in `org-insert-link'. It works for me.
>>>
>>>> On 7/1/23, Max Nikulin wrote:
>>>>> On 02/07/2023 12:02, Samuel Wales wrote:
>>>>>> another window would not work for me but using completion as i do
>>>>>> with
>>>>>> e.g. refile goto would.
>>>>>
>>>>> Samuel, you claimed that completion by description does not work for
>>>>> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do not
>>>>> see the issue with the default completion. It is the reason why I
>>>>> asked
>>>>> you to confirm that *default completion* works for you as well. I
>>>>> suspect that the cause of your problem is either ido or your
>>>>> customization.
>>>>>
>>>>> I see no connection of `org-refile' and `org-goto' with the code in
>>>>> `org-insert-link'.
>>>
>>>
>>>
>>>
>>
>>
>> --
>> The Kafka Pandemic
>>
>> A blog about science, health, human rights, and misopathy:
>> https://thekafkapandemic.blogspot.com
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-03 23:49                     ` Samuel Wales
@ 2023-07-03 23:50                       ` Samuel Wales
  2023-07-04  0:27                         ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-03 23:50 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

maybe most folk are ok with 3 windows + minibuffer.  this is not useful to me.

On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
> please feel free to give up if that doesn't get it across.  i can't
> continue a bac and forth for unrelated reasons.
>
> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>> scratch the expanded thing.
>>
>> it ends up showing orig smaller less useful, links uselessly
>> boilerplate, completions -- 3 windows!  and a terse minibuffer i
>> wouldn't be able to use.  -q.  i cannot use such a ui.
>>
>> in contrast, what i expected is orig, and then expanded minibuffer
>> with, instead of doi: and so on, has useful links as descriotions.
>> only 1 window, if you don't count minibuffer.
>>
>> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>>> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
>>> completion imnibuffer.  not useful for me.
>>>
>>> On 7/3/23, Max Nikulin <manikulin@gmail.com> wrote:
>>>> On 02/07/2023 13:03, Samuel Wales wrote:
>>>>> there is not supposed to be any connection between org refile or org
>>>>> goto with the code in org insert link.
>>>>>
>>>>> completion works to select ol paths for org refile and also for org
>>>>> refile when it is doing goto.  i just want the same for links.
>>>>
>>>> I am giving up my attempts to clarify a possible issue with completion
>>>> by description in `org-insert-link'. It works for me.
>>>>
>>>>> On 7/1/23, Max Nikulin wrote:
>>>>>> On 02/07/2023 12:02, Samuel Wales wrote:
>>>>>>> another window would not work for me but using completion as i do
>>>>>>> with
>>>>>>> e.g. refile goto would.
>>>>>>
>>>>>> Samuel, you claimed that completion by description does not work for
>>>>>> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do
>>>>>> not
>>>>>> see the issue with the default completion. It is the reason why I
>>>>>> asked
>>>>>> you to confirm that *default completion* works for you as well. I
>>>>>> suspect that the cause of your problem is either ido or your
>>>>>> customization.
>>>>>>
>>>>>> I see no connection of `org-refile' and `org-goto' with the code in
>>>>>> `org-insert-link'.
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> The Kafka Pandemic
>>>
>>> A blog about science, health, human rights, and misopathy:
>>> https://thekafkapandemic.blogspot.com
>>>
>>
>>
>> --
>> The Kafka Pandemic
>>
>> A blog about science, health, human rights, and misopathy:
>> https://thekafkapandemic.blogspot.com
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-03 23:50                       ` Samuel Wales
@ 2023-07-04  0:27                         ` Samuel Wales
  2023-07-04  0:28                           ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-04  0:27 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

the copletions window dos notc ontain the link dscription or a
default.  there is no tdeafult listed in minibuffer or any tlink
description.  so it is 1 orig buffer, which is saller and therefoere
lss useful, 1 links buffer, which is useless beause does not show what
i need, 1 copletions buffer which is useollss befause all it shows is
url prefixes, and a minibuffer which shows nothing.

On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
> maybe most folk are ok with 3 windows + minibuffer.  this is not useful to
> me.
>
> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>> please feel free to give up if that doesn't get it across.  i can't
>> continue a bac and forth for unrelated reasons.
>>
>> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>>> scratch the expanded thing.
>>>
>>> it ends up showing orig smaller less useful, links uselessly
>>> boilerplate, completions -- 3 windows!  and a terse minibuffer i
>>> wouldn't be able to use.  -q.  i cannot use such a ui.
>>>
>>> in contrast, what i expected is orig, and then expanded minibuffer
>>> with, instead of doi: and so on, has useful links as descriotions.
>>> only 1 window, if you don't count minibuffer.
>>>
>>> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>>>> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
>>>> completion imnibuffer.  not useful for me.
>>>>
>>>> On 7/3/23, Max Nikulin <manikulin@gmail.com> wrote:
>>>>> On 02/07/2023 13:03, Samuel Wales wrote:
>>>>>> there is not supposed to be any connection between org refile or org
>>>>>> goto with the code in org insert link.
>>>>>>
>>>>>> completion works to select ol paths for org refile and also for org
>>>>>> refile when it is doing goto.  i just want the same for links.
>>>>>
>>>>> I am giving up my attempts to clarify a possible issue with completion
>>>>> by description in `org-insert-link'. It works for me.
>>>>>
>>>>>> On 7/1/23, Max Nikulin wrote:
>>>>>>> On 02/07/2023 12:02, Samuel Wales wrote:
>>>>>>>> another window would not work for me but using completion as i do
>>>>>>>> with
>>>>>>>> e.g. refile goto would.
>>>>>>>
>>>>>>> Samuel, you claimed that completion by description does not work for
>>>>>>> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do
>>>>>>> not
>>>>>>> see the issue with the default completion. It is the reason why I
>>>>>>> asked
>>>>>>> you to confirm that *default completion* works for you as well. I
>>>>>>> suspect that the cause of your problem is either ido or your
>>>>>>> customization.
>>>>>>>
>>>>>>> I see no connection of `org-refile' and `org-goto' with the code in
>>>>>>> `org-insert-link'.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> The Kafka Pandemic
>>>>
>>>> A blog about science, health, human rights, and misopathy:
>>>> https://thekafkapandemic.blogspot.com
>>>>
>>>
>>>
>>> --
>>> The Kafka Pandemic
>>>
>>> A blog about science, health, human rights, and misopathy:
>>> https://thekafkapandemic.blogspot.com
>>>
>>
>>
>> --
>> The Kafka Pandemic
>>
>> A blog about science, health, human rights, and misopathy:
>> https://thekafkapandemic.blogspot.com
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-04  0:27                         ` Samuel Wales
@ 2023-07-04  0:28                           ` Samuel Wales
  2023-07-04  1:45                             ` Max Nikulin
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-04  0:28 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

again i normally work with 1 window so i can have enough text.
sometimes i have a minuibffer.  the end.

On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
> the copletions window dos notc ontain the link dscription or a
> default.  there is no tdeafult listed in minibuffer or any tlink
> description.  so it is 1 orig buffer, which is saller and therefoere
> lss useful, 1 links buffer, which is useless beause does not show what
> i need, 1 copletions buffer which is useollss befause all it shows is
> url prefixes, and a minibuffer which shows nothing.
>
> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>> maybe most folk are ok with 3 windows + minibuffer.  this is not useful
>> to
>> me.
>>
>> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>>> please feel free to give up if that doesn't get it across.  i can't
>>> continue a bac and forth for unrelated reasons.
>>>
>>> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>>>> scratch the expanded thing.
>>>>
>>>> it ends up showing orig smaller less useful, links uselessly
>>>> boilerplate, completions -- 3 windows!  and a terse minibuffer i
>>>> wouldn't be able to use.  -q.  i cannot use such a ui.
>>>>
>>>> in contrast, what i expected is orig, and then expanded minibuffer
>>>> with, instead of doi: and so on, has useful links as descriotions.
>>>> only 1 window, if you don't count minibuffer.
>>>>
>>>> On 7/3/23, Samuel Wales <samologist@gmail.com> wrote:
>>>>> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
>>>>> completion imnibuffer.  not useful for me.
>>>>>
>>>>> On 7/3/23, Max Nikulin <manikulin@gmail.com> wrote:
>>>>>> On 02/07/2023 13:03, Samuel Wales wrote:
>>>>>>> there is not supposed to be any connection between org refile or org
>>>>>>> goto with the code in org insert link.
>>>>>>>
>>>>>>> completion works to select ol paths for org refile and also for org
>>>>>>> refile when it is doing goto.  i just want the same for links.
>>>>>>
>>>>>> I am giving up my attempts to clarify a possible issue with
>>>>>> completion
>>>>>> by description in `org-insert-link'. It works for me.
>>>>>>
>>>>>>> On 7/1/23, Max Nikulin wrote:
>>>>>>>> On 02/07/2023 12:02, Samuel Wales wrote:
>>>>>>>>> another window would not work for me but using completion as i do
>>>>>>>>> with
>>>>>>>>> e.g. refile goto would.
>>>>>>>>
>>>>>>>> Samuel, you claimed that completion by description does not work
>>>>>>>> for
>>>>>>>> `org-insert-link'. I expect that it is fixed in Org-9.6 since I do
>>>>>>>> not
>>>>>>>> see the issue with the default completion. It is the reason why I
>>>>>>>> asked
>>>>>>>> you to confirm that *default completion* works for you as well. I
>>>>>>>> suspect that the cause of your problem is either ido or your
>>>>>>>> customization.
>>>>>>>>
>>>>>>>> I see no connection of `org-refile' and `org-goto' with the code in
>>>>>>>> `org-insert-link'.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> The Kafka Pandemic
>>>>>
>>>>> A blog about science, health, human rights, and misopathy:
>>>>> https://thekafkapandemic.blogspot.com
>>>>>
>>>>
>>>>
>>>> --
>>>> The Kafka Pandemic
>>>>
>>>> A blog about science, health, human rights, and misopathy:
>>>> https://thekafkapandemic.blogspot.com
>>>>
>>>
>>>
>>> --
>>> The Kafka Pandemic
>>>
>>> A blog about science, health, human rights, and misopathy:
>>> https://thekafkapandemic.blogspot.com
>>>
>>
>>
>> --
>> The Kafka Pandemic
>>
>> A blog about science, health, human rights, and misopathy:
>> https://thekafkapandemic.blogspot.com
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-04  0:28                           ` Samuel Wales
@ 2023-07-04  1:45                             ` Max Nikulin
  2023-07-04  2:29                               ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Max Nikulin @ 2023-07-04  1:45 UTC (permalink / raw)
  To: emacs-orgmode

On 04/07/2023 07:28, Samuel Wales wrote:
> again i normally work with 1 window so i can have enough text.
> sometimes i have a minuibffer.  the end.

---- 8< ----
File Edit Options Buffers Tools Minibuf Help 

* title
:PROPERTIES:
:ID:       e69336ca-ca50-4535-9bad-63a31e030f31
-UU-:----F1  test.org        2% L2     (Org) -----------------------
Insert a link.
Use TAB to complete link prefixes, then RET for type-specific compl$

-UUU:**--F1  *Org Links*    Top L1     (Fundamental) ---------------
http:                      https:
id:                        id:e69336ca-ca50-4535-9bad-63a31e030f31
info:                      irc:
mailto:                    mhe:
news:                      rmail:
shell:                     title
w3m:




-UUU:%*--F1  *Completions*   Bot L10    (Completion List) ---------
Link:
---- >8 ----

Notice that "title" is present among the completion options. You may be 
upset, but org-insert-link works correctly. I have no idea why you 
customization throws away this completion variant.




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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-04  1:45                             ` Max Nikulin
@ 2023-07-04  2:29                               ` Samuel Wales
  2023-07-04  9:31                                 ` Ihor Radchenko
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-04  2:29 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

On 7/3/23, Max Nikulin <manikulin@gmail.com> wrote:
> On 04/07/2023 07:28, Samuel Wales wrote:
>> again i normally work with 1 window so i can have enough text.
>> sometimes i have a minuibffer.  the end.
>
> ---- 8< ----
> File Edit Options Buffers Tools Minibuf Help
>
> * title
> :PROPERTIES:
> :ID:       e69336ca-ca50-4535-9bad-63a31e030f31
> -UU-:----F1  test.org        2% L2     (Org) -----------------------

for my purposes this window should remain, and be larger.

> Insert a link.
> Use TAB to complete link prefixes, then RET for type-specific compl$
>
> -UUU:**--F1  *Org Links*    Top L1     (Fundamental)

this buffer contains nothing useful and shortens the above buffer.

---------------
> http:                      https:
> id:                        id:e69336ca-ca50-4535-9bad-63a31e030f31
> info:                      irc:
> mailto:                    mhe:
> news:                      rmail:
> shell:                     title
> w3m:

these prefixes like http: i do not understand thier use.  i want
descriptions of headings.  the id link is not one.

>
>
>
>
> -UUU:%*--F1  *Completions*   Bot L10    (Completion List)

i do not see the need for a buffer here.  it reduces the size of hte
buffer that matters.

---------
> Link:
> ---- >8 ----
>
> Notice that "title" is present among the completion options.

title does not show in my case and nots ure the signiricance.  i use
large fonts.  that might or might nto be relevant.

> You may be
> upset, but org-insert-link works correctly. I have no idea why you

emotions are not germane and can carry unintended implications in a
laudably usually polite ml.  i am not upset.

i cannot do this kind of back and forth.  i am limited in computer use.

you used the word correct.  i would say that it is not correct for me.
i believe you if you say it is correct for you.

> customization throws away this completion variant.

you asked me to do -q.  i did -q.  are you saying i am customizeing
-q?  i am unaware of it if so.

everythign here has nothign t9o do with my .emacs.

>
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-04  2:29                               ` Samuel Wales
@ 2023-07-04  9:31                                 ` Ihor Radchenko
  2023-07-05  0:10                                   ` Samuel Wales
  0 siblings, 1 reply; 52+ messages in thread
From: Ihor Radchenko @ 2023-07-04  9:31 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Max Nikulin, emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

>> -UUU:**--F1  *Org Links*    Top L1     (Fundamental)
>
> this buffer contains nothing useful and shortens the above buffer.

This is fine. I assume that you can simply hide it away using
`display-buffer-alist'.

> ---------------
>> http:                      https:
>> id:                        id:e69336ca-ca50-4535-9bad-63a31e030f31
>> info:                      irc:
>> mailto:                    mhe:
>> news:                      rmail:
>> shell:                     title
>> w3m:
>
> these prefixes like http: i do not understand thier use.  i want
> descriptions of headings.  the id link is not one.

Org shows link prefixes, stored links, and link description in the
completion. The relevant code in `org-insert-link' is:

(org-completing-read
		   "Link: "
		   (append
		    (mapcar (lambda (x) (concat x ":")) all-prefixes)
		    (mapcar #'car org-stored-links)
                    ;; Allow description completion.  Avoid "nil" option
                    ;; in the case of `completing-read-default' and
                    ;; an error in `ido-completing-read' when some links
                    ;; have no description.
                    (delq nil (mapcar 'cadr org-stored-links)))
		   nil nil nil
		   'org-link--history
		   (caar org-stored-links))

>> Notice that "title" is present among the completion options.
>
> title does not show in my case and nots ure the signiricance.  i use
> large fonts.  that might or might nto be relevant.

Completing descriptions feature has been added by Max 10 months ago - it
is a fairly recent addition:

0432f4fe6ba9b07c17ac555beab1527d8f844234
Author:     Max Nikulin <manikulin@gmail.com>
ol.el: Restore complete by description for insert link

* lisp/ol.el (org-insert-link): Allow completion of link target by its
description.  Almost certainly the feature was removed unintentionally.

This commit is a part of Org 9.6.
May it be that you are using older Org version?

-- 
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] 52+ messages in thread

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-04  9:31                                 ` Ihor Radchenko
@ 2023-07-05  0:10                                   ` Samuel Wales
  2023-07-05 11:00                                     ` Ihor Radchenko
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-05  0:10 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Max Nikulin, emacs-orgmode

On 7/4/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> Samuel Wales <samologist@gmail.com> writes:
>
>>> -UUU:**--F1  *Org Links*    Top L1     (Fundamental)
>>
>> this buffer contains nothing useful and shortens the above buffer.
>
> This is fine. I assume that you can simply hide it away using
> `display-buffer-alist'.

i have struggled with this in a wider context and gotten nowhere for years.

>
>> ---------------
>>> http:                      https:
>>> id:                        id:e69336ca-ca50-4535-9bad-63a31e030f31
>>> info:                      irc:
>>> mailto:                    mhe:
>>> news:                      rmail:
>>> shell:                     title
>>> w3m:
>>
>> these prefixes like http: i do not understand thier use.  i want
>> descriptions of headings.  the id link is not one.
>
> Org shows link prefixes, stored links, and link description in the
> completion. The relevant code in `org-insert-link' is:

what is the purpose of the prefixes?

where is the description in this case?  was it a bare link?  that is
unusual for an id link.

>
> (org-completing-read
> 		   "Link: "
> 		   (append
> 		    (mapcar (lambda (x) (concat x ":")) all-prefixes)
> 		    (mapcar #'car org-stored-links)
>                     ;; Allow description completion.  Avoid "nil" option
>                     ;; in the case of `completing-read-default' and
>                     ;; an error in `ido-completing-read' when some links
>                     ;; have no description.
>                     (delq nil (mapcar 'cadr org-stored-links)))
> 		   nil nil nil
> 		   'org-link--history
> 		   (caar org-stored-links))
>
>>> Notice that "title" is present among the completion options.
>>
>> title does not show in my case and nots ure the signiricance.  i use
>> large fonts.  that might or might nto be relevant.
>
> Completing descriptions feature has been added by Max 10 months ago - it
> is a fairly recent addition:

please note that it is of course not my intention to criticize anybody
or anybody's code.  merely saying what i need.  max is trying to be
helpful.  iu am not even sure how we got on this topic as my original
report was the already stored bug.

in the context of mindless store/insert, which is what i do most
frequently, if the most recently stored is set to the completion
default, this topic is moot as presumably others agree this is
desirable.  in the context of choosing a different link from the
default, the short url-like prefixes being there in front of specific
links confuses me.

for me, i just want the original buffer where you are pasting, and
minibuffer completion.  only.


then there is the more fancy question of grabbing random links from
all over your org files in order to paste them all in one place which
i will not cover here.

>
> 0432f4fe6ba9b07c17ac555beab1527d8f844234
> Author:     Max Nikulin <manikulin@gmail.com>
> ol.el: Restore complete by description for insert link
>
> * lisp/ol.el (org-insert-link): Allow completion of link target by its
> description.  Almost certainly the feature was removed unintentionally.

definitely in favor of copleting by the description of the link.
htank you for any effort toward that.

>
> This commit is a part of Org 9.6.
> May it be that you are using older Org version?

9.6.7, most recent bugfix.  comments apply to vanilla.

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


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-06-29 13:09             ` Ihor Radchenko
  2023-06-30  3:00               ` Samuel Wales
@ 2023-07-05 10:19               ` Ihor Radchenko
  2023-07-06  0:28                 ` Samuel Wales
                                   ` (2 more replies)
  1 sibling, 3 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-07-05 10:19 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

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

Ihor Radchenko <yantar92@posteo.net> writes:

> What Samuel described is a sequence of M-x org-store-link followed by
> M-x org-insert-all-links. With such workflow, user can expect that the
> links are going to be stored in order. If we are instead shuffle the
> stored links, M-x org-insert-all-links may result in unexpected
> behaviour.
>
> Currently, when link to place is already stored, not error is thrown, a
> message is displayed, no link is stored, and the stored link list is not
> altered.

Attaching the patch.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-store-link-Move-already-stored-link-to-front-by-.patch --]
[-- Type: text/x-patch, Size: 4498 bytes --]

From a05e2cc235b10a7096538da4f6ae6d17c82a6b25 Mon Sep 17 00:00:00 2001
Message-ID: <a05e2cc235b10a7096538da4f6ae6d17c82a6b25.1688552284.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 5 Jul 2023 13:14:56 +0300
Subject: [PATCH] org-store-link: Move already stored link to front by default

* lisp/ol.el (org-link-store-existing): New customization controlling
how to deal with already stored links.
(org-store-link): Respect the new customization, allowing duplicates
to (1) be added anyway; (2) be ignored; (3) be moved to front of
`org-stored-links'.  The default is (3).
* etc/ORG-NEWS (~org-store-link~ now moves an already stored link to
front of the ~org-stored-links~): Document the breaking change.

Reported-by: Samuel Wales <samologist@gmail.com>
Link: https://list.orgmode.org/orgmode/CAJcAo8sjD3_FX5pFQ4git9wRDNM3bMqTgP-R5mM8zcf1B3mjPg@mail.gmail.com/
---
 etc/ORG-NEWS | 15 +++++++++++++++
 lisp/ol.el   | 36 +++++++++++++++++++++++++++++-------
 2 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index d04e92275..288d50842 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,21 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)
 ** Important announcements and breaking changes
+*** ~org-store-link~ now moves an already stored link to front of the ~org-stored-links~
+
+Previously, when the link to be stored were stored already,
+~org-store-link~ displayed a message and did nothing.
+
+Now, ~org-store-link~ moves the stored link to front of the list of
+stored links.  This way, the link will show up first in the completion
+and when inserting all the stored links with ~org-insert-all-links~.
+
+The new behavior is controlled by new customization ~org-link-store-existing~.
+
+Users can set ~org-link-store-existing~ to nil to revert previous
+defaults.  The value of =store-duplicate= will force duplicate links
+in ~org-stored-links~.  The default value is =move-to-front=.
+
 *** Major changes and additions to Org API
 **** New term: "syntax node"
 
diff --git a/lisp/ol.el b/lisp/ol.el
index 6dd7e0fa1..3a8ca5f39 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -509,6 +509,20 @@ (defcustom org-link-keep-stored-after-insertion nil
   :type 'boolean
   :safe #'booleanp)
 
+(defcustom org-link-store-existing 'move-to-front
+  "Variable controlling how to deal with already stored links.
+When nil, ignore store request for an already stored link.
+When symbol `move-to-front', move the stored link to the front of
+`org-stored-links'.
+When symbol `store-duplicate', add a duplicate in front."
+  :group 'org-link-store
+  :type '(choice
+          (const :tag "Do no store duplicate" nil)
+          (const :tag "Move stored duplicate to front" move-to-front)
+          (const :tag "Store duplicate" store-duplicate))
+  :safe #'symbolp
+  :package-version '(Org . "9.7"))
+
 ;;; Public variables
 
 (defconst org-target-regexp (let ((border "[^<>\n\r \t]"))
@@ -1749,16 +1763,24 @@ (defun org-store-link (arg &optional interactive?)
       ;; Store and return the link
       (if (not (and interactive? link))
 	  (or agenda-link (and link (org-link-make-string link desc)))
-	(if (member (list link desc) org-stored-links)
-	    (message "This link has already been stored")
-	  (push (list link desc) org-stored-links)
-	  (message "Stored: %s" (or desc link))
+        (dotimes (_ (if custom-id 2 1)) ; Store 2 links when CUSTOM-ID is non-nil.
+          (pcase org-link-store-existing
+            ((or `store-duplicate
+                 (guard (not (member (list link desc) org-stored-links))))
+             (push (list link desc) org-stored-links)
+	     (message "Stored: %s" (or desc link)))
+            ((or`nil (guard (equal (list link desc) (car org-stored-links))))
+             (message "This link has already been stored"))
+            (`move-to-front
+             (setq org-stored-links
+                   (delete (list link desc) org-stored-links))
+             (push (list link desc) org-stored-links)
+             (message "Link moved to front: %s" (or desc link))))
 	  (when custom-id
 	    (setq link (concat "file:"
 			       (abbreviate-file-name
-				(buffer-file-name (buffer-base-buffer)))
-			       "::#" custom-id))
-	    (push (list link desc) org-stored-links)))
+			        (buffer-file-name (buffer-base-buffer)))
+			       "::#" custom-id))))
 	(car org-stored-links)))))
 
 ;;;###autoload
-- 
2.41.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
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 related	[flat|nested] 52+ messages in thread

* Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)
  2023-07-05  0:10                                   ` Samuel Wales
@ 2023-07-05 11:00                                     ` Ihor Radchenko
  0 siblings, 0 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-07-05 11:00 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Max Nikulin, emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

>>> this buffer contains nothing useful and shortens the above buffer.
>>
>> This is fine. I assume that you can simply hide it away using
>> `display-buffer-alist'.
>
> i have struggled with this in a wider context and gotten nowhere for years.

(add-to-list
 'display-buffer-alist
 `("*Org Links*" display-buffer-no-window (allow-no-window . t)))

You may also find
https://www.masteringemacs.org/article/demystifying-emacs-window-manager
and
https://www.gnu.org/software/emacs/manual/html_node/elisp/The-Zen-of-Buffer-Display.html
useful.

>> Org shows link prefixes, stored links, and link description in the
>> completion. The relevant code in `org-insert-link' is:
>
> what is the purpose of the prefixes?

When inserting a link, you do not always need to insert a stored link.
Various link types can have completion function specific to a link type.
For example, I arranged my id: links to use org-ql for completion. That
way I can insert id: links searching across all the agenda files via
org-ql.

> where is the description in this case?  was it a bare link?  that is
> unusual for an id link.

>> (org-completing-read
>> 		   "Link: "
>> 		   (append
>> 		    (mapcar (lambda (x) (concat x ":")) all-prefixes)

The above corresponds to link prefixes.

>> 		    (mapcar #'car org-stored-links)

Each element of `org-stored-links' is (path description).
car in org-stored-links elements are bare links (link path).

>>                     ;; Allow description completion.  Avoid "nil" option
>>                     ;; in the case of `completing-read-default' and
>>                     ;; an error in `ido-completing-read' when some links
>>                     ;; have no description.
>>                     (delq nil (mapcar 'cadr org-stored-links)))

cadr in org-stored-links elements are descriptions.

So, the completion should offer (1) all the link types; (2) all the link
paths; (3) all the link descriptions.

You can try to run this code manually to see.
You can also remove different parts in the (append ...) to experiment.

>> Completing descriptions feature has been added by Max 10 months ago - it
>> is a fairly recent addition:
>
> please note that it is of course not my intention to criticize anybody
> or anybody's code.  merely saying what i need.  max is trying to be
> helpful.  iu am not even sure how we got on this topic as my original
> report was the already stored bug.

That's not a problem. We already changed the subject of this spin-off
thread. The original bug report is separate.

> in the context of mindless store/insert, which is what i do most
> frequently, if the most recently stored is set to the completion
> default, this topic is moot as presumably others agree this is
> desirable.  in the context of choosing a different link from the
> default, the short url-like prefixes being there in front of specific
> links confuses me.

So, your suggestion is to move link descriptions and paths before the
link types in the completion list?

> then there is the more fancy question of grabbing random links from
> all over your org files in order to paste them all in one place which
> i will not cover here.

I hope that M-x org-insert-all-links caters this need.

>> This commit is a part of Org 9.6.
>> May it be that you are using older Org version?
>
> 9.6.7, most recent bugfix.  comments apply to vanilla.

May you please elaborate what you mean by "comments apply to vanilla"?

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-07-05 10:19               ` [PATCH] " Ihor Radchenko
@ 2023-07-06  0:28                 ` Samuel Wales
  2023-07-15 12:35                 ` Ihor Radchenko
  2023-08-06 18:47                 ` Bastien
  2 siblings, 0 replies; 52+ messages in thread
From: Samuel Wales @ 2023-07-06  0:28 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

On 7/5/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> What Samuel described is a sequence of M-x org-store-link followed by
>> M-x org-insert-all-links. With such workflow, user can expect that the
>> links are going to be stored in order. If we are instead shuffle the
>> stored links, M-x org-insert-all-links may result in unexpected
>> behaviour.

fwiw i think i described merely org-store-link org-insert-link as i
think i ahve not tried oial yet.  thanks for patch.

>>
>> Currently, when link to place is already stored, not error is thrown, a
>> message is displayed, no link is stored, and the stored link list is not
>> altered.
>
> Attaching the patch.
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-07-05 10:19               ` [PATCH] " Ihor Radchenko
  2023-07-06  0:28                 ` Samuel Wales
@ 2023-07-15 12:35                 ` Ihor Radchenko
  2023-07-21  4:13                   ` Samuel Wales
  2023-08-06 18:47                 ` Bastien
  2 siblings, 1 reply; 52+ messages in thread
From: Ihor Radchenko @ 2023-07-15 12:35 UTC (permalink / raw)
  To: Anthony Carrico; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> From a05e2cc235b10a7096538da4f6ae6d17c82a6b25 Mon Sep 17 00:00:00 2001
> Message-ID: <a05e2cc235b10a7096538da4f6ae6d17c82a6b25.1688552284.git.yantar92@posteo.net>
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Wed, 5 Jul 2023 13:14:56 +0300
> Subject: [PATCH] org-store-link: Move already stored link to front by default

Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c0dbcf361

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-07-15 12:35                 ` Ihor Radchenko
@ 2023-07-21  4:13                   ` Samuel Wales
  2023-07-21  7:46                     ` Ihor Radchenko
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-07-21  4:13 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

On 7/15/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> Applied, onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c0dbcf361

thank you!  will this reach bugfix too?

-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-07-21  4:13                   ` Samuel Wales
@ 2023-07-21  7:46                     ` Ihor Radchenko
  0 siblings, 0 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-07-21  7:46 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Anthony Carrico, emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> On 7/15/23, Ihor Radchenko <yantar92@posteo.net> wrote:
>> Applied, onto main.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c0dbcf361
>
> thank you!  will this reach bugfix too?

No, because it is a new feature. So, it is for the next release.

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-07-05 10:19               ` [PATCH] " Ihor Radchenko
  2023-07-06  0:28                 ` Samuel Wales
  2023-07-15 12:35                 ` Ihor Radchenko
@ 2023-08-06 18:47                 ` Bastien
  2023-08-06 20:53                   ` Samuel Wales
  2023-08-08  9:04                   ` Ihor Radchenko
  2 siblings, 2 replies; 52+ messages in thread
From: Bastien @ 2023-08-06 18:47 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> * lisp/ol.el (org-link-store-existing): New customization controlling
> how to deal with already stored links.
> (org-store-link): Respect the new customization, allowing duplicates
> to (1) be added anyway; (2) be ignored; (3) be moved to front of
> `org-stored-links'.  The default is (3).
> * etc/ORG-NEWS (~org-store-link~ now moves an already stored link to
> front of the ~org-stored-links~): Document the breaking change.

I'm not sure what is the real world use-case for allowing storing the
same link several times.  Maybe one was provided, but I missed it.

I believe the new default behavior makes a lot of sense, thanks for
implementing this.

I'm skeptical about the need for a new dedicated option, though.

The current single universal prefix argument seems not that useful ("A
single `C-u' negates `org-context-in-file-links' for file links or
`org-gnus-prefer-web-links' for links to Usenet articles.") and we
could use it to force storing duplicates, which is more useful.

Here is the suggested new behavior, also modifying other universal
prefix args:

- M-x org-stored-links     : don't store dups, move upfront if dup
- C-u M-x org-stored-links : force storing the link, even if dup
- [2 universal prefix arg] : negates ‘org-context-in-file-links’, etc
- [3 universal prefix arg] : forces skipping storing functions
  that are not part of Org core.

The current behavior for 3 prefix args should be the default when the
region is active.

WDYT?

-- 
 Bastien


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

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-06 18:47                 ` Bastien
@ 2023-08-06 20:53                   ` Samuel Wales
  2023-08-08  9:08                     ` Ihor Radchenko
  2023-08-08  9:04                   ` Ihor Radchenko
  1 sibling, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-08-06 20:53 UTC (permalink / raw)
  To: Bastien; +Cc: Ihor Radchenko, Anthony Carrico, emacs-orgmode

i am confused.  org-stored-links is a command?  what are the known
user needs for storing and pasting links?

i am also unclear on why we have a dedicated paste function as opposed
to kill ring.  probably a good reason.  but wfm.

i merely wanted to store then yank a link.  which in bugfix errors if
dup.  i also envisioned other less defined use cases.

stprog link several times could include having colelected a bunch of
links, perhaps in sequene but in the meantime wanting to copy and
paste a single link that is by coincidence in that list?  i could
imagine such a thing.

On 8/6/23, Bastien <bzg@gnu.org> wrote:
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> * lisp/ol.el (org-link-store-existing): New customization controlling
>> how to deal with already stored links.
>> (org-store-link): Respect the new customization, allowing duplicates
>> to (1) be added anyway; (2) be ignored; (3) be moved to front of
>> `org-stored-links'.  The default is (3).
>> * etc/ORG-NEWS (~org-store-link~ now moves an already stored link to
>> front of the ~org-stored-links~): Document the breaking change.
>
> I'm not sure what is the real world use-case for allowing storing the
> same link several times.  Maybe one was provided, but I missed it.
>
> I believe the new default behavior makes a lot of sense, thanks for
> implementing this.
>
> I'm skeptical about the need for a new dedicated option, though.
>
> The current single universal prefix argument seems not that useful ("A
> single `C-u' negates `org-context-in-file-links' for file links or
> `org-gnus-prefer-web-links' for links to Usenet articles.") and we
> could use it to force storing duplicates, which is more useful.
>
> Here is the suggested new behavior, also modifying other universal
> prefix args:
>
> - M-x org-stored-links     : don't store dups, move upfront if dup
> - C-u M-x org-stored-links : force storing the link, even if dup
> - [2 universal prefix arg] : negates ‘org-context-in-file-links’, etc
> - [3 universal prefix arg] : forces skipping storing functions
>   that are not part of Org core.
>
> The current behavior for 3 prefix args should be the default when the
> region is active.
>
> WDYT?
>
> --
>  Bastien
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-06 18:47                 ` Bastien
  2023-08-06 20:53                   ` Samuel Wales
@ 2023-08-08  9:04                   ` Ihor Radchenko
  2023-08-08 13:37                     ` Bastien Guerry
  1 sibling, 1 reply; 52+ messages in thread
From: Ihor Radchenko @ 2023-08-08  9:04 UTC (permalink / raw)
  To: Bastien; +Cc: Anthony Carrico, emacs-orgmode

Bastien <bzg@gnu.org> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> * lisp/ol.el (org-link-store-existing): New customization controlling
>> how to deal with already stored links.
>> (org-store-link): Respect the new customization, allowing duplicates
>> to (1) be added anyway; (2) be ignored; (3) be moved to front of
>> `org-stored-links'.  The default is (3).
>> * etc/ORG-NEWS (~org-store-link~ now moves an already stored link to
>> front of the ~org-stored-links~): Document the breaking change.
>
> I'm not sure what is the real world use-case for allowing storing the
> same link several times.  Maybe one was provided, but I missed it.

I added it mostly because it was easy to do.

Also, I thought that one might do a sequence of M-x org-store-link as one
is reading things in different buffers. Later, M-x org-insert-all-links
would insert the stored links from history, even if reading involved
back-and-forth switching of the same buffer.
This is rather imaginary use case though.

> I believe the new default behavior makes a lot of sense, thanks for
> implementing this.
>
> I'm skeptical about the need for a new dedicated option, though.
>
> The current single universal prefix argument seems not that useful ("A
> single `C-u' negates `org-context-in-file-links' for file links or
> `org-gnus-prefer-web-links' for links to Usenet articles.") and we
> could use it to force storing duplicates, which is more useful.

This would be yet another breaking change...

> Here is the suggested new behavior, also modifying other universal
> prefix args:
>
> - M-x org-stored-links     : don't store dups, move upfront if dup
> - C-u M-x org-stored-links : force storing the link, even if dup
> - [2 universal prefix arg] : negates ‘org-context-in-file-links’, etc
> - [3 universal prefix arg] : forces skipping storing functions
>   that are not part of Org core.
>
> The current behavior for 3 prefix args should be the default when the
> region is active.
>
> WDYT?

AFAIU, you suggest changing the meaning of C-u prefix argument and also
remove the previous default behavior completely.

As I said in the above, storing duplicates is rather imaginary case. I
am not sure if it is strictly more useful compared to the current
negation of `org-context-in-file-links'.

For removing the previous default (do nothing when duplicate), Samuel
previously expressed a concern:

>>>    if you move the recent one to top of list, that would work for my
>>>    mindless store/insert, but it might not work for a user who has
>>>    carefully cultivated a set of links that are all to be inserted, or
>>>    such.  although idk if the mechanism supports.

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-06 20:53                   ` Samuel Wales
@ 2023-08-08  9:08                     ` Ihor Radchenko
  0 siblings, 0 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-08-08  9:08 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Bastien, Anthony Carrico, emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> i am confused.  org-stored-links is a command?  what are the known
> user needs for storing and pasting links?

Typo. Meant to be org-store-link.

> i am also unclear on why we have a dedicated paste function as opposed
> to kill ring.  probably a good reason.  but wfm.

This is because a workflow of opening the link target, storing it, and
then inserting the stored link is not the only workflow we support.
Another workflow is running M-x org-insert-link <RET> type <RET> select
location using completion.

For example, you do not have to open a file to store link to that file.
Instead, you can directly type M-x org-insert-link <RET> file <RET>
/path/to/file <RET>. When selecting path to file, the standard file
completion interface will be used.

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-08  9:04                   ` Ihor Radchenko
@ 2023-08-08 13:37                     ` Bastien Guerry
  2023-08-11  9:31                       ` Ihor Radchenko
  0 siblings, 1 reply; 52+ messages in thread
From: Bastien Guerry @ 2023-08-08 13:37 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> This would be yet another breaking change...

Of course, you're right!

Then here are two suggestions, assuming it's best to spare us yet
another option:

(1) by always store the latest link on top and remove old dups.

(2) always store latest link at the top and remove old dups and allow
    to keep dups with 3 universal prefix args.

>>>>    if you move the recent one to top of list, that would work for my
>>>>    mindless store/insert, but it might not work for a user who has
>>>>    carefully cultivated a set of links that are all to be inserted, or
>>>>    such.  although idk if the mechanism supports.

I'm in favor of option (2) as it deals with the above use-case, and
storing a link for each lines in the active region should be the
default behavior anyway, with no need for a prefix arg.

WDYT?

-- 
 Bastien Guerry


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

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-08 13:37                     ` Bastien Guerry
@ 2023-08-11  9:31                       ` Ihor Radchenko
  2023-08-13  9:34                         ` Bastien Guerry
  0 siblings, 1 reply; 52+ messages in thread
From: Ihor Radchenko @ 2023-08-11  9:31 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Anthony Carrico, emacs-orgmode

Bastien Guerry <bzg@gnu.org> writes:

> (1) by always store the latest link on top and remove old dups.
>
> (2) always store latest link at the top and remove old dups and allow
>     to keep dups with 3 universal prefix args.
> ...
> I'm in favor of option (2) as it deals with the above use-case, and
> storing a link for each lines in the active region should be the
> default behavior anyway, with no need for a prefix arg.
>
> WDYT?

I am not sure if C-u C-u C-u override is the best design.
If the user wants to store duplicates, she will be forced to use C-u C-u
C-u every single time. And a single slip forgetting to use the prefix
arg will clear the already stored duplicates.

Also, it is not clear how to use a single C-u or double C-u C-u yet
keeping duplicates.

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-11  9:31                       ` Ihor Radchenko
@ 2023-08-13  9:34                         ` Bastien Guerry
  2023-08-13 10:32                           ` Ihor Radchenko
  2023-08-14 10:51                           ` Ihor Radchenko
  0 siblings, 2 replies; 52+ messages in thread
From: Bastien Guerry @ 2023-08-13  9:34 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

Hi Ihor,

Thanks for bearing with me while I discuss something is done, required
time and work, and isn't probably a priority.

Ihor Radchenko <yantar92@posteo.net> writes:

> Bastien Guerry <bzg@gnu.org> writes:
>
>> (1) by always store the latest link on top and remove old dups.
>>
>> (2) always store latest link at the top and remove old dups and allow
>>     to keep dups with 3 universal prefix args.
>> ...
>> I'm in favor of option (2) as it deals with the above use-case, and
>> storing a link for each lines in the active region should be the
>> default behavior anyway, with no need for a prefix arg.
>>
>> WDYT?
>
> I am not sure if C-u C-u C-u override is the best design.
> If the user wants to store duplicates, she will be forced to use C-u C-u
> C-u every single time. And a single slip forgetting to use the prefix
> arg will clear the already stored duplicates.

I am not convinced there are many users who want duplicate links by
default.  My guess is that for most users and in most cases, duplicate
links are unwanted -- in +10 years, nobody complained about the fact
that dups were not stored.

> Also, it is not clear how to use a single C-u or double C-u C-u yet
> keeping duplicates.

Indeed, that's an issue.

Here is another suggestion:

1) Remove the option and make adding the dup link on top the default.

2) Also remove the current C-u C-u C-u arg and make it the default
   when a region is active.

(1) is because removing this option would be a breaking change, and
inflincting a new option to every user to deal with a hypothetical
use-case does not seem right.

(2) should be done anyway.

WDYT?

-- 
 Bastien Guerry


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

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-13  9:34                         ` Bastien Guerry
@ 2023-08-13 10:32                           ` Ihor Radchenko
  2023-08-14  0:36                             ` Samuel Wales
  2023-08-14 10:51                           ` Ihor Radchenko
  1 sibling, 1 reply; 52+ messages in thread
From: Ihor Radchenko @ 2023-08-13 10:32 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Anthony Carrico, emacs-orgmode

Bastien Guerry <bzg@gnu.org> writes:

> Here is another suggestion:
>
> 1) Remove the option and make adding the dup link on top the default.
>
> 2) Also remove the current C-u C-u C-u arg and make it the default
>    when a region is active.
>
> (1) is because removing this option would be a breaking change, and
> inflincting a new option to every user to deal with a hypothetical
> use-case does not seem right.
>
> (2) should be done anyway.
>
> WDYT?

+1
I did not do (1) originally to maximize backwards-compatibility.
I do not feel strongly about keeping the old behaviour as an option
otherwise.

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-13 10:32                           ` Ihor Radchenko
@ 2023-08-14  0:36                             ` Samuel Wales
  2023-08-14 10:19                               ` Ihor Radchenko
  0 siblings, 1 reply; 52+ messages in thread
From: Samuel Wales @ 2023-08-14  0:36 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien Guerry, Anthony Carrico, emacs-orgmode

i currently want to copy a link location and then paste that link
loadtion.  i don't recall theis breaking before.  it does now.

On 8/13/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> Bastien Guerry <bzg@gnu.org> writes:
>
>> Here is another suggestion:
>>
>> 1) Remove the option and make adding the dup link on top the default.
>>
>> 2) Also remove the current C-u C-u C-u arg and make it the default
>>    when a region is active.
>>
>> (1) is because removing this option would be a breaking change, and
>> inflincting a new option to every user to deal with a hypothetical
>> use-case does not seem right.
>>
>> (2) should be done anyway.
>>
>> WDYT?
>
> +1
> I did not do (1) originally to maximize backwards-compatibility.
> I do not feel strongly about keeping the old behaviour as an option
> otherwise.
>
> --
> 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>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


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

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-14  0:36                             ` Samuel Wales
@ 2023-08-14 10:19                               ` Ihor Radchenko
  0 siblings, 0 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-08-14 10:19 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Bastien Guerry, Anthony Carrico, emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> i currently want to copy a link location and then paste that link
> loadtion.  i don't recall theis breaking before.  it does now.

Please provide more details. (https://orgmode.org/manual/Feedback.html#Feedback)
Otherwise, it is very hard to figure out what exactly you are referring to.

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-13  9:34                         ` Bastien Guerry
  2023-08-13 10:32                           ` Ihor Radchenko
@ 2023-08-14 10:51                           ` Ihor Radchenko
  2023-08-14 16:29                             ` Bastien Guerry
  1 sibling, 1 reply; 52+ messages in thread
From: Ihor Radchenko @ 2023-08-14 10:51 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Anthony Carrico, emacs-orgmode

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

Bastien Guerry <bzg@gnu.org> writes:

> Here is another suggestion:
>
> 1) Remove the option and make adding the dup link on top the default.
>
> (1) is because removing this option would be a breaking change, and
> inflincting a new option to every user to deal with a hypothetical
> use-case does not seem right.
>

See the attached tentative patch.

> 2) Also remove the current C-u C-u C-u arg and make it the default
>    when a region is active.
> ...
> (2) should be done anyway.

I studied this further and what you suggest will interfere with
`org-link-context-for-files'. It will no longer be possible to select
text <from here>very long
and multi-line link description<to here>, M-x org-store-link, and get
the selected text as stored link description.

The current default of using active region as description makes more
sense, IMHO.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-store-link-Never-allow-link-duplicates-in-org-st.patch --]
[-- Type: text/x-patch, Size: 4035 bytes --]

From 7d8ed8f767c632bbb94f236fd08ee31e0d573e39 Mon Sep 17 00:00:00 2001
Message-ID: <7d8ed8f767c632bbb94f236fd08ee31e0d573e39.1692010108.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Mon, 14 Aug 2023 13:39:47 +0300
Subject: [PATCH] org-store-link: Never allow link duplicates in
 `org-stored-links'

* lisp/ol.el (org-link-store-existing): Remove the previously added
custom option.
(org-store-link): Do not use `org-link-store-existing' removing all
the code branches for values other than 'move-to-front.
* etc/ORG-NEWS (~org-store-link~ now moves an already stored link to
front of the ~org-stored-links~): Remove reference to the removed
custom option.

Link: https://orgmode.org/list/87leeffd1z.fsf@localhost
---
 etc/ORG-NEWS |  6 ------
 lisp/ol.el   | 37 +++++++++++--------------------------
 2 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 1dc0a4519..6169dacf9 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -31,12 +31,6 @@ Now, ~org-store-link~ moves the stored link to front of the list of
 stored links.  This way, the link will show up first in the completion
 and when inserting all the stored links with ~org-insert-all-links~.
 
-The new behavior is controlled by new customization ~org-link-store-existing~.
-
-Users can set ~org-link-store-existing~ to nil to revert previous
-defaults.  The value of =store-duplicate= will force duplicate links
-in ~org-stored-links~.  The default value is =move-to-front=.
-
 *** Major changes and additions to Org API
 **** New term: "syntax node"
 
diff --git a/lisp/ol.el b/lisp/ol.el
index 3a8ca5f39..20aab6bb8 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -509,20 +509,6 @@ (defcustom org-link-keep-stored-after-insertion nil
   :type 'boolean
   :safe #'booleanp)
 
-(defcustom org-link-store-existing 'move-to-front
-  "Variable controlling how to deal with already stored links.
-When nil, ignore store request for an already stored link.
-When symbol `move-to-front', move the stored link to the front of
-`org-stored-links'.
-When symbol `store-duplicate', add a duplicate in front."
-  :group 'org-link-store
-  :type '(choice
-          (const :tag "Do no store duplicate" nil)
-          (const :tag "Move stored duplicate to front" move-to-front)
-          (const :tag "Store duplicate" store-duplicate))
-  :safe #'symbolp
-  :package-version '(Org . "9.7"))
-
 ;;; Public variables
 
 (defconst org-target-regexp (let ((border "[^<>\n\r \t]"))
@@ -1764,18 +1750,17 @@ (defun org-store-link (arg &optional interactive?)
       (if (not (and interactive? link))
 	  (or agenda-link (and link (org-link-make-string link desc)))
         (dotimes (_ (if custom-id 2 1)) ; Store 2 links when CUSTOM-ID is non-nil.
-          (pcase org-link-store-existing
-            ((or `store-duplicate
-                 (guard (not (member (list link desc) org-stored-links))))
-             (push (list link desc) org-stored-links)
-	     (message "Stored: %s" (or desc link)))
-            ((or`nil (guard (equal (list link desc) (car org-stored-links))))
-             (message "This link has already been stored"))
-            (`move-to-front
-             (setq org-stored-links
-                   (delete (list link desc) org-stored-links))
-             (push (list link desc) org-stored-links)
-             (message "Link moved to front: %s" (or desc link))))
+          (cond
+           ((not (member (list link desc) org-stored-links))
+            (push (list link desc) org-stored-links)
+	    (message "Stored: %s" (or desc link)))
+           ((equal (list link desc) (car org-stored-links))
+            (message "This link has already been stored"))
+           (t
+            (setq org-stored-links
+                  (delete (list link desc) org-stored-links))
+            (push (list link desc) org-stored-links)
+            (message "Link moved to front: %s" (or desc link))))
 	  (when custom-id
 	    (setq link (concat "file:"
 			       (abbreviate-file-name
-- 
2.41.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
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 related	[flat|nested] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-14 10:51                           ` Ihor Radchenko
@ 2023-08-14 16:29                             ` Bastien Guerry
  2023-08-15 10:55                               ` Ihor Radchenko
  0 siblings, 1 reply; 52+ messages in thread
From: Bastien Guerry @ 2023-08-14 16:29 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> See the attached tentative patch.

LGTM.

>> 2) Also remove the current C-u C-u C-u arg and make it the default
>>    when a region is active.
>> ...
>> (2) should be done anyway.
>
> I studied this further and what you suggest will interfere with
> `org-link-context-for-files'. It will no longer be possible to select
> text <from here>very long
> and multi-line link description<to here>, M-x org-store-link, and get
> the selected text as stored link description.
>
> The current default of using active region as description makes more
> sense, IMHO.

Indeed.

So I was not that stupid when I added this C-u C-u C-u option :)

Thanks!

-- 
 Bastien Guerry


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

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-14 16:29                             ` Bastien Guerry
@ 2023-08-15 10:55                               ` Ihor Radchenko
  2023-08-16 13:20                                 ` Bastien Guerry
  0 siblings, 1 reply; 52+ messages in thread
From: Ihor Radchenko @ 2023-08-15 10:55 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Anthony Carrico, emacs-orgmode

Bastien Guerry <bzg@gnu.org> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> See the attached tentative patch.
>
> LGTM.

Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6954fe93e

-- 
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] 52+ messages in thread

* Re: [PATCH] Re: what is the purpose of "This link has already been stored"?
  2023-08-15 10:55                               ` Ihor Radchenko
@ 2023-08-16 13:20                                 ` Bastien Guerry
  0 siblings, 0 replies; 52+ messages in thread
From: Bastien Guerry @ 2023-08-16 13:20 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Anthony Carrico, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Applied, onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6954fe93e

Thanks!

-- 
 Bastien Guerry


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

end of thread, other threads:[~2023-08-16 13:21 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28  1:35 what is the purpose of "This link has already been stored"? Samuel Wales
2023-06-28  9:32 ` Ihor Radchenko
2023-06-28 16:19   ` Anthony Carrico
2023-06-28 16:48     ` Ihor Radchenko
2023-06-28 23:59   ` Samuel Wales
2023-06-29  0:04     ` Samuel Wales
2023-06-29  0:07       ` Samuel Wales
2023-06-29 10:28         ` Ihor Radchenko
2023-06-29 13:02           ` Anthony Carrico
2023-06-29 13:09             ` Ihor Radchenko
2023-06-30  3:00               ` Samuel Wales
2023-06-30  3:26                 ` Samuel Wales
2023-07-05 10:19               ` [PATCH] " Ihor Radchenko
2023-07-06  0:28                 ` Samuel Wales
2023-07-15 12:35                 ` Ihor Radchenko
2023-07-21  4:13                   ` Samuel Wales
2023-07-21  7:46                     ` Ihor Radchenko
2023-08-06 18:47                 ` Bastien
2023-08-06 20:53                   ` Samuel Wales
2023-08-08  9:08                     ` Ihor Radchenko
2023-08-08  9:04                   ` Ihor Radchenko
2023-08-08 13:37                     ` Bastien Guerry
2023-08-11  9:31                       ` Ihor Radchenko
2023-08-13  9:34                         ` Bastien Guerry
2023-08-13 10:32                           ` Ihor Radchenko
2023-08-14  0:36                             ` Samuel Wales
2023-08-14 10:19                               ` Ihor Radchenko
2023-08-14 10:51                           ` Ihor Radchenko
2023-08-14 16:29                             ` Bastien Guerry
2023-08-15 10:55                               ` Ihor Radchenko
2023-08-16 13:20                                 ` Bastien Guerry
2023-07-01  4:48 ` org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?) Max Nikulin
2023-07-01  5:15   ` Samuel Wales
2023-07-01  5:26     ` Samuel Wales
2023-07-01  6:12     ` Max Nikulin
2023-07-02  3:29       ` Max Nikulin
2023-07-02  5:02         ` Samuel Wales
2023-07-02  5:52           ` Max Nikulin
2023-07-02  6:03             ` Samuel Wales
2023-07-03 14:56               ` Max Nikulin
2023-07-03 23:28                 ` Samuel Wales
2023-07-03 23:42                   ` Samuel Wales
2023-07-03 23:48                   ` Samuel Wales
2023-07-03 23:49                     ` Samuel Wales
2023-07-03 23:50                       ` Samuel Wales
2023-07-04  0:27                         ` Samuel Wales
2023-07-04  0:28                           ` Samuel Wales
2023-07-04  1:45                             ` Max Nikulin
2023-07-04  2:29                               ` Samuel Wales
2023-07-04  9:31                                 ` Ihor Radchenko
2023-07-05  0:10                                   ` Samuel Wales
2023-07-05 11:00                                     ` Ihor Radchenko

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