emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ol.el: Restore complete by description for insert link


From: Tim Cross
Subject: Re: [PATCH] ol.el: Restore complete by description for insert link
Date: Sun, 11 Sep 2022 05:19:09 +1000
User-agent: mu4e 1.9.0; emacs 29.0.50

Max Nikulin <manikulin@gmail.com> writes:

> 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
>
> [2. text/x-patch; 
> 0001-ol.el-Restore-complete-by-description-for-insert-lin.patch]...

You don't appear to be getting a lot of feedback on this. However, I
think it is important work your doing. I suspect the lack of feedback is
partially due to Emacs' completion infrastructure being somewhat
confusing, combined with references to ido, which I suspect is one of
the less popular completion frameworks these days. .

My take on this, which might be completely wrong, is that org-mode
should not cater for or support any specific completion
framework. Things like ido, icomplete, fido, vertico, corfu, et. al. are
something which should be supported in a generic and abstract manner
i.e. we just provide minimal necessary code to generate the candidates
these systems use. From your description, I think this is what your
doing. Perhaps the requirements might become clearer if you also tried
other completion frameworks, like fido, icomplete and vertico.

I think there has been a fair bit of work in this area in recent
versions of Emacs (i.e. Emacs 28). I also quite like packages like
vertico, corfu and embark because unlike other frameworks, they work
hard to be based on just core Emacs features/functionality and avoid
adding new libraries or re-implementing existing functionality in a new
library. THis tends to make the smaller and with better core Emacs
compatibility (main reason I don't like helm and to a lesser extent,
ivy). 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]