aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-08-27 23:19:19 -0400
committerKyle Meyer <kyle@kyleam.com>2020-08-28 23:05:56 -0400
commit673811ea1b2285059ab36e09c42682cd2d21686f (patch)
tree6bc347a2b8c61119e03f9a05b0074d221601ba91
parent486b554144843b8e30d69ca9ea9f0b11aadfff20 (diff)
downloadpiem-673811ea1b2285059ab36e09c42682cd2d21686f.tar.gz
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>
-rw-r--r--piem.el11
1 files 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)