Emacs Asked by Falseee on January 1, 2022
i wanted to bind a key to a compile and run command, then i found this post, Compile and run single file c++ programs in Emacs[SOLVED]
( last answer)
It works perfectly fine and as intended.
The only problem i am having is: is it possible to run the "compile" process in the eshell or in the shell instead of the "compile" shell? The problem with the "compile" shell is that i am unable to write anything after the program exited.
For those who dont want to click on the link,here is the elisp function, even tho i dont think it has much to do with the question:
(defun compileandrun()
(interactive)
(save-buffer)
(compile (concat "g++ " (file-name-nondirectory (buffer-file-name)) " -o " (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) " && ./" (file-name-sans-extension (file-name-nondirectory (buffer-file-name)))) t )
(other-window 1)
(end-of-buffer)
)
(add-hook 'c++-mode-hook
(lambda () (local-set-key (kbd "<f8>") #'compileandrun)))
```
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP