From e06a50377649da9af7a804ba225b400c87e11d40 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 7 Feb 2021 02:57:34 -0500 Subject: piem: Add helper to construct message ID link There are two spots that use (piem-inbox-get :url ...) and piem-escape-mid to construct the public-inbox link, and there is about to be another. Extract this shared logic. Cc: Xinglu Chen Message-Id: <20210207075738.8752-2-kyle@kyleam.com> --- piem-notmuch.el | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'piem-notmuch.el') diff --git a/piem-notmuch.el b/piem-notmuch.el index a222f3f..2a5c525 100644 --- a/piem-notmuch.el +++ b/piem-notmuch.el @@ -109,13 +109,9 @@ message itself if it looks like a patch." (defun piem-notmuch-show-get-public-inbox-link (mid) "Given the message-id MID, return the public-inbox url. This will lookup the url in the `piem-inboxes' variable." - (let* ((inbox (or (piem-notmuch-get-inbox) - (user-error "No inbox associated with current buffer"))) - (link (or (piem-inbox-get :url inbox) - (user-error "No url was found for %s" inbox)))) - (concat - (piem--ensure-trailing-slash link) - (piem-escape-mid mid)))) + (piem-mid-url mid + (or (piem-notmuch-get-inbox) + (user-error "No inbox associated with current buffer")))) ;;;###autoload (define-minor-mode piem-notmuch-mode -- cgit v1.2.3