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

Already on GitHub? Sign in to your account

Crossovers, cljsbuild auto and Emacs open files #104

Closed
danskarda opened this Issue Jun 28, 2012 · 5 comments

Comments

Projects
None yet
2 participants

First: thank you for making lein-cljsbuild. It helps me a lot during my development :)

I have noticed an issue with cljsbuild auto when used together with crossovers. I think cljsbuild should be more picky about which files to copy and filter out editor working files.

My setup is:

src/foo/X.clj
src/foo/X/Y.clj
src/foo/X/Z.clj

and my project.clj:

:crossovers [foo/X]

i.e. I add both X and X.Y and X.Z to crossover. cljsbuild once is works fine , but I noticed following issues with cljsbuild auto.

  1. Open file foo/X/Y.clj in Emacs, and I get error (which repeats with some interval)

    Error copying crossovers: java.io.FileNotFoundException: /home/user/work/project/src/foo/X/. (Is a directory)

  2. Save the file

    Exception in thread "main" java.io.FileNotFoundException: Could not locate foo/X/.#Y__init.class or dx/mug/.#Y.clj on classpath: 
        at clojure.lang.RT.load(RT.java:432)
        at clojure.lang.RT.load(RT.java:400)
        at clojure.core$load$fn__4890.invoke(core.clj:5415)
        at clojure.core$load.doInvoke(core.clj:5414)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at cljsbuild.compiler$reload_clojure.invoke(compiler.clj:91)
        at cljsbuild.compiler$run_compiler.invoke(compiler.clj:114)
        at user$eval2452$iter__2455__2459$fn__2460.invoke(NO_SOURCE_FILE:1)
        at clojure.lang.LazySeq.sval(LazySeq.java:42)
        at clojure.lang.LazySeq.seq(LazySeq.java:60)
        at clojure.lang.RT.seq(RT.java:473)
        at clojure.core$seq.invoke(core.clj:133)
        at clojure.core$dorun.invoke(core.clj:2725)
        at clojure.core$doall.invoke(core.clj:2741)
        at user$eval2452.invoke(NO_SOURCE_FILE:1)
        at clojure.lang.Compiler.eval(Compiler.java:6511)
        at clojure.lang.Compiler.eval(Compiler.java:6501)
        at clojure.lang.Compiler.eval(Compiler.java:6477)
        at clojure.core$eval.invoke(core.clj:2797)
        at clojure.main$eval_opt.invoke(main.clj:297)
        at clojure.main$initialize.invoke(main.clj:316)
        at clojure.main$null_opt.invoke(main.clj:349)
        at clojure.main$main.doInvoke(main.clj:427)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.lang.Var.invoke(Var.java:419)
        at clojure.lang.AFn.applyToHelper(AFn.java:163)
        at clojure.lang.Var.applyTo(Var.java:532)
        at clojure.main.main(main.java:37)
Owner

emezeske commented Jul 2, 2012

I don't use emacs, so I don't know what it does when you open a file. I guess when you open Y.clj it creates a .Y.clj file in the same directory as a swap file?

When looking for source files to copy, lein-cljsbuild just looks for *.clj files. Since the dotfiles end in .clj, it considers them to be source files.

How do you propose that lein-cljsbuild should handle this? Should it just always ignore dotfiles? Or is that just an emacs convention? I don't want to add special editor-specific support to the plugin for every editor out there.

Hi Evan,
Emacs makes two kinds of temporary files:

  1. autosave file - for exmaple #foo.clj#
  2. locks - a symbolic link to file which does not exists

lrwxrwxrwx 1 0rfelyus 0rfelyus 44 Jul 3 11:19 .#foo.clj ->
0rfelyus@yamm.ucw.cz.3441:1341225229

for details, see
http://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html

I do not know how other editors handle lock files, backup, autosaves
I see three possible solutions:

  1. skip "hidden" dotfiles
  2. skip files which does not exist (symbolic link does not really exist)
  3. copy files which match regular expression (and emacs users might exclude
    dot files)

First option is probably hassle-free for most combinations, third is most
general.

Thanks,
Dan

On Mon, Jul 2, 2012 at 9:16 PM, Evan Mezeske <
reply@reply.github.com

wrote:

I don't use emacs, so I don't know what it does when you open a file. I
guess when you open Y.clj it creates a .Y.clj file in the same
directory as a swap file?

When looking for source files to copy, lein-cljsbuild just looks for
*.clj files. Since the dotfiles end in .clj, it considers them to be
source files.

How do you propose that lein-cljsbuild should handle this? Should it just
always ignore dotfiles? Or is that just an emacs convention? I don't want
to add special editor-specific support to the plugin for every editor out
there.


Reply to this email directly or view it on GitHub:
#104 (comment)

Owner

emezeske commented Jul 5, 2012

I think that option #1 is the best. I can't think of any situation where lein-cljsbuild should be looking at hidden files. I think I'll just change it to ignore hidden files all the time (for crossovers and otherwise).

emezeske added a commit that referenced this issue Jul 5, 2012

Owner

emezeske commented Jul 5, 2012

This should go out in the 0.2.3 release. If you could try it, to confirm that it fixes the problem for you, that would be great! You can basically just clone the repo, checkout the 0.2.3 branch, and run bin/test-install.sh to install it. (Don't worry if it complains about PhantomJS not being installed, that's just for the tests).

emezeske added a commit that referenced this issue Jul 5, 2012

@emezeske emezeske closed this Jul 5, 2012

Sorry for the late reply, I was off for a week. Many thanks for quick response and fix.
It works as expected, Emacs lock files are ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment