From 85ba522df1c4e042528c6b8524fecd41dc218675 Mon Sep 17 00:00:00 2001
From: Gene Pasquet <dev@etenil.net>
Date: Tue, 15 Nov 2022 15:00:51 +0000
Subject: Make barb path configurable.

---
 README.md    | 7 +++++++
 barb-mode.el | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 17f18ed..8887be4 100644
--- a/README.md
+++ b/README.md
@@ -39,3 +39,10 @@ In order to execute a barb file, the
 must be installed on your system and on the `PATH`. Then pressing `C-c
 C-c` should work.
 
+If your barb executable cannot be found or has a different name than
+`barb`, you can configure *barb-mode* to use it instead like so:
+
+```lisp
+(setq barb-mode-exec "/path/to/my/barb")
+```
+
diff --git a/barb-mode.el b/barb-mode.el
index aa79110..ba296ce 100644
--- a/barb-mode.el
+++ b/barb-mode.el
@@ -11,6 +11,9 @@
   (let ((st (make-syntax-table)))
     st))
 
+(defcustom barb-mode-exec "barb"
+  "Path to or name of the `barb' executable.")
+
 (defun barb-indent-line ()
   "Indent the current line - I do nothing."
   (save-excursion
@@ -36,7 +39,7 @@
     (let ((active-buf (current-buffer)))
       (with-output-to-temp-buffer "*barb*"
         (let ((buffer (get-buffer "*barb*")))
-          (call-process "/home/etenil/.cargo/bin/barb" nil buffer nil (buffer-file-name active-buf)))))))
+          (call-process barb-mode-exec nil buffer nil (buffer-file-name active-buf)))))))
 
 
 (defvar barb-mode-map
-- 
cgit v1.2.3