Last active
June 19, 2016 08:29
-
-
Save ghost355/1dd2b7e8c79e221d56141f0980a1c312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Build and Run C code from Spacemacs | |
;; If the code hasn't compilied then we build the code and create an execute file with a buffer's name without an extensions in the current folder | |
;; Or just run the program in bottom pop-up shell window | |
;; P.Pavlov 2016 | |
(defun execute-c-program () | |
(interactive) | |
(let ((c-code-compile (concat "gcc " (buffer-name) " -o " (file-name-base))) | |
(c-code-run (concat "./" (file-name-base)))) | |
(if (not (locate-file (file-name-base) ".")) | |
(shell-command c-code-compile)) | |
(async-shell-command c-code-run)) | |
(global-set-key [C-f1] 'execute-c-program)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you P.Pavlov !
BTW i'm a python newbie , and my only experience with C compilation is for installing apps in my GNU/Linux laptop.
| Yahyaoui Kaddour aka @kaddourkardio