I have this function implemented to basically compile and run the cpp file I am writing. Some files needs input (cin) so running this function will not stop and would continuously showing this message:
emacs Enter a positive, odd integer (-1 to exit program): Only digits are allowed!
Not sure what is wrong:
(defun run-it ()
"Run it on the current file."
(interactive)
(save-all-buffer)
(let ((file-name (file-name-nondirectory buffer-file-name)))
(shell-command
(format
(concat "g++ -std=c++11 " file-name " -o " file-name ".o; "
"./" file-name ".o;")))
))
format
does not do anything here, so maybe just remove it along with the opening/closing parentheses.file.o
?(save-all-buffer)
this is no official function. The rest works.