discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: piem@inbox.kyleam.com
Subject: [PATCH 03/10] lei: Introduce option to set "lei" executable
Date: Sun, 24 Oct 2021 23:56:23 -0400	[thread overview]
Message-ID: <20211025035630.297598-4-kyle@kyleam.com> (raw)
In-Reply-To: <20211025035630.297598-1-kyle@kyleam.com>

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.
---
 piem-lei.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/piem-lei.el b/piem-lei.el
index 6fb659c9..904bf972 100644
--- a/piem-lei.el
+++ b/piem-lei.el
@@ -33,6 +33,10 @@ (defgroup piem-lei nil
   "lei integration for piem."
   :group 'piem)
 
+(defcustom piem-lei-lei-executable "lei"
+  "Which lei executable to use."
+  :type 'string)
+
 \f
 ;;;; Message display
 
@@ -120,7 +124,7 @@ (defun piem-lei-show (mid &optional display)
   (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 @@ (defun piem-lei-query (query)
   (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 @@ (defun piem-lei-query--format-thread-marker (level)
 
 (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 @@ (defun piem-lei-get-inbox ()
   "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 @@ (defun piem-lei-known-mid-p (mid)
 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 @@ (defun piem-lei-mid-to-thread (mid)
   "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)))))
 
-- 
2.33.1


  parent reply	other threads:[~2021-10-25  3:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25  3:56 [PATCH 00/10] lei-q transient Kyle Meyer
2021-10-25  3:56 ` [PATCH 01/10] piem-lei-query-show: Fix capitalization in error message Kyle Meyer
2021-10-25  3:56 ` [PATCH 02/10] piem-lei-known-mid-p: Use with-output-to-string Kyle Meyer
2021-10-25  3:56 ` Kyle Meyer [this message]
2021-10-25  3:56 ` [PATCH 04/10] lei: Add call-process wrapper for inserting lei output Kyle Meyer
2021-10-25  3:56 ` [PATCH 05/10] piem-lei-insert-output: Signal an error if lei call fails Kyle Meyer
2021-10-25  3:56 ` [PATCH 06/10] lei: Add transient wrapper for piem-lei-query Kyle Meyer
2021-10-25  3:56 ` [PATCH 07/10] lei: Set piem-lei-buffer-query for mid-based query functions Kyle Meyer
2021-10-25  3:56 ` [PATCH 08/10] piem: Add function that returns public-inbox's configuration file Kyle Meyer
2021-10-25  3:56 ` [PATCH 09/10] lei q: Offer candidates for --include and --only Kyle Meyer
2021-10-25  3:56 ` [PATCH 10/10] lei: Rename piem-lei-show-mid to piem-lei-buffer-mid Kyle Meyer
2021-10-26  2:49   ` 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=20211025035630.297598-4-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.kyleam.com/piem/

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