diff --git a/lisp/org.el b/lisp/org.el index 72681d046..c5bb2b107 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9103,6 +9103,14 @@ Note: this function also decodes single byte encodings like (setq s (replace-match "%40" t t s))) s) +(defun org-link-prettify (link) + "Return a human-readable representation of LINK. +The car of LINK must be a raw link the cdr of LINK must be either +a link description or nil." + (let ((desc (or (cadr link) ""))) + (concat (format "%-45s" (substring desc 0 (min (length desc) 40))) + "[[" (car link) "]]"))) + ;;;###autoload (defun org-insert-link-global () "Insert a link like Org-mode does. @@ -9185,9 +9193,7 @@ be used as the default description." Use TAB to complete link prefixes, then RET for type-specific completion support\n") (when org-stored-links (princ "\nStored links are available with / or M-p/n (most recent with RET):\n\n") - (princ (mapconcat - (lambda (x) - (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x))) + (princ (mapconcat 'org-link-prettify (reverse org-stored-links) "\n")))) (let ((cw (selected-window))) (select-window (get-buffer-window "*Org Links*" 'visible)) @@ -9196,7 +9202,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (org-fit-window-to-buffer)) (and (window-live-p cw) (select-window cw))) ;; Fake a link history, containing the stored links. - (setq tmphist (append (mapcar 'car org-stored-links) + (setq tmphist (append (mapcar 'org-link-prettify org-stored-links) org-insert-link-history)) (setq all-prefixes (append (mapcar 'car org-link-abbrev-alist-local) (mapcar 'car org-link-abbrev-alist)