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 +FTTL9h3SF8rcgAAsNZ9tg (envelope-from ) for ; Fri, 28 Aug 2020 03:19:52 +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 wJCrK9h3SF/VfwAAB5/wlQ (envelope-from ) for ; Fri, 28 Aug 2020 03:19:52 +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 7C8D69404C3 for ; Fri, 28 Aug 2020 03:19:52 +0000 (UTC) Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 831B88A728; Thu, 27 Aug 2020 23:19:50 -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=BQk7RU8HC2e8k8AFTqo+2BZ8g MI=; b=gD0n/2VWXe+pecNa0g7PvPh8bQUHo0E5OENRkTYR347lDHty68WcTEgf1 mAGUu50iPKeL5krjwaEKAJfrr1N5ONucILtDNW0+l9JMZKNZtxAcft6KCvushKgF 0B+oblLp1JWlWNyFC5Jy1kGubWGdzV880eBPBw2O2mtjN5fbws= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 7C0F48A725; Thu, 27 Aug 2020 23:19:50 -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=G7w08KaCj8Im41x/Vz5OTqhtcEEyWwcYQIbf0KH9YlI=; b=P31H7+xmOpgBB0ohBTV8/LVo4YRUnPkbv5gxwZ7RGjhcORAyhFayMtUGQZX9JpKv226ggFUtpotubaP7PVRzOeNe9qJyqs3/aRu9SsU0VLLVzMADCygjZ/olEZvtX/z3IqHDxCmtHPPZzoUKhMebC1Yo22b4PMWn4Ork6JhwrnA= 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 E78348A724; Thu, 27 Aug 2020 23:19:49 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: piem@inbox.kyleam.com Subject: [PATCH 3/4] piem-inbox-{codrepo,get}: Allow caller to specify inbox Date: Thu, 27 Aug 2020 23:19:19 -0400 Message-Id: <20200828031920.7515-4-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: 54FF8492-E8DD-11EA-89D2-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=gD0n/2VW; dkim=fail (body hash did not verify) header.d=kyleam.com header.s=mesmtp header.b=P31H7+xm; 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: mmV36tFMPxuY All the callers at the moment only care about the current inbox, but this is still useful for avoiding a repeated call to piem-inbox (and an upcoming commit will use it to do so). --- piem.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/piem.el b/piem.el index 6102b0f..4b840cb 100644 --- a/piem.el +++ b/piem.el @@ -298,14 +298,15 @@ (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))) +(defun piem-inbox-get (key &optional inbox) + "Get info KEY for INBOX's entry in `piem-inboxes'. +If INBOX is nil, use the inbox returned by `piem-inbox'." + (when-let ((p (or inbox (piem-inbox)))) (plist-get (cdr (assoc p piem-inboxes)) key))) =20 -(defun piem-inbox-coderepo () +(defun piem-inbox-coderepo (&optional inbox) "Return the code repository of current buffer's inbox." - (when-let ((repo (piem-inbox-get :coderepo))) + (when-let ((repo (piem-inbox-get :coderepo inbox))) (expand-file-name repo))) =20 (defun piem-inbox-by-url-match (url) --=20 2.28.0