[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] ol: Avoid initial input when completing function for storing lin
From: |
Kyle Meyer |
Subject: |
[PATCH] ol: Avoid initial input when completing function for storing link |
Date: |
Sat, 02 Jan 2021 22:13:58 GMT |
John Kitchin writes:
> Recently I have had an issue where multiple functions may store a link,
> e.g. to a bibtex entry.
>
> In this case, org-mode seems to prompt me to ask which function to store
> the link with, with an initial input of the first function, which masks all
> the options that are available. This happens inside org-store-link in ol.el
> at line 1495 for me. in
>
> (apply #'org-link-store-props
> (cdr (assoc-string
> (completing-read
> "Which function for creating the link? "
> (mapcar #'car results-alist)
> nil t (symbol-name name))
> results-alist)))
>
> because of the (symbol-name name).
>
> Is there an easy way to avoid this, or to modify the order of the functions
> used? I want to see all the options for storing, or better, to just store
> them all and let me choose later when I use org-insert-link.
The "or better" sounds reasonable. Perhaps someone will attempt that,
but in the meantime I think just avoiding the discouraged/mostly
deprecated INITIAL-INPUT argument would be a good improvement.
-- >8 --
Subject: [PATCH] ol: Avoid initial input when completing function for storing
link
* lisp/ol.el (org-store-link): Use completing-read's DEF argument
rather than INITIAL-INPUT, which is discouraged (see Elisp manual) and
may hide the other choices depending on the completion framework.
Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Ref:
CAJ51ETqO9A8mE0W3pgU2cFzaZsESdYXAV0X-8veY+_V9AwPHdQ@mail.gmail.com">https://orgmode.org/list/CAJ51ETqO9A8mE0W3pgU2cFzaZsESdYXAV0X-8veY+_V9AwPHdQ@mail.gmail.com
---
lisp/ol.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lisp/ol.el b/lisp/ol.el
index 5ba813142..cf105786f 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1496,9 +1496,9 @@ (defun org-store-link (arg &optional interactive?)
(apply #'org-link-store-props
(cdr (assoc-string
(completing-read
- "Which function for creating the link? "
- (mapcar #'car results-alist)
- nil t (symbol-name name))
+ (format "Store link with (default %s): " name)
+ (mapcar #'car results-alist)
+ nil t nil nil (symbol-name name))
results-alist)))
t))))
(setq link (plist-get org-store-link-plist :link))
base-commit: 291993888d7b6776d42a86facd26c8bc0f72e475
--
2.29.2