From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id IIX3On6dH2CWTwAAsNZ9tg (envelope-from ); Sun, 07 Feb 2021 07:57:50 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SAF2J3ydH2AREwAAB5/wlQ (envelope-from ); Sun, 07 Feb 2021 07:57:48 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1612684668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vrkeqTi/evLQHxYs7aGb/uk+BfZQsOV94Qh9+o2T7CY=; b=V4Jn7DPKDXQ9FMCJJVyYtT3FZ0LLXbPofm+1IDvo3Xf2Ip2e/1jhy2G2hSFhntHBooPlVS StmWyggKPVgLPA+3UgB8zU323BrakoGiz780WvEfOD37hGxNpS8Gb0kOTnv/kuytdbhokX 7uCeFMS0yH0uTkukFWs+wETaTJD1nFV9lFSQeDr34Mm/ScofzsqFmK5buMY5NunIz+9y8L 7SbJgb6XLv6p8Djl2h29kt0vbxh5TOOvukT9yx5PGsoYCDnxXfoyNQb62ZwvZV7W060A6a 8E3lZg6HOB1jHKdYFkkpc0m9NtFIoxlRw8QtnAUCQmyIuDIiOHG53XRcqlynvw== From: Kyle Meyer To: piem@inbox.kyleam.com Cc: Xinglu Chen 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> In-Reply-To: <20210207075738.8752-1-kyle@kyleam.com> References: <20210207075738.8752-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: ppjgRzErJHp+ 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))))) ;;;; Download helpers -- 2.30.0