From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:267::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id yGyVK8a8HmCgJAAAsNZ9tg (envelope-from ) for ; Sat, 06 Feb 2021 15:59:02 +0000 Received: from out0.migadu.com ([2001:41d0:2:267::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yAFvHMS8HmCYLAAAbx9fmQ (envelope-from ) for ; Sat, 06 Feb 2021 15:59:00 +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=1612627140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tWySrTZli4jNv5qRvbiOc3BiKZO9TMPSXPZy8nb2R54=; b=ctFdET0lfMKL80gKDNT+G7P5wLjJEOJR1W9kauyd4RPq+mkMncAOB/K8nFvzWMMyHVT3CY aklwauqQFWf5ygVua+08iw/+co2c/msc95vc1eW7+9zD5N8caSsEbgEpvoE9s+5WYqXvbK 3/IAnp9WvRUVw1tmeK04jVcpvDN9Ezf1mZcGV8CzNM6ChqKgiCTUhAOiIVHSb0raKRlnAe hgRIZd5X93P0vugeCys9eQ8lA6bwsMA4PH1Wu35MPmwsZ3o5njjfG7hEGHSTpy/lO5FjBi fXZYYZZREbYAhBgfKWZ8pKFIxYb4H7Eq4OvifNS2ZW/6bnyrNmxPtKz1bXy+qA== From: Kyle Meyer To: Xinglu Chen Cc: piem@inbox.kyleam.com Subject: Re: [PATCH v2] notmuch: Configure mailing list archive links In-Reply-To: <8e8677cde716973081232aa65a37fa2fc621b15f.1612600790.git.public@yoctocell.xyz> References: <2ffe23775ec008feb763e24c29786fc5feddb975.1612544763.git.public@yoctocell.xyz> <8e8677cde716973081232aa65a37fa2fc621b15f.1612600790.git.public@yoctocell.xyz> Date: Sat, 06 Feb 2021 10:58:58 -0500 Message-ID: <878s81jigt.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: jMAyJN3kuPJJ Xinglu Chen writes: > This adds an entry to `notmuch-show-stash-ml-archive-link-alist` that > reads the `piem-inboxes` variable and returns the public-inbox archive > url. This means that users don't have to manually add public-inbox > archive urls to `notmuch-show-stash-ml-archive-link-alist`. s/notmuch-show-stash-ml-archive/notmuch-show-stash-mlarchive/ (fixed when applying) > +(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 (piem-notmuch-get-inbox)) > + (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)))) Looks good. I've also added a user-error when piem-notmuch-get-inbox returns nil to give an error that's slightly more informative than "No url was found for nil". > + > ;;;###autoload > (define-minor-mode piem-notmuch-mode > "Toggle Notmuch support for piem. > With a prefix argument ARG, enable piem-notmuch mode if ARG is > positive, and disable it otherwise. If called from Lisp, enable > -the mode if ARG is omitted or nil." > +the mode if ARG is omitted or nil. > + > +This will add a new entry to > +`notmuch-show-stash-mlarchive-link-alist' which till determine > +the archive url by reading the `piem-inboxes=E2=80=99 variable. You can > +also set `notmuch-show-shas-mlarchive-link-default' to \"piem\" Made a few typo fixes: s/will/till/ s/=E2=80=99/'/ s/notmuch-show-shas-/notmuch-show-stash-/ > +to make this the default behavior when calling > +`notmuch-show-stash-mlarchive-link'." Pushed (fad8d59). Thanks. diff --git a/piem-notmuch.el b/piem-notmuch.el index 2d6c5a3..27edfae 100644 --- a/piem-notmuch.el +++ b/piem-notmuch.el @@ -109,7 +109,8 @@ (defun piem-notmuch-am-ready-mbox () (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 (piem-notmuch-get-inbox)) + (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 @@ -119,14 +120,15 @@ (defun piem-notmuch-show-get-public-inbox-link (mid) ;;;###autoload (define-minor-mode piem-notmuch-mode "Toggle Notmuch support for piem. + With a prefix argument ARG, enable piem-notmuch mode if ARG is positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil. =20 This will add a new entry to -`notmuch-show-stash-mlarchive-link-alist' which till determine -the archive url by reading the `piem-inboxes=E2=80=99 variable. You can -also set `notmuch-show-shas-mlarchive-link-default' to \"piem\" +`notmuch-show-stash-mlarchive-link-alist' which will determine +the archive url by reading the `piem-inboxes' variable. You can +also set `notmuch-show-stash-mlarchive-link-default' to \"piem\" to make this the default behavior when calling `notmuch-show-stash-mlarchive-link'." :global t