* [PATCH] emacs: A prefix argument kills rather than browsing URLs
@ 2019-12-02 10:48 David Edmondson
2019-12-03 11:43 ` David Bremner
0 siblings, 1 reply; 2+ messages in thread
From: David Edmondson @ 2019-12-02 10:48 UTC (permalink / raw)
To: notmuch
In `notmuch-show', the "B" key (notmuch-show-browse-urls) will kill
the URL if called with a prefix argument rather than browsing
directly.
---
emacs/notmuch-show.el | 14 +++++++++-----
1 file 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)
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] emacs: A prefix argument kills rather than browsing URLs
2019-12-02 10:48 [PATCH] emacs: A prefix argument kills rather than browsing URLs David Edmondson
@ 2019-12-03 11:43 ` David Bremner
0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2019-12-03 11:43 UTC (permalink / raw)
To: David Edmondson, notmuch
David Edmondson <dme@dme.org> writes:
> In `notmuch-show', the "B" key (notmuch-show-browse-urls) will kill
> the URL if called with a prefix argument rather than browsing
> directly.
merged to master.
d
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-03 11:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 10:48 [PATCH] emacs: A prefix argument kills rather than browsing URLs David Edmondson
2019-12-03 11:43 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).