In one of my projects I need to run
make package install when building instead of
make. It remembers the last compile command I used, but resets to
make -k every time emacs starts up. How can I customize
M-x compile to default to
make package install?
You can customize the variable
compile-command to change the compilation command that is used by default:
(setq compile-command "make package install")
If you want to customize the variable per project rather than globally. You can use Directory Variables. These allow you to apply certain customizations only for files in certain directory and its subdirectories.
So for example you want to use the
make package install as compile command only in project A, you will need to create a file named
.dir-locals.el in root directory of the project and add something like the following
((nil . ((compile-command . "make package install"))))
The syntax is explained in detail in the link to emacs manual above. As pointed out by @hatschipuh, you can use the commands
delete-dir-local-variable to easily add and delete dir local values.