aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-02-07 02:57:36 -0500
committerKyle Meyer <kyle@kyleam.com>2021-02-07 12:38:51 -0500
commit59ab05cef5762bbb09868980014571385e9e3183 (patch)
treea26e6011842d8c1aadcd257629736119ec666c95
parenta369256fb94b4f61db06607500d26aaf01b9e5ea (diff)
downloadpiem-59ab05cef5762bbb09868980014571385e9e3183.tar.gz
piem-copy-mid-url: Add support for browsing url
I find the notmuch-show-stash-mlarchive-link-and-go command useful. It's like notmuch-show-stash-mlarchive-link but calls browse-url on the copied URL. Make piem-copy-mid-url do the same when given a prefix argument. Message-Id: <20210207075738.8752-4-kyle@kyleam.com>
-rw-r--r--piem.el23
1 files changed, 14 insertions, 9 deletions
diff --git a/piem.el b/piem.el
index 0ed288a..5a646c5 100644
--- a/piem.el
+++ b/piem.el
@@ -37,6 +37,7 @@
;;; Code:
+(require 'browse-url)
(require 'cl-lib)
(require 'mail-extr)
(require 'message)
@@ -467,15 +468,19 @@ INBOX is nil, use the inbox returned by `piem-inbox'."
(or inbox "current buffer"))))
(piem-escape-mid mid)))
-(defun piem-copy-mid-url ()
- "Copy public-inbox URL for the current buffer's message."
- (interactive)
- (kill-new
- (message "%s"
- (piem-mid-url
- (or (piem-mid)
- (user-error "No message ID found for the current buffer"))
- (piem-inbox)))))
+(defun piem-copy-mid-url (&optional browse)
+ "Copy public-inbox URL for the current buffer's message.
+With prefix argument BROWSE, call `browse-url' on the URL
+afterwards."
+ (interactive "P")
+ (let ((url (piem-mid-url
+ (or (piem-mid)
+ (user-error "No message ID found for the current buffer"))
+ (piem-inbox))))
+ (prog1
+ (kill-new (message "%s" url))
+ (when browse
+ (browse-url url)))))
;;;; Download helpers