Return to Snippet

Revision: 31205
at September 1, 2010 05:00 by masahiroh


Initial Code
(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))
            ))

Initial URL

                                

Initial Description

                                

Initial Title
Flymake handler  for C++ project in Xcode

Initial Tags

                                

Initial Language
Emacs Lisp