From d334fd5c7c9195448dfef6cbc6ace119618e2fd1 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 24 Oct 2021 23:56:23 -0400 Subject: 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> --- piem-lei.el | 16 ++++++++++------ 1 file 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))))) -- cgit v1.2.3