]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-show.el
emacs: A prefix argument kills rather than browsing URLs
[notmuch] / emacs / notmuch-show.el
index 49fc779dad6d53995b5086bbecee199234b3b491..ef2bf1e0f44bd25ee41e95b39993aca61078359e 100644 (file)
@@ -2256,7 +2256,7 @@ message will be \"unarchived\", i.e. the tag changes in
           (notmuch-tag-change-list notmuch-archive-tags unarchive))))
 
 (defun notmuch-show-archive-message-then-next-or-exit ()
-  "Archive the current message, then show the next open message in the current thread.
+  "Archive current message, then show next open message in current thread.
 
 If at the last open message in the current thread, then exit back
 to search results."
@@ -2265,7 +2265,7 @@ to search results."
   (notmuch-show-next-open-message t))
 
 (defun notmuch-show-archive-message-then-next-or-next-thread ()
-  "Archive the current message, then show the next open message in the current thread.
+  "Archive current message, then show next open message in current or next thread.
 
 If at the last open message in the current thread, then show next
 thread from search."
@@ -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)