I am new to Emacs. I have installed Projectile.
When I do C-c p
, it says:
C-c p is undefined
Wondering what is wrong?
Following is my ~/.emacs
file.
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(defvar required-packages
'(
projectile
) "a list of packages to ensure are installed at launch.")
(require 'cl)
; method to check if all packages are installed
(defun packages-installed-p ()
(loop for p in required-packages
when (not (package-installed-p p)) do (return nil)
finally (return t)))
; if not all packages are installed, check one by one and install the missing ones.
(unless (packages-installed-p)
; check for new packages (package versions)
(message "%s" "Emacs is now refreshing its package database...")
(package-refresh-contents)
(message "%s" " done.")
; install the missing packages
(dolist (p required-packages)
(when (not (package-installed-p p))
(package-install p))))
(require 'projectile)
(projectile-global-mode)
Edit
My .projectile file
-/venv
-*.pyc
-*.pyc~
-.git
-.gitignore
-.DS_Store
Edit 2
C-h v
output for projectile-keymap-prefix
as below:
projectile-keymap-prefix is a variable defined in `projectile.el'.
Its value is "^Cp"
Documentation:
Projectile keymap prefix.
You can customize this variable
Edit 3
I am using OS X 10.10.4. I start emacs from command line $emacs
. I have installed Emacs using following commands:
brew install emacs --with-cocoa
And, very first time (when I launch emacs). If do M-x
, I don't get project-switch-project
, rather I get project-switch-to-buffer
. After switching buffer, I can switch project.
You now need to explicitly enable it and set a prefix. The steps to enable Projectile with a
C-c C-p
prefix:This has changed a couple times in 2018. Boris used to set
C-c p
as the default leader, then changed it toC-c C-p
to be in accordance with the emacs keybinding conventions (bullet #2 mentions it.). But now it's removed altogether, so you should set it yourself.