Skip to content

Instantly share code, notes, and snippets.

@holgerschurig
Created February 19, 2019 11:30
Show Gist options
  • Save holgerschurig/8632074405363e37c0f1bc65fc363d0e to your computer and use it in GitHub Desktop.
Save holgerschurig/8632074405363e37c0f1bc65fc363d0e to your computer and use it in GitHub Desktop.
compile commands looking for main directory
(let ((default-directory (or (locate-dominating-file "." ".git")
(locate-dominating-file "." ".svn")
(locate-dominating-file "." "CMakeLists.txt")
(locate-dominating-file "." "GNUmakefile")
(locate-dominating-file "." "Makefile")
default-directory)))
(cd (or (locate-dominating-file (buffer-file-name) ".git") "."))
(compile compile-command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment