From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id AHPELNZ3SF9KcwAAsNZ9tg (envelope-from ) for ; Fri, 28 Aug 2020 03:19:50 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id IJWQKNZ3SF+XAQAAB5/wlQ (envelope-from ) for ; Fri, 28 Aug 2020 03:19:50 +0000 Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 649939404CF for ; Fri, 28 Aug 2020 03:19:50 +0000 (UTC) Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 7BBF48A721; Thu, 27 Aug 2020 23:19:49 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=pVJtLgmDqfuVsI77VHMh7PhOp m4=; b=Er2UgrNnVbMUXB7nG8y6jhCiULO1IkkRAyXva3BJqe4wntQ4OCDCbcXP4 pET9XKFTb1x4TGjXWOiXM3y3fGlOGAdSlFcjR/enP/QBeth0TGhJeLjvUK9r+q0Z ETWZNdZGmB/kVOJcCmFB4DbseAGYNl6ozkS8AHoRMujU1HR1FM= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 72A768A720; Thu, 27 Aug 2020 23:19:49 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=mesmtp; bh=BBfgkEphbYLOddcmqCjgHVnrb+8neZ+nvFfDEjcP0Sk=; b=Su6PB3yWay7Jv5xnMMh8gcM1R/HObNYJX8AgZbMoiDE8zi/90CvJCyWG+2MymgN+ij9bHal7n7dRgtvC/GUiuHhiNSzTRHZ0Wn3EAdutNGUiHKFlDWKB0aRYL9Zc5F7SRkiX2l8/T2wkCT9syISW+zteuPHrL7M49vCkL54Uj6M= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id DED868A71F; Thu, 27 Aug 2020 23:19:48 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: piem@inbox.kyleam.com Subject: [PATCH 2/4] Add accessor for piem-inboxes Date: Thu, 27 Aug 2020 23:19:18 -0400 Message-Id: <20200828031920.7515-3-kyle@kyleam.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200828031920.7515-1-kyle@kyleam.com> References: <20200828031920.7515-1-kyle@kyleam.com> MIME-Version: 1.0 X-Pobox-Relay-ID: 5460E210-E8DD-11EA-85EA-01D9BED8090B-24757444!pb-smtp1.pobox.com Content-Transfer-Encoding: quoted-printable X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=Er2UgrNn; dkim=fail (body hash did not verify) header.d=kyleam.com header.s=mesmtp header.b=Su6PB3yW; dmarc=none; spf=pass (aspmx1.migadu.com: domain of kyle@kyleam.com designates 64.147.108.70 as permitted sender) smtp.mailfrom=kyle@kyleam.com X-Spam-Score: 2.50 X-TUID: seLnZsOKq9Bs There's no need to have a function like piem-inbox-url for every key. Drop piem-inbox-url, but keep piem-inbox-coderepo around because it does a bit of extra processing on top. --- piem-b4.el | 2 +- piem.el | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/piem-b4.el b/piem-b4.el index 6de0d2b..f5aa777 100644 --- a/piem-b4.el +++ b/piem-b4.el @@ -63,7 +63,7 @@ (defun piem-b4--get-am-files (mid coderepo args) ;; try to download it from a URL at `piem-inboxes'. Finally, fall ;; back to b4's configuration. (unless local-mbox-p - (when-let ((url (piem-inbox-url)) + (when-let ((url (piem-inbox-get :url)) (mid (piem-mid)) (buffer (condition-case nil (piem-download-and-decompress diff --git a/piem.el b/piem.el index f59f723..6102b0f 100644 --- a/piem.el +++ b/piem.el @@ -298,10 +298,14 @@ (defun piem-inbox () "Return the current buffer's inbox." (run-hook-with-args-until-success 'piem-get-inbox-functions)) =20 +(defun piem-inbox-get (key) + "Get info KEY for the inbox entry in `piem-inboxes'." + (when-let ((p (piem-inbox))) + (plist-get (cdr (assoc p piem-inboxes)) key))) + (defun piem-inbox-coderepo () "Return the code repository of current buffer's inbox." - (when-let ((p (piem-inbox)) - (repo (plist-get (cdr (assoc p piem-inboxes)) :coderepo))) + (when-let ((repo (piem-inbox-get :coderepo))) (expand-file-name repo))) =20 (defun piem-inbox-by-url-match (url) @@ -315,11 +319,6 @@ (defun piem-inbox-by-url-match (url) (when (string-match-p (regexp-quote p-url) url) (throw 'hit (car inbox))))))) =20 -(defun piem-inbox-url () - "Return the URL of current buffer's inbox." - (when-let ((p (piem-inbox))) - (plist-get (cdr (assoc p piem-inboxes)) :url))) - (defun piem-inbox-coderepo-maybe-read () "Like `piem-inbox-coderepo', but fall back to reading the repo." (let ((inbox @@ -495,7 +494,7 @@ (defun piem-inject-thread-into-maildir (mid &optional= message-only) "`piem-maildir-directory' does not look like a Maildir directory")) ((not (or message-only (piem-check-gunzip))) (user-error "gunzip executable not found"))) - (when-let ((url (concat (or (piem-inbox-url) + (when-let ((url (concat (or (piem-inbox-get :url) (user-error "Could not find inbox URL for current buf= fer")) mid --=20 2.28.0