reddit / emacs

Can Project.el remember a project's compile command?

OldMansKid · 2022-11-10 13:43
Every time I open an existing project, c-x p c defaults to make -k, and there isn't even any command history. ​ Edit: I don't understand the syntax ((nil . ((variable . "value")))) of .dir-locals.el, so many parentheses, but fortunately there is a add-dir-local-variable function, then just select the compile-command.
mickeyp · 2022-11-10 14:22
You can use a directory-local variable to set it.
OldMansKid · 2022-11-10 14:30
Thanks. Never mind, I found it. It's "compile-command".
Thaodan · 2022-11-10 18:15
projectile.el does that so I suppose you can just restore the command history of the project.el when you start emacs. Try \`savehist-mode\`.
[deleted] · 2022-11-10 18:26
[deleted]
paretoOptimalDev · 2022-11-10 19:36
Semi-related: History per project would be super cool
terminal_cope · 2022-11-12 19:01
savehist is the key. Useful all over. I intend to migrate from projectile some time but this discussion isn't making me more eager. I just realized projectile will rename compilation buffers to be per project if you let it. Assuming project doesn't go that far yet (?) I may sit tight.
Thaodan · 2022-11-12 19:42
Yes if you \`projectile-per-project-compilation-buffer\`.