Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
;; 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
You can’t perform that action at this time.