title: Using Emacs, is it possible to pin the compilation command to a specific buffer/directory?
body: <p>Right now I am using the following to compile, when I'm in for example main.cpp</p>
  
  <p><code>C-x b Makefile RET M-x compile RET RET</code></p>
  
  <p>I actually have M-x compile as a keyboard shortcut, but the problem is I would really like not having to go through all that trouble to simply run my Makefile.</p>
  
  <p>I need to visit Makefile to make sure the compile command is executed using the same directory. Is there any way to pin the directory so I can simply go <code>M-x compile RET RET</code>?</p>
  
  <p>Best regards</p>