Skip to content

Instantly share code, notes, and snippets.

@kosaki
Created July 8, 2014 01:59
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 kosaki/4c46f300bb41b0387f19 to your computer and use it in GitHub Desktop.
Save kosaki/4c46f300bb41b0387f19 to your computer and use it in GitHub Desktop.
;; flymake
(require 'flymake)
(require 'flymake-cursor)
;; for C
(add-hook 'c-mode-hook
'(lambda ()
(flymake-mode t)))
;; Use <topdir>/build/Makefile if exist (for ruby)
;; from http://www.emacswiki.org/emacs/FlyMake
(defun ac-find-configure (source-dir)
(locate-dominating-file source-dir "configure"))
(defun ac-build-dir (source-dir)
"find the build directory for the given source directory"
(progn (let* (topdir (ac-find-configure source-dir))
(if (file-exists-p (concat topdir "build/Makefile"))
(concat topdir "build/")
source-dir))))
(defadvice flymake-find-buildfile
(around advice-find-makefile-separate-obj-dir
activate compile)
"Look for buildfile in a separate build directory"
(let* ((source-dir (ad-get-arg 1))
(bld-dir (ac-build-dir source-dir)))
(ad-set-arg 1 bld-dir)
ad-do-it))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment