[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] ol.el: Restore complete by description for insert link
From: |
Max Nikulin |
Subject: |
[PATCH] ol.el: Restore complete by description for insert link |
Date: |
Sat, 10 Sep 2022 18:04:20 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 |
On 06/09/2022 21:34, Max Nikulin wrote:
Does anyone have an idea why it was necessary to drop completion of
stored links based on their description for the sake of ido?
I have no idea what is the proper way to enable ido for
`org-insert-link'. Functions and variables specific to ido were removed
from Org.
(ido-everywhere) and (ido-mode) are not enough.
I tried
(setq-local completing-read-function #'ido-completing-read)
and the command broke completing read completely.
(add-function :override completing-read-function #'ido-completing-read)
inspired by `ido-everywhere' code broke M-x, but it enabled ido for
`org-insert-link'.
I believe that descriptions as completion options were removed because
ido signals an error when nil is passed inside completion list. I
consider it as a bug in ido (at least in Emacs-27), but even when
`completing-read-default' is used, it causes appearance of undesired
"nil" option. No description is a frequent case for links.
So I am attaching a patch to restore completion of link targets by their
description, nil descriptions are filtered out.
The change is caused by the auto-desc local variable in
`org-insert-link', its usage is rather strange and confusing currently.
Despite with this patch descriptions are restored, I believe that
logic related to auto-desc should be removed, anyway it was broken for
10 years. I am unsure in which thread the next change should be discussed.
P.S. My question is related to the following threads:
- Carlos Pita. Adding target and custom id links doesn't ask for
description. Tue, 2 Aug 2022 14:44:58 -0300.
https://list.orgmode.org/D99A712C-18D1-4A4F-8093-35A0BFB469C4@gmail.com
- Max Nikulin. Re: Bug: org-store-link uses CUSTOM_ID instead of target
point. Sat, 6 Nov 2021 19:51:29 +0700.
https://list.orgmode.org/e2c807a7-1924-6f08-9e63-4f70aee9d3b5@gmail.com
0001-ol.el-Restore-complete-by-description-for-insert-lin.patch
Description: Text Data