/ Published in: Emacs Lisp
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(defun search-makefile () (if (file-exists-p "Makefile") t ;else (cd "../") (search-makefile))) (defun flymake-cc-init () (if (search-makefile) (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "make" (list "-s" (format "-C%s" default-directory) (format "CHK_SOURCES=%s" temp-file) "SYNTAX_CHECK_MODE=1" "check-syntax"))))) (add-hook 'c++-mode-hook (lambda () (push '("\\.cpp$" flymake-cc-init) flymake-allowed-file-name-masks) (push '("\\.h$" flymake-cc-init) flymake-allowed-file-name-masks) (if (and (not (null buffer-file-name)) (file-writable-p buffer-file-name)) (flymake-mode t)) ))