Skip to content

Commit

Permalink
fix: breaks when called without file (#196)
Browse files Browse the repository at this point in the history
when the command called while in a buffer without a file, e.g.
cider-repl - it fails to work.
  • Loading branch information
agzam authored Nov 17, 2023
1 parent b8d7a16 commit 4099387
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions neil.el
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ the dependency to the project (deps.edn only)."
(interactive
(list (read-from-minibuffer
"Search for Clojure libs: "
(when (member (file-name-nondirectory (buffer-file-name))
(when (member (file-name-nondirectory (or (buffer-file-name) ""))
'("deps.edn" "project.clj"))
(when-let ((sym (symbol-at-point)))
(symbol-name sym))))))
Expand All @@ -99,9 +99,12 @@ the dependency to the project (deps.edn only)."
(split-string res "\n")))))
(seq-map
(lambda (s)
(rx-let ((dep-rx (seq ":lib " (group-n 1 (one-or-more graph))
(zero-or-one (seq blank ":version " (group-n 2 (one-or-more graph))))
(zero-or-one (seq blank ":description " (group-n 3 (one-or-more ascii)))))))
(rx-let ((dep-rx (seq
":lib " (group-n 1 (one-or-more graph))
(zero-or-one
(seq blank ":version " (group-n 2 (one-or-more graph))))
(zero-or-one
(seq blank ":description " (group-n 3 (one-or-more ascii)))))))
(string-match (rx dep-rx) s)
(let ((lib (match-string 1 s))
(ver (match-string 2 s))
Expand Down

0 comments on commit 4099387

Please sign in to comment.