aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmondson <dme@dme.org>2019-12-02 10:48:05 +0000
committerDavid Bremner <david@tethera.net>2019-12-03 07:41:38 -0400
commita1139fb5ec3a202229513e5202ea7cce72f9384a (patch)
treec174f629f185719b071e9c4426e1814811f71c54
parentdc2b5a031bb63cd71133237ca5d74ef1223a8925 (diff)
emacs: A prefix argument kills rather than browsing URLs
In `notmuch-show', the "B" key (notmuch-show-browse-urls) will kill the URL if called with a prefix argument rather than browsing directly.
-rw-r--r--emacs/notmuch-show.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e13ca3d7..ef2bf1e0 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -2540,12 +2540,16 @@ message."
(push (match-string-no-properties 0) urls))
(reverse urls))))
-(defun notmuch-show-browse-urls ()
- "Offer to browse any URLs in the current message."
- (interactive)
- (let ((urls (notmuch-show--gather-urls)))
+(defun notmuch-show-browse-urls (&optional kill)
+ "Offer to browse any URLs in the current message.
+With a prefix argument, copy the URL to the kill ring rather than
+browsing."
+ (interactive "P")
+ (let ((urls (notmuch-show--gather-urls))
+ (prompt (if kill "Copy URL to kill ring: " "Browse URL: "))
+ (fn (if kill #'kill-new #'browse-url)))
(if urls
- (browse-url (completing-read "Browse URL: " (cdr urls) nil nil (car urls)))
+ (funcall fn (completing-read prompt (cdr urls) nil nil (car urls)))
(message "No URLs found."))))
(provide 'notmuch-show)