Skip to content

Commit

Permalink
ol.el: Restore complete by description for insert link
Browse files Browse the repository at this point in the history
* lisp/ol.el (org-insert-link): Allow completion of link target by its
description.  Almost certainly the feature was removed unintentionally.

Link descriptions were added to completion options in
the commit 1e34c5d Bastien Guerry,  "org.el: Fontify links to current
buffer when inserting a link", 2012-08-03 14:08:20 +0200
in response to
https://list.orgmode.org/877gw6ocva.fsf@okhotsk19.lowtem.hokudai.ac.jp/T/#u
Yagnesh Raghava Yakkala, "#+LABEL and CUSTOM_ID with reftex",
Mon, 21 May 2012 04:45:29 +0900

List of description was removed from completion options
likely because `ido-completing-read' signals an error in the case of nil
variant (that is not uncommon for links with no description), see the
commit 7f096ad Tony Day, "org-insert-link: Use ido when inserting
links", 2012-10-12 14:39:53 +1100 and the discussion of the patch
- https://list.orgmode.org/04D0E787-A8A1-4246-8DD2-D607E38D61BA@gmail.com/T/#u
  tony day.  [PATCH] * org-insert-link: use ido when inserting links.
  Fri, 12 Oct 2012 14:58:29 +1100
- https://list.orgmode.org/5CE03302-7C87-44BE-B4AF-A6A92C96C803@gmail.com/T/#u
  tony day.  [PATCH] org-insert-link: allow ido usage when inserting
  links.  Fri, 14 Sep 2012 19:21:50 +1000
- https://list.orgmode.org/0CADA13B-8A22-4F34-91B1-2232997C1F04@gmail.com/T/#u
  tony day.  [PATCH] org-insert-link: allow ido usage when inserting
  links. Fri, 12 Oct 2012 14:56:10 +1100
- https://list.orgmode.org/97F9790D-3C7F-490B-BE9B-1A652BB9F187@gmail.com/
  tony day.  PATCH: using ido when inserting links.
  Fri, 14 Sep 2012 18:58:43 +1000

Since auto-desc variable added by first commit was not removed
by second one, I assume that disabling the feature was a side effect
rather than the purpose.
  • Loading branch information
maxnikulin authored and yantar92 committed Sep 11, 2022
1 parent c9db3c5 commit 0432f4f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lisp/ol.el
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,12 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
"Link: "
(append
(mapcar (lambda (x) (concat x ":")) all-prefixes)
(mapcar #'car org-stored-links))
(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)))
Expand Down

0 comments on commit 0432f4f

Please sign in to comment.