From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id qJcsDPoqdmGzRAAAsNZ9tg (envelope-from ); Mon, 25 Oct 2021 03:56:42 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id CA4FCPoqdmEjPAAA1q6Kng (envelope-from ); Mon, 25 Oct 2021 03:56:42 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1635134202; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HD+2AqtCMVTU5hW/vHvGaDTVftET4mlJvuaLSOatVLA=; b=TC6g4+TA3f0V1Qel5YDrHBq/Weii14mCZi9v0eLFz93nY2w6f9wnpQk2xw2QYZzpLPJSgw nAIkCEbQxz86Y/sJjXIFHg3R7M8tFk3LrjCvHBS3ZsEqI62iYKMxcILu8OXtNPUDyeOY1S Yl8BLf4gkx/DPHfVB862slBzSaA4uC5HT3lYArKj4y7btISCwpZzkeWZM2Qoo13BxdSlhP ESw1zwt4dDTm09dyto9oaLu8HFm8UTwOP8CuDxZhpmwMIePI9kqirLZGd8uUF2amCOrQmF io84KC9QFyS/dGSoj2YDREDNKKwNix5o9v/HtXmSGGzgFv4+vHlg64wuHoRMzQ== From: Kyle Meyer 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 Message-Id: <20211025035630.297598-4-kyle@kyleam.com> In-Reply-To: <20211025035630.297598-1-kyle@kyleam.com> References: <20211025035630.297598-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: pPiqM00PKOFY 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) + ;;;; 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