Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
Created April 27, 2019 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paxperscientiam/dc78152fbb59746c08e1e2a6039efda6 to your computer and use it in GitHub Desktop.
Save paxperscientiam/dc78152fbb59746c08e1e2a6039efda6 to your computer and use it in GitHub Desktop.
;; all credit to someone else. use are your own peril!
;; search the closest Makefile and run make
;; not finished
;; 从当前目录向上查找最近的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