Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clerk can fail to visualize file when editing with Emacs on MS-Windows #22

Closed
ikappaki opened this issue Dec 4, 2021 · 0 comments · Fixed by #23
Closed

clerk can fail to visualize file when editing with Emacs on MS-Windows #22

ikappaki opened this issue Dec 4, 2021 · 0 comments · Fixed by #23

Comments

@ikappaki
Copy link
Contributor

ikappaki commented Dec 4, 2021

Hi,

Clerk can fails to properly watch on file changes when using Emacs on MS-Windows, either with Emacs complaining that it can't unlock the file it is trying to save or with the following error message on the web browser:

Unhandled clojure.lang.ExceptionInfo
Could not resolve var: xxx
{:var chaos}

validate.clj: | 28 | clojure.tools.analyzer.passes.jvm.validate/eval10305/fn--10307
-- | -- | --
MultiFn.java: | 229 | clojure.lang.MultiFn
validate.clj: | 265 | clojure.tools.analyzer.passes.jvm.validate/validate
validate.clj: | 240 | clojure.tools.analyzer.passes.jvm.validate/validate
Var.java: | 384 | clojure.lang.Var
passes.clj: | 166 | clojure.tools.analyzer.passes/compile-passes/fn--8604/fn--8609
passes.clj: | 168 | clojure.tools.analyzer.passes/compile-passes/fn--8604/fn--8611
passes.clj: | 168 | clojure.tools.analyzer.passes/compile-passes/fn--8604/fn--8611
passes.clj: | 168 | clojure.tools.analyzer.passes/compile-passes/fn--8604/fn--8611
core.clj: | 2635 | clojure.core/partial/fn--5859
...

To reproduce using Emacs and Cider

  1. git clone https://github.com/nextjournal/clerk.git
  2. open clerk/notebooks/dice.clj in Emacs
  3. M-x cider-clj-jack-in RET clojure-cli
  4. insert the following somewhere into dice.clj but do not save the file
(comment
  (clerk/serve! {:browse? true})
  (clerk/serve! {:watch-paths ["notebooks"]})
)
  1. Eval the first form, a browser should open at localhost:7777
  2. Eval the second form, it should start watching for changes in the notebooks dir where dice.clj lives
  3. Try to save dice.clj, you either get the above error in the web browser or Emacs will complain it can't unlock the dice.clj file and nothing happens on the web page (the file stays unsaved).

The root cause for this is that Emacs creates a complimentary lock file named .#dice.clj alongside dice.clj to check for multiprocess access to the main file. It so happens that the lock file on MS-Widnows is a real file (rather than a symbolic link) with contents the name of the user and the process id that holds the lock. clerk might try to display the lock file (since it ends in .clj) and thus the error described earlier.

PR to follow.
Thanks,

@ikappaki ikappaki changed the title clerk could fail to visualize file when editing with Emacs on MS-Windows clerk can fail to visualize file when editing with Emacs on MS-Windows Dec 4, 2021
@mk mk closed this as completed in #23 Dec 8, 2021
mk added a commit that referenced this issue Dec 8, 2021
They aren't symlinks on Windows so Clerk will attempt to show them. Closes #22.

Co-authored-by: ikappaki <ikappaki@users.noreply.github.com>
Co-authored-by: Martin Kavalar <mk@katercalling.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant