From d0db4946a02e2f5f350836a18b82f55cfcf39115 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 24 Oct 2021 23:56:28 -0400 Subject: piem: Add function that returns public-inbox's configuration file piem--merge-config-inboxes determines public-inbox's configuration file by using PI_CONFIG if set, falling back to the hardcoded location. piem-lei.el will need to do the same, so move the logic into a function. Message-Id: <20211025035630.297598-9-kyle@kyleam.com> --- piem.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/piem.el b/piem.el index 31b9c71..afe6b7a 100644 --- a/piem.el +++ b/piem.el @@ -373,9 +373,13 @@ files." (defvar piem--inboxes 'unset) +(defun piem-public-inbox-config-file () + "Return public-inbox's configuration file." + (or (getenv "PI_CONFIG") + (expand-file-name "~/.public-inbox/config"))) + (defun piem--merge-config-inboxes () - (let ((cfg-file (or (getenv "PI_CONFIG") - (expand-file-name "~/.public-inbox/config")))) + (let ((cfg-file (piem-public-inbox-config-file))) (if (not (file-readable-p cfg-file)) (setq piem--inboxes piem-inboxes) (let ((case-fold-search t) -- cgit v1.2.3