What’s the preferred practice for a compile-run cycle in emacs?
Previously, I used M-x compile (mapped to F12) with make as my compile command. Within the Makefile I had an entry which would run the program that was compiled. This worked fine when my programs were non-interactive, but the compilation buffer is non-interactive.
Of course I could open a shell and run the executable, but I’d like to automate the compile-run cycle as much as possible and I assume there must be a standard practice for this and I’m guessing my executing-from-the-makefile method is a kluge…
C-u F12 works, but I’m wondering if that’s the best approach for doing this (and if so, how can I bind F12 to be equivalent to C-u M-x compile instead of just M-x compile?).
It can’t get simpler than C-u M-x compile. You already have the Makefile task defined. So you’re just asking how to map this to f12?
Try this:
You should also read the Interactive Options and Optional Arguments sections of the manual.