discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
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	[thread overview]
Message-ID: <20200828031920.7515-4-kyle@kyleam.com> (raw)
In-Reply-To: <20200828031920.7515-1-kyle@kyleam.com>

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))
-(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)

  parent reply	other threads:[~2020-08-28  3:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28  3:19 [PATCH 0/4] eww, elfeed: Improve inbox and message ID detection Kyle Meyer
2020-08-28  3:19 ` [PATCH 1/4] elfeed, eww: Don't assume inbox name in piem-inboxes and URL match Kyle Meyer
2020-08-28  3:19 ` [PATCH 2/4] Add accessor for piem-inboxes Kyle Meyer
2020-08-28  3:19 ` Kyle Meyer [this message]
2020-08-28  3:19 ` [PATCH 4/4] elfeed, eww: Be stricter about the returned message ID Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://git.kyleam.com/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200828031920.7515-4-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).