I know that we can start
compile interactively using
C-u M-x compile. Is there a way to start this whenever I run
M-x compile? If that cannot be done, how do I create a shortcut to
C-u M-x compile?
My current shortcut for
M-x compile is:
(global-set-key (kbd "<f5>") 'compile)
This would execute normal compile (not interactive). Ideally, I would like to create a separate shortcut for interactive compile (for program that requires a lot of user inputs).
Please let me know and thanks for your help
Edit: I forgot the mention that my compile command is also customized based on mode hook. For example, below is how I customize it for C++ mode hook and Fortran mode hook:
(add-hook 'c++-mode-hook (lambda () (set (make-local-variable 'compile-command) (concat "g++ -g -Wall -lm " buffer-file-name " && ./a.out" ) ))) (add-hook 'fortran-mode-hook (lambda () (set (make-local-variable 'compile-command) (concat "gfortran " buffer-file-name " && ./a.out" ) )))