diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-02-07 02:57:36 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-02-07 12:38:51 -0500 |
commit | 59ab05cef5762bbb09868980014571385e9e3183 (patch) | |
tree | a26e6011842d8c1aadcd257629736119ec666c95 | |
parent | a369256fb94b4f61db06607500d26aaf01b9e5ea (diff) | |
download | piem-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.el | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -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 |