From: Ihor Radchenko <yantar92@gmail.com>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ol.el: Restore complete by description for insert link
Date: Sun, 11 Sep 2022 19:48:09 +0800 [thread overview]
Message-ID: <87mtb6w2rq.fsf@localhost> (raw)
In-Reply-To: <tfhqvm$qlf$1@ciao.gmane.io>
Max Nikulin <manikulin@gmail.com> writes:
> 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.
This sounds reasonable.
In general, there should be no need to care which completion backend is
used by Emacs - they should all plug into `completing-read' without
anything special to be done on Org side.
The only exception is possible not-yet-fixed bugs in earlier Emacs
versions. However, workaround for such issues should be clearly marked
by a comment in the code and removed once the problematic Emacs version
support is dropped.
> So I am attaching a patch to restore completion of link targets by their
> description, nil descriptions are filtered out.
Thanks!
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0432f4fe6ba9b07c17ac555beab1527d8f844234
> 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.
To be frank, org-insert-link should be eventually refactored or at least
better commented. This is one of the "old" functions in Org mode and its
code style is not ideal.
I think that the best approach to fix this and similar functions will be
discussing/documenting the overall design of the Org link
storage/completion. We can then work towards removing inconsistencies
and subtle bugs in the code.
Now, even not all the functionality of org-insert-link is described in
its docstring (like re-using selected region).
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92
prev parent reply other threads:[~2022-09-11 11:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 14:34 ido, org-insert-link, and completion based on link description Max Nikulin
2022-09-10 11:04 ` [PATCH] ol.el: Restore complete by description for insert link Max Nikulin
2022-09-10 19:19 ` Tim Cross
2022-09-11 12:02 ` Ihor Radchenko
2022-09-11 11:48 ` Ihor Radchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mtb6w2rq.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=manikulin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).