Likely introduced by c2785d636804cd23b90eec4388cf4e5624f5e003.
No error, the prompt for the compilation command should appear.
Error.
Call M-x projectile-compile-project.
Projectile version: 20160723.622
$ emacs-snapshot --version
GNU Emacs 25.0.50.1
Ubuntu 14.04
Same with projectile-find-test-file, and projectile-toggle-between-implementation-and-test.
Trashing ~/.emacs.d/elpa and/or wiping out *.elc files does not help.
For my fellow hapless users stumbling on this issue: a simple workaround is to evaluate this:
(fset 'projectile-go-function 'projectile-go)
I don't feel like touching my .emacs.d for this, so I just type that into the *scratch* buffer and evaluate it with C-M-x when I start emacs (which is pretty infrequently!)
I can't immediately figure out what went wrong. The defcustom is supposed to be a function. @malabarba any idea what have I messed up?
I think you shouldn't be quoting projectile-go-function on this line: https://github.com/bbatsov/projectile/commit/c2785d636804cd23b90eec4388cf4e5624f5e003#diff-e350afa47840c07f4dbf92840e4f8cfaR1874
The way it's now the symbol is getting called as a function, instead of its variable value being called.
Ops. You're absolutely right. Silly me. :-)
:)
Now projectile doesn't load at all.
Updated to the latest projectile 20160727.748 from melpa.
Compiling file /home/desmondhayes/.emacs.d/elpa/projectile-20160727.748/projectile.el at Wed Jul 27 20:28:49 2016
projectile.el:1875:39:Warning: reference to free variable
`projectile-go-function'
Me too - I'm getting
Symbol's value as variable is void: projectile-go-function
Same here, likely Emacs will complain variable is void every time you try to initialize it.
Looks like the issue is that the line should be:
(projectile-register-project-type 'go #'projectile-go-function "go build ./..." "go test ./...")
Instead of:
(projectile-register-project-type 'go projectile-go-function "go build ./..." "go test ./...")
Making that change fixes it for me.
@bitwalker It was anyways quoted earlier and this 'fix' commit broke it.
~I do not use projectile-go-function, but just quoting it back fixed the problem for me too.~
Actually the correct fix is to simply move the projective-go-function defcustom form before the first use of the projectile-go-function variable in the (projectile-register-project-type 'go projectile-go-function "go build ./..." "go test ./...") line.
I now have this and it works:
(defcustom projectile-go-function 'projectile-go
"Function to determine if project's type is go."
:group 'projectile
:type 'function)
(projectile-register-project-type 'emacs-cask '("Cask") "cask install")
;; snip
(projectile-register-project-type 'go projectile-go-function "go build ./..." "go test ./...")
@kaushalmodi I just changed it to work the same way as projectile-cabal, projectile-go-function was only quoted earlier, not sharp-quoted, at least since I popped into this thread. Anyhow, your fix looks like it works as well, just a different approach.
@bitwalker when trying to compile locally I think there's a difference between a defun function and a defcustom variable where you can #' the defun function later on but not the defcustom variable. I had the #' fix in a pull request, but couldn't get the tests to pass when running make test and @kaushalmodi 's suggestion works.
@bitwalker
I just changed it to work the same way as projectile-cabal
I use neither cabal nor go, but looking at the code, there's a major difference between projectile-cabal and projectile-go-function ..
projectile-register-project-type expects "marker files". These could either be a direct list of files, or a function that returns such a list, or a variable that holds a function name that returns that list.projectile-cabal is a function that returns such a list, so it is hash-quoted.projectile-go-function is a variable that holds the function name projectile-go and projectile-go is a function that returns the marker files list. So projectile-go-function, being just a variable (and not a function) must not be hash-quoted.(setq foo "bar"), 'foo will return just 'foo because it is quoted. But foo will return "bar". As we first need to evaluate projectile-go-function so that we get the function name it holds (projectile-go), it must not be quoted.defcustom or defvar or something before it is used for the first time. So that defcustom has to be moved above the point of its first use.@kaushalmodi makes sense now that you've explained it :) thanks!
I still experience that on version 20200810.544...
Most helpful comment
Now projectile doesn't load at all.
Updated to the latest projectile 20160727.748 from melpa.