Skip to content

Commit

Permalink
Fix file watcher regression (#28)
Browse files Browse the repository at this point in the history
`supported-file?` is given a path argument that cannot be coerced into a `java.io.File` unless a coercion is present on the classpath clojure-emacs/refactor-nrepl/issues/355.

Co-authored-by: ikappaki <ikappaki@users.noreply.github.com>
Co-authored-by: Martin Kavalar <mk@katercalling.com>
  • Loading branch information
3 people committed Dec 13, 2021
1 parent 9cde5ec commit 8ad8863
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/nextjournal/clerk.clj
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,14 @@
"Returns whether `path` points to a file that should be shown."
[path]
;; file names starting with .# are most likely Emacs lock files and should be ignored.
(->> path io/file .getName
(re-matches #"(?!^\.#).+\.(md|clj|cljc)$")
some?))

#_(supported-file? "foo_bar.clj")
#_(supported-file? "xyz/foo.md")
#_(supported-file? "xyz/foo.clj")
#_(supported-file? "xyz/abc.#name.cljc")
#_(supported-file? ".#name.clj")
#_(supported-file? "xyz/.#name.cljc")
(some? (re-matches #"(?!^\.#).+\.(md|clj|cljc)$" (.. path getFileName toString))))

#_(supported-file? (fs/path "foo_bar.clj"))
#_(supported-file? (fs/path "xyz/foo.md"))
#_(supported-file? (fs/path "xyz/foo.clj"))
#_(supported-file? (fs/path "xyz/a.#name.cljc"))
#_(supported-file? (fs/path ".#name.clj"))
#_(supported-file? (fs/path "xyz/.#name.cljc"))


(defn file-event [{:keys [type path]}]
Expand Down

0 comments on commit 8ad8863

Please sign in to comment.