Re: [Bug] org-insert-link removes on one link from 2 added by org-store-link

2023-07-23 Thread Samuel Wales
"in my case"

On 7/23/23, Max Nikulin  wrote:
> On 13/07/2023 10:34, Samuel Wales wrote:
>> link has already been stored is a bug in my case in that i can't just
>> go to a header, grab it [whether rabbed bfere or not] and then paste
>> it.  i surprise easily when the wrong link gets pasted.
>
> The message is not a bug, it tells me that I am trying to store a wrong
> link. The issue is that current implementation does not prevent
> appearance of multiple identical links after several cycles
> store-link/insert-link to the same heading.
>
> Whether stored links should be reordered depends on specific action, so
> a defcustom user option is not a rescue:
>
> 1. Collect links in certain order for `org-insert-org-links'. Duplicated
> link is a real error.
>
> 2. Copy link going to immediately insert it. Making the link the default
> one sounds reasonable. Perhaps the user still should be notified.
>
> So I disagree that "already stored" is a bug, but there is room for
> improvements.
>
>
>


-- 
The Kafka Pandemic

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



Re: [Bug] org-insert-link removes on one link from 2 added by org-store-link

2023-07-23 Thread Max Nikulin

On 13/07/2023 10:34, Samuel Wales wrote:

link has already been stored is a bug in my case in that i can't just
go to a header, grab it [whether rabbed bfere or not] and then paste
it.  i surprise easily when the wrong link gets pasted.


The message is not a bug, it tells me that I am trying to store a wrong 
link. The issue is that current implementation does not prevent 
appearance of multiple identical links after several cycles 
store-link/insert-link to the same heading.


Whether stored links should be reordered depends on specific action, so 
a defcustom user option is not a rescue:


1. Collect links in certain order for `org-insert-org-links'. Duplicated 
link is a real error.


2. Copy link going to immediately insert it. Making the link the default 
one sounds reasonable. Perhaps the user still should be notified.


So I disagree that "already stored" is a bug, but there is room for 
improvements.





Re: [Bug] org-insert-link removes on one link from 2 added by org-store-link

2023-07-12 Thread Samuel Wales
link has already been stored is a bug in my case in that i can't just
go to a header, grab it [whether rabbed bfere or not] and then paste
it.  i surprise easily when the wrong link gets pasted.

[also the id links with no desc and the prefix links do not help me
find the link i want to insert if it is opne previously.

in answer to a q by ihor, indeed puttig previously stored id liks as
descriptions in front of all the prefixes woudl be useful to me, but
idk who is doing the sorting, so idk whether it wold make a difference
but if it dos then gret..]

it seems org-insert-=inki is overloaded.  one use case says insert a
previously stored link.  the other says insert a brand new link which
i will now specify.  might it be useful to separate those two
functions?

On 7/12/23, Max Nikulin  wrote:
> On 02/07/2023 14:49, Ihor Radchenko wrote:
>> Max Nikulin  writes:
>>> M-x org-store-link adds 2 entries:
>>> - [[*title][title]]
>>> - [[#a-heading][title]]
>>>
>>> however `org-insert-link' (C-c C-l) removes from the stored link only
>>> one of them. As a result the number of unused stored links increases
>>> during an Emacs session.
>> Confirmed.
>> Not Urgent.
>
> Agree. I forgot to mention that the "This link has already been stored"
> feature works only for one link from this pair.
>
>
>
>


-- 
The Kafka Pandemic

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



Re: [Bug] org-insert-link removes on one link from 2 added by org-store-link

2023-07-12 Thread Max Nikulin

On 02/07/2023 14:49, Ihor Radchenko wrote:

Max Nikulin  writes:

M-x org-store-link adds 2 entries:
- [[*title][title]]
- [[#a-heading][title]]

however `org-insert-link' (C-c C-l) removes from the stored link only
one of them. As a result the number of unused stored links increases
during an Emacs session.

Confirmed.
Not Urgent.


Agree. I forgot to mention that the "This link has already been stored" 
feature works only for one link from this pair.






Re: [Bug] org-insert-link removes on one link from 2 added by org-store-link

2023-07-02 Thread Ihor Radchenko
Max Nikulin  writes:

> When some heading has the CUSTOM_ID property
>
>  8< 
> * title
> :PROPERTIES:
> :CUSTOM_ID: a-heading
> :END:
>  >8 
>
> M-x org-store-link adds 2 entries:
> - [[*title][title]]
> - [[#a-heading][title]]
>
> however `org-insert-link' (C-c C-l) removes from the stored link only 
> one of them. As a result the number of unused stored links increases 
> during an Emacs session.

Confirmed.
Not Urgent.

> My expectation is that
> - either `org-store-links' adds a single option (my preference is 
> #custom_id)

That could be a defcustom, maybe.

> - or `org-insert-link' removes the whole group.

> I have no idea how to implement second variant keeping backward 
> compatibility.

We can, for example, group the links into sub-lists in org-stored-links.
Or maintain a separate helper register that will keep track of the links
to be removed together.
That said, removing multiple lines by `org-insert-link' will most likely
be unexpected for some users.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at