Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-16 Thread Bastien Guerry
Ihor Radchenko  writes:

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

Thanks!

-- 
 Bastien Guerry



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-15 Thread Ihor Radchenko
Bastien Guerry  writes:

> Ihor Radchenko  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 .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-14 Thread Bastien Guerry
Ihor Radchenko  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 very long
> and multi-line link description, 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



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-14 Thread Ihor Radchenko
Bastien Guerry  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 very long
and multi-line link description, 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.

>From 7d8ed8f767c632bbb94f236fd08ee31e0d573e39 Mon Sep 17 00:00:00 2001
Message-ID: <7d8ed8f767c632bbb94f236fd08ee31e0d573e39.1692010108.git.yanta...@posteo.net>
From: Ihor Radchenko 
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  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


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

Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-14 Thread Ihor Radchenko
Samuel Wales  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 .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-13 Thread Samuel Wales
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  wrote:
> Bastien Guerry  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 .
> Support Org development at ,
> or support my work at 
>
>


-- 
The Kafka Pandemic

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



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-13 Thread Ihor Radchenko
Bastien Guerry  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 .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-13 Thread Bastien Guerry
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  writes:

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



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-11 Thread Ihor Radchenko
Bastien Guerry  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 .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-08 Thread Bastien Guerry
Ihor Radchenko  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



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-08 Thread Ihor Radchenko
Samuel Wales  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  type  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  file 
/path/to/file . 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 .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-08 Thread Ihor Radchenko
Bastien  writes:

> Ihor Radchenko  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 .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-06 Thread Samuel Wales
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  wrote:
> Ihor Radchenko  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



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-08-06 Thread Bastien
Ihor Radchenko  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



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-07-21 Thread Ihor Radchenko
Samuel Wales  writes:

> On 7/15/23, Ihor Radchenko  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 .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-07-20 Thread Samuel Wales
On 7/15/23, Ihor Radchenko  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



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-07-15 Thread Ihor Radchenko
Ihor Radchenko  writes:

> From a05e2cc235b10a7096538da4f6ae6d17c82a6b25 Mon Sep 17 00:00:00 2001
> Message-ID: 
> 
> From: Ihor Radchenko 
> 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 .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: what is the purpose of "This link has already been stored"?

2023-07-05 Thread Samuel Wales
On 7/5/23, Ihor Radchenko  wrote:
> Ihor Radchenko  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-05 Thread Ihor Radchenko
Samuel Wales  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 .
Support Org development at ,
or support my work at 



[PATCH] Re: what is the purpose of "This link has already been stored"?

2023-07-05 Thread Ihor Radchenko
Ihor Radchenko  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.
>From a05e2cc235b10a7096538da4f6ae6d17c82a6b25 Mon Sep 17 00:00:00 2001
Message-ID: 
From: Ihor Radchenko 
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 
Link: https://list.orgmode.org/orgmode/cajcao8sjd3_fx5pfq4git9wrdnm3bmqtgp-r5mm8zcf1b3m...@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  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


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org 

Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-04 Thread Samuel Wales
On 7/4/23, Ihor Radchenko  wrote:
> Samuel Wales  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 
> 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 .
> Support Org development at ,
> or support my work at 
>


-- 
The Kafka Pandemic

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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-04 Thread Ihor Radchenko
Samuel Wales  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 
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 .
Support Org development at ,
or support my work at 



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Samuel Wales
On 7/3/23, Max Nikulin  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.org2% 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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Max Nikulin

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






Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Samuel Wales
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  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  wrote:
>> maybe most folk are ok with 3 windows + minibuffer.  this is not useful
>> to
>> me.
>>
>> On 7/3/23, Samuel Wales  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  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  wrote:
> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
> completion imnibuffer.  not useful for me.
>
> On 7/3/23, Max Nikulin  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Samuel Wales
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  wrote:
> maybe most folk are ok with 3 windows + minibuffer.  this is not useful to
> me.
>
> On 7/3/23, Samuel Wales  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  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  wrote:
 defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
 completion imnibuffer.  not useful for me.

 On 7/3/23, Max Nikulin  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Samuel Wales
maybe most folk are ok with 3 windows + minibuffer.  this is not useful to me.

On 7/3/23, Samuel Wales  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  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  wrote:
>>> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
>>> completion imnibuffer.  not useful for me.
>>>
>>> On 7/3/23, Max Nikulin  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Samuel Wales
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  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  wrote:
>> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
>> completion imnibuffer.  not useful for me.
>>
>> On 7/3/23, Max Nikulin  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Samuel Wales
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  wrote:
> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
> completion imnibuffer.  not useful for me.
>
> On 7/3/23, Max Nikulin  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Samuel Wales
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  wrote:
> defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
> completion imnibuffer.  not useful for me.
>
> On 7/3/23, Max Nikulin  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Samuel Wales
defait cp[;etopm immediately makes 2 windows [orig+links] + expanded
completion imnibuffer.  not useful for me.

On 7/3/23, Max Nikulin  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-03 Thread Max Nikulin

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






Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-02 Thread Samuel Wales
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  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-01 Thread Max Nikulin

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





Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-01 Thread Samuel Wales
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  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-01 Thread Max Nikulin

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.






Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-07-01 Thread Max Nikulin

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.





Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-06-30 Thread Samuel Wales
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  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  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



Re: org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-06-30 Thread Samuel Wales
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  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



org-insert-link completion by description (Re: what is the purpose of "This link has already been stored"?)

2023-06-30 Thread Max Nikulin

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.





Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Samuel Wales
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  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  wrote:
>> Anthony Carrico  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 .
>> Support Org development at ,
>> or support my work at 
>>
>>
>
>
> --
> 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



Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Samuel Wales
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  wrote:
> Anthony Carrico  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 .
> Support Org development at ,
> or support my work at 
>
>


-- 
The Kafka Pandemic

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



Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Ihor Radchenko
Anthony Carrico  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 .
Support Org development at ,
or support my work at 



Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Anthony Carrico

On 6/29/23 06:28, Ihor Radchenko wrote:

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




Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Ihor Radchenko
Samuel Wales  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 .
Support Org development at ,
or support my work at 



Re: what is the purpose of "This link has already been stored"?

2023-06-28 Thread Samuel Wales
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  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  wrote:
>> On 6/28/23, Ihor Radchenko  wrote:
>>> This behaviour has been introduced in bb61b37ee
>>>
>>> bb61b37ee223fd89cf951a5fbf62e35e606a4646
>>> Author: Bastien 
>>> 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 .
>>> Support Org development at ,
>>> or support my work at 
>>>
>>
>>
>> --
>> 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



Re: what is the purpose of "This link has already been stored"?

2023-06-28 Thread Samuel Wales
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  wrote:
> On 6/28/23, Ihor Radchenko  wrote:
>> This behaviour has been introduced in bb61b37ee
>>
>> bb61b37ee223fd89cf951a5fbf62e35e606a4646
>> Author: Bastien 
>> 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 .
>> Support Org development at ,
>> or support my work at 
>>
>
>
> --
> 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



Re: what is the purpose of "This link has already been stored"?

2023-06-28 Thread Samuel Wales
On 6/28/23, Ihor Radchenko  wrote:
> This behaviour has been introduced in bb61b37ee
>
> bb61b37ee223fd89cf951a5fbf62e35e606a4646
> Author: Bastien 
> 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 .
> Support Org development at ,
> or support my work at 
>


-- 
The Kafka Pandemic

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



Re: what is the purpose of "This link has already been stored"?

2023-06-28 Thread Ihor Radchenko
Anthony Carrico  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:
>
>   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 .
Support Org development at ,
or support my work at 



Re: what is the purpose of "This link has already been stored"?

2023-06-28 Thread Anthony Carrico
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:


 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 



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




Re: what is the purpose of "This link has already been stored"?

2023-06-28 Thread Ihor Radchenko
Samuel Wales  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 
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 .
Support Org development at ,
or support my work at 



what is the purpose of "This link has already been stored"?

2023-06-27 Thread Samuel Wales
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