From 1ace49324d1f3e07b77f45ced0c6000774dc6f52 Mon Sep 17 00:00:00 2001 From: Ag Ibragimov Date: Sat, 7 Dec 2024 16:29:31 -0600 Subject: [PATCH] make the executable resolution more generic Suggested-by: Michiel Borkent https://github.com/babashka/neil/pull/247#issuecomment-2525326065 --- neil.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/neil.el b/neil.el index a78aa5d..561d227 100644 --- a/neil.el +++ b/neil.el @@ -65,14 +65,17 @@ Otherwise uses the given value." (defun neil--find-exe () "Returns absolute path to neil executable." (if-let* ((exe (cond + ;; it should work for `neil-executable-path' values like: + ;; "clj -M:neil" or "bb -Sdeps '...' -m babashka.neil" + ;; as well as simple: "neil" or "neil-cmd" likes. ((and (stringp neil-executable-path) - (string-match "^\\(clj\\|clojure\\)\\s-" neil-executable-path)) + (string-match "^\\([^ ]+\\)\\s-" neil-executable-path)) (replace-regexp-in-string - "^\\(clj\\|clojure\\)" + "^\\([^ ]+\\)" (executable-find (match-string 1 neil-executable-path)) neil-executable-path)) (t (executable-find (or neil-executable-path "neil")))))) - exe (user-error "Cannot find 'neil' executable. Ensure either 'neil', or 'clojure|clj' with :neil alias is available"))) + exe (user-error "Cannot find executable set in 'neil-executable-path'"))) ;;;###autoload (defun neil-find-clojure-package (&optional term)