So I've been mapping my
M-x compile like this, according to c-mode-hook or c++-mode-hook:
(add-hook 'c++-mode-hook (lambda () (set (make-local-variable 'compile-command) (concat "g++ " buffer-file-name " && ./a.out" ) )))
In other words, doing
M-x compile on a c or c++ file will compile and run it.
This works but I want this to be a 2 part process. So, I will have a buffer that contains the errors from running M-x compile and another buffer, maybe eshell, that is ready to run the program.
The first one is easy, I can just do this:
(add-hook 'c++-mode-hook (lambda () (set (make-local-variable 'compile-command) (concat "g++ " buffer-file-name) )))
This does not run the
./a.out part. Now, for the second part, I know that I can just do
M-x eshell, then type
./a.out and the program should run.
My question is: Is it possible to tell emacs to send "./a.out" in current directory to eshell/term? I would then have a third buffer opens that is eshell/term, where the program runs. And then I would like to bind a shortcut to this, say F6.