On: Linux ripley 2.6.32-31-generic #61-Ubuntu SMP Fri Apr 8 18:25:51 UTC 2011 x86_64 GNU/Linux
with emacs: GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of 2011-03-04 on allspice, modified by Debian
ensime 0.5.0 wont start, becaus emacs pretends a variable called 'sps' to be void. When I change 'ensime-config.el':341+ to the code below it works:
(defun ensime-config-maybe-set-active-sbt-subproject (config)
"If the sbt-subprojects key exists in the config, prompt the
user for the desired subproject, and add an sbt-active-subproject
value to the config."
; (when-let (sps (plist-get config :sbt-subprojects))
(let ((sps (plist-get config :sbt-subprojects)))
;; For testing purposes..
(plist-get (car sps) :name))
;; Otherwise prompt the user
(let ((nm (plist-get sp :name)))
`(,nm . ,nm))) sps))
(keys (mapcar (lambda (opt) (car opt)) options)))
(let ((key (when keys
(concat "Which sbt subproject? ("
(mapconcat #'identity keys ", ")
keys nil t (car keys)))))
(when-let (chosen (cdr (assoc key options)))
(ensime-set-key config :sbt-active-subproject chosen)
I think this happens because of the circular dependency of ensime.el and ensime-config.el.
This problem occurrs when you're compiling the files in the wrong order and then loading the byte compiled files. Or when not having loaded the files before compiling, I think.
@aemmoncannon: could you refactor those bits'n'pieces required by several sub-modules in a single sub-module, ie. ensime-macros.el ?
I have a similar problem in ensime.el which leads to a "invalid-function ensime-with-connection-buffer" error when trying to enable ensime because that macro is used before it is defined.
To be fair, I should mention that I'm using byte-code-cache mode which auto-compiles .el files to .elc files in a different directory.
Since I don't byte-compile, I never hit this. But yes, it's a good idea to refactor so that byte-compilation works error-free.
I was able to bytecompile whole elisp directory.
Here is what I did:
1. sbt stage
2. Put elisp directory on load-path
3. Restart emacs or eval new load-path
4. Fire C-u 0 M-x byte-recompile-directory
5. Select elisp directory
Result: lots of warnings, 19 files compiled, 0 failed.
So I don't think this bug is still relevant.
@ancane: The problem is not byte-compiling, the problem is loading byte compiled files.
@tstgrub: After I byte-compile elisp directory, ensime starts and works fine pointed on it's own project. I can type-check, import, refactor ... I can't find any errors that you specified in this issue.
How do you load these files ?
To begin with, ensime-builder.el does not compile for me:
ensime-builder.el:23:1:Error: No setf-method known for ensime-builder-changed-files
But that's probably a different story.
When I do this (using Emacs GNU Emacs 184.108.40.206 (i386-mingw-nt6.1.7601), git HEAD as of now):
ensime-config-maybe-set-active-subproject: Symbol's function definition is void: sps
Unsurprisingly, since the code did not change, this bug is still alive.
As I said, it may depend on the byte compilation order. It probably just worked out for you by sheer luck...
The problem with sps will manifest if you compile ensime-config.el without having loaded ensime.el. An easy way to generate byte-compiled files that reproduce this is running (from the elisp directory) emacs -batch -L . -f batch-byte-compile *.el. Byte-compiling from an Emacs that's already loaded ensime might be a sufficient workaround.
emacs -batch -L . -f batch-byte-compile *.el
Has a fix been found for this bug? I'm hitting it too...
See https://gist.github.com/3794507 for a patch.
@tstgruby thanks! Can you please package this as a pull request against master?
I'm moving this to the next release milestone since we seem close to a solution.
when I tried to apply this patch, all the hunks failed. It looks like a version has been applied already.
If you still have problems, please open a new ticket... or better yet a pull request ;-)