From 673811ea1b2285059ab36e09c42682cd2d21686f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 27 Aug 2020 23:19:19 -0400 Subject: piem-inbox-{codrepo,get}: Allow caller to specify inbox 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). Message-Id: <20200828031920.7515-4-kyle@kyleam.com> --- 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 @@ intended to be used by libraries implementing a function for "Return the current buffer's inbox." (run-hook-with-args-until-success 'piem-get-inbox-functions)) -(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))) -(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))) (defun piem-inbox-by-url-match (url) -- cgit v1.2.3