Skip to content

Commit

Permalink
pick up the package name when in deps file (#195)
Browse files Browse the repository at this point in the history
* pick up the package name when in deps file

when called the command, it picks up the package name automatically if
the buffer's filename is deps.edn or project.clj

* add a check

urgggh... I hate elisp sometimes. symbol-name returns "nil" if you pass
nil to it and throws an error if you give it something like an empty
string. And there's no cond-> macro in elisp.
  • Loading branch information
agzam authored Nov 16, 2023
1 parent 7a12313 commit b8d7a16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion neil.el
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ name lets you choose its version.
With `neil-inject-dep-to-project-p' set to t, automatically adds
the dependency to the project (deps.edn only)."
(interactive
(list (read-from-minibuffer "Search for Clojure libs: ")))
(list (read-from-minibuffer
"Search for Clojure libs: "
(when (member (file-name-nondirectory (buffer-file-name))
'("deps.edn" "project.clj"))
(when-let ((sym (symbol-at-point)))
(symbol-name sym))))))
(let* ((format-dep-str
(lambda (lib-name version)
(let ((build-tool (car (neil--identify-project-build-tool))))
Expand Down

0 comments on commit b8d7a16

Please sign in to comment.