Created
April 27, 2019 20:18
-
-
Save paxperscientiam/af043a587cd80601d3e25cc6eee5eaf1 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
;; all credit to someone else. use are your own peril! | |
;; search the closest Makefile and run make | |
;; 从当前目录向上查找最近的Makefile,并执行make命令 | |
(defun get-parent-directory (path) | |
"get the parent directory" | |
(file-name-directory (directory-file-name path))) | |
(defun compile-make-ex (target) | |
"run make to compile. provide more arguments." | |
(interactive "starget: ") | |
(let ((default-directory (locate-dominating-file default-directory "Makefile"))) | |
(if default-directory | |
(compilation-start (format "make %s" target)) | |
(message "cannot find Makefile")))) | |
(defun compile-make () | |
"run make to compile" | |
(interactive) | |
(compile-make-ex "")) | |
(global-set-key [f12] 'compile) | |
(provide 'compile-make) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment