What is the most efficient emacs workflow for compilation and interactive execution loops (C ++ / makefile)

What is the preferred practice for compilation cycle in emacs?

I used to use Mx compile (mapped to F12 ) with make as my compilation command. In the Makefile, I had an entry in which the program that was compiled would run. This worked great when my programs were non-interactive, but the compilation buffer is not interactive.

Of course, I could open the shell and run the executable file, but I would like to automate the compilation cycle as much as possible, and I assume that this should be standard practice, and I assume from-the-makefile is kluge ...

Cu F12 works, but I wonder if this is the best approach for this (and if so, how can I bind F12 to the equivalent of Cu Mx compile instead of just Mx compile ?).

+4
source share
1 answer

It could not be simpler than Cu Mx compile . You have already defined the Makefile task. So you are just asking how to match this with f12?

Try the following:

(defun compile-interactive () (interactive) (setq current-prefix-arg '(4)) (call-interactively 'compile)) (global-set-key (kbd "<f12>") 'compile-interactive) 

You should also read the Interactive Options and Advanced Arguments sections of the manual.

+3
source

Source: https://habr.com/ru/post/1400645/


All Articles