branch: elpa/systemd
commit e52a5da19e8affdfc782952c1de0b83128b3b14a
Author: Mark Oteiza <[email protected]>
Commit: Mark Oteiza <[email protected]>
find a default uri harder
saves a keystroke if there is only one link
---
systemd-mode.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/systemd-mode.el b/systemd-mode.el
index 90ef1c8..a2fe7db 100644
--- a/systemd-mode.el
+++ b/systemd-mode.el
@@ -90,11 +90,13 @@ as a list of strings, otherwise nil."
"Open URL. Interactively completes the documentation in the
current unit file, defaulting to the link under point, if any."
(interactive
- (let* ((uri (thing-at-point-url-at-point))
+ (let* ((collection (systemd-doc-find))
+ (uri (or (thing-at-point-url-at-point)
+ (car-safe collection)))
(prompt (concat "URL"
(when uri (format " (default %s)" uri))
": ")))
- (list (completing-read prompt (systemd-doc-find) nil nil nil nil uri))))
+ (list (completing-read prompt collection nil nil nil nil uri))))
(let ((link (url-generic-parse-url url)))
(pcase (url-type link)
("file" (find-file (url-filename link)))