summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-10-24 23:56:23 -0400
committerKyle Meyer <kyle@kyleam.com>2021-10-25 22:49:56 -0400
commitd334fd5c7c9195448dfef6cbc6ace119618e2fd1 (patch)
tree670d42342a4a8080ecba5f0c2046fc6055350a04
parentb57090fedb703081216f68050930233eba9ee98f (diff)
downloadpiem-d334fd5c7c9195448dfef6cbc6ace119618e2fd1.tar.gz
lei: Introduce option to set "lei" executable
There are -executable options for git and b4, so for consistency add one for lei. And for things like Guix that prefer to expand executables to a full path, this makes it easier because there's just one spot to patch. Message-Id: <20211025035630.297598-4-kyle@kyleam.com>
-rw-r--r--piem-lei.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/piem-lei.el b/piem-lei.el
index 6fb659c..904bf97 100644
--- a/piem-lei.el
+++ b/piem-lei.el
@@ -33,6 +33,10 @@
"lei integration for piem."
:group 'piem)
+(defcustom piem-lei-lei-executable "lei"
+ "Which lei executable to use."
+ :type 'string)
+
;;;; Message display
@@ -120,7 +124,7 @@ unless DISPLAY is non-nil."
(with-current-buffer (get-buffer-create "*lei-show*")
(let ((inhibit-read-only t))
(erase-buffer)
- (call-process "lei" nil '(t nil) nil
+ (call-process piem-lei-lei-executable nil '(t nil) nil
"q" "--format=text" (concat "mid:" mid))
(goto-char (point-min))
(when (looking-at-p "# blob:")
@@ -210,7 +214,7 @@ QUERY is split according to `split-string-and-unquote'."
(with-current-buffer (get-buffer-create "*lei-query*")
(let ((inhibit-read-only t))
(erase-buffer)
- (apply #'call-process "lei" nil '(t nil) nil
+ (apply #'call-process piem-lei-lei-executable nil '(t nil) nil
"q" "--format=ldjson" query)
(goto-char (point-min))
(while (not (eobp))
@@ -483,7 +487,7 @@ Return a list with a `piem-lei-msg' object for each root."
(defun piem-lei-query--slurp (args)
(with-temp-buffer
- (apply #'call-process "lei" nil '(t nil) nil
+ (apply #'call-process piem-lei-lei-executable nil '(t nil) nil
"q" "--format=ldjson" args)
(goto-char (point-min))
(let (items)
@@ -570,7 +574,7 @@ Return a list with a `piem-lei-msg' object for each root."
"Return inbox name from a lei buffer."
(when-let ((mid (piem-lei-get-mid)))
(with-temp-buffer
- (call-process "lei" nil '(t nil) nil
+ (call-process piem-lei-lei-executable nil '(t nil) nil
"q" "--format=mboxrd" (concat "mid:" mid))
(goto-char (point-min))
(piem-inbox-by-header-match))))
@@ -580,7 +584,7 @@ Return a list with a `piem-lei-msg' object for each root."
The message ID should not include have surrounding brackets."
(not (string-empty-p
(with-output-to-string
- (call-process "lei"
+ (call-process piem-lei-lei-executable
nil (list standard-output nil) nil
"q" "--format=ldjson" (concat "mid:" mid))))))
@@ -588,7 +592,7 @@ The message ID should not include have surrounding brackets."
"Return a function that inserts an mbox for MID's thread."
(when (piem-lei-known-mid-p mid)
(lambda ()
- (call-process "lei" nil '(t nil) nil
+ (call-process piem-lei-lei-executable nil '(t nil) nil
"q" "--format=mboxrd" "--threads"
(concat "mid:" mid)))))