I have just joined the Emacs church. I would like to know if the following can be done.
Say I have a project folder, I would like to run some custom commands that tie to some keyboard shorcuts for that folder only.
For example, say I am in /home/Documents/project
, I would open this directory in Emacs and I would press, say C-x-F5
for example, and Emacs would send some custom commands that I declare and run in the shell.
Is it possible to do this? The only thing I manage to mess around is the compile
command, M-x compile
. But how to tell Emacs to only execute that while in /home/Documents/project
?
Below is my attempt at modifying the compile command with adhook to compile C++ file.
(add-hook 'c++-mode-hook
(lambda ()
(set (make-local-variable 'compile-command)
(concat "g++ " buffer-file-name "&& ./a.out"))))
Please let me know.