Skip to content

Commit

Permalink
Emacs: neil.el should work with compound commands #2
Browse files Browse the repository at this point in the history
  • Loading branch information
agzam committed Dec 7, 2024
1 parent 7b5de27 commit cfc9cc4
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions neil.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ Otherwise uses the given value."
(let-alist (cdr (assoc s minibuffer-completion-table))
(concat " " .version " " .description)))

(defun neil--find-exe ()
"Returns absolute path to neil executable."
(if-let* ((exe (cond
((string-match-p "^clj\\s-" neil-executable-path)
(replace-regexp-in-string
"^clj"
(executable-find "clj")
neil-executable-path))
(t (executable-find (or neil-executable-path "neil"))))))
exe (user-error "Cannot find 'neil' executable. Ensure either 'neil', or 'clj' with :neil alias is available")))

;;;###autoload
(defun neil-find-clojure-package (&optional term)
"Find Clojure dependency by supplying TERM to neil cmd-line tool.
Expand All @@ -74,7 +85,7 @@ the dependency to the project (deps.edn only)."
"Search for Clojure libs: "
(when (member (file-name-nondirectory (or (buffer-file-name) ""))
'("deps.edn" "project.clj"))
(when-let ((sym (symbol-at-point)))
(when-let* ((sym (symbol-at-point)))
(symbol-name sym))))))
(let* ((format-dep-str
(lambda (lib-name version)
Expand Down Expand Up @@ -113,13 +124,7 @@ the dependency to the project (deps.edn only)."
(when desc `(description . ,desc)))))))
res))))

(exe (if-let* ((exe (thread-first
neil-executable-path
(or "neil")
split-string
car
executable-find)))
exe (user-error "Cannot find 'neil' cmd-line utility!")))
(exe (neil--find-exe))

(res (funcall perform-action exe (concat "dep search " (shell-quote-argument term))))
(lib-name (let ((completion-extra-properties
Expand Down

0 comments on commit cfc9cc4

Please sign in to comment.