When I attempt to autoload projectile like so

(autoload 'projectile-global-mode "projectile" " t nil)

And then open Emacs I cannot use projectile-switch-project (Symbol's function definition is void: projectile-switch-project). However once entering a project and calling one of the other projectile commands I can then call projectile-switch-project without any problems. From what I can gather from the error message and the behavior of the problem, it seems to me as if projectile-switch-project isn't autoloaded. This error doesn't occur with any of the commands which further confirms my suspicions.

In saying this I am no elisp expert so I would like to see if any of you have experienced this problem and found a way to solve this.

  • You can always just load the whole file and not mess with autoload. If this occurs with an empty .emacs, you should file a bug report.
    – Qudit
    Oct 11, 2015 at 7:58
  • @Qudit yeah, I guess. I just found it weird that every other projectile command would be autoloaded but switch-project not. Oct 11, 2015 at 8:03
  • Hence, my suggestion for a bug report...
    – Qudit
    Oct 11, 2015 at 8:04
  • Ok I shall do so. (I didn't see your edit there) Oct 11, 2015 at 8:41
  • @intricatedetail Here's a very related solution to an earlier question on emacs.stackexahnge: emacs.stackexchange.com/a/16881/115. The only difference is that it's about autoloading a different function in a different package. But the solution to how to autoload stays the same. Oct 11, 2015 at 10:48

1 Answer 1


To autoload the interactive command projectile-switch-project, use something like:

(autoload #'projectile-switch-project "projectile" nil :interactive)

the fourth arg INTERACTIVE should be non-nil since you need to call projectile-switch-project from M-x (interactively).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.