branch: externals/org
commit 0432f4fe6ba9b07c17ac555beab1527d8f844234
Author: Max Nikulin <maniku...@gmail.com>
Commit: Ihor Radchenko <yanta...@gmail.com>

    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.
    
    Link descriptions were added to completion options in
    the commit 1e34c5d34 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....@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 7f096ad37 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-d607e38d6...@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-a6a92c96c...@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-2232997c1...@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-1a652bb9f...@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.
---
 lisp/ol.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index 7e5398b22c..20b085682d 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -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)))

Reply via email to