Customize your own projectile project in Emacs

When using projectile to manage a project folder, we can customize the project’s properties to
help us more easily to build / test / run the project.

Assuming we have a folder which contains all files in the project, and we want to quickly build /
test the project, we can add a .projectile file at the root of the project folder tree, then add
another .dir-locals.el file describing the customized command.

1
2
3
4
5
6
7
8
9
10
((nil . ((projectile-project-name . "Project name described in the status bar")
;; The empty string indicates current folder is the root of the proejct.
(projectile-project-compilation-dir . "")
(projectile-enable-caching . t)
;; Note that the prepare.sh is located at the root of the project.
(projectile-project-compilation-cmd . "./prepare.sh && make build")
(projectile-project-test-cmd . "./preare_test.sh && make test")
(projectile-project-run-cmd . "./start_app_engine && make deploy")
;; Bind the .h file from default C header to C++ header.
(eval . (add-to-list 'auto-mode-alist'("\\.h\\'" . c++-mode))))))