From: Kyle Meyer <kyle@kyleam.com> To: piem@inbox.kyleam.com Cc: Xinglu Chen <public@yoctocell.xyz> Subject: [PATCH 3/5] piem-copy-mid-url: Add support for browsing url Date: Sun, 7 Feb 2021 02:57:36 -0500 Message-ID: <20210207075738.8752-4-kyle@kyleam.com> (raw) In-Reply-To: <20210207075738.8752-1-kyle@kyleam.com> 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. --- piem.el | 23 ++++++++++++++--------- 1 file 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 @@ (defun piem-mid-url (mid &optional 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))))) \f ;;;; Download helpers -- 2.30.0
next prev parent reply other threads:[~2021-02-07 7:57 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-07 7:57 [PATCH 0/5] New command for copying public-inbox URLs Kyle Meyer 2021-02-07 7:57 ` [PATCH 1/5] piem: Add helper to construct message ID link Kyle Meyer 2021-02-07 7:57 ` [PATCH 2/5] piem-dispatch: Add command for copying public-inbox URLs Kyle Meyer 2021-02-07 7:57 ` Kyle Meyer [this message] 2021-02-07 7:57 ` [PATCH 4/5] piem-copy-mid-url: Allow overriding browse-url-browser-function Kyle Meyer 2021-02-07 7:57 ` [PATCH 5/5] manual: Add section on "copy public-inbox link" functionality Kyle Meyer 2021-02-07 12:38 ` [PATCH 0/5] New command for copying public-inbox URLs Xinglu Chen 2021-02-07 16:57 ` Kyle Meyer 2021-02-07 17:35 ` Kyle Meyer 2021-02-07 20:25 ` Xinglu Chen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://git.kyleam.com/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210207075738.8752-4-kyle@kyleam.com \ --to=kyle@kyleam.com \ --cc=piem@inbox.kyleam.com \ --cc=public@yoctocell.xyz \ --subject='Re: [PATCH 3/5] piem-copy-mid-url: Add support for browsing url' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
discussion and development of piem This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.kyleam.com/piem/0 piem/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 piem piem/ https://inbox.kyleam.com/piem \ piem@inbox.kyleam.com public-inbox-index piem Example config snippet for mirrors. Newsgroup available over NNTP: nntp://news.yhetil.org/yhetil.emacs.piem code repositories for project(s) associated with this inbox: https://git.kyleam.com/piem/ AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git