Flymake handler for C++ project in Xcode


/ Published in: Emacs Lisp
Save to your folder(s)



Copy this code and paste it in your HTML
  1. (defun search-makefile ()
  2. (if (file-exists-p "Makefile")
  3. t
  4. ;else
  5. (cd "../")
  6. (search-makefile)))
  7.  
  8.  
  9. (defun flymake-cc-init ()
  10. (if (search-makefile)
  11. (let* ((temp-file (flymake-init-create-temp-buffer-copy
  12. 'flymake-create-temp-inplace))
  13. (local-file (file-relative-name
  14. temp-file
  15. (file-name-directory buffer-file-name))))
  16. (list "make" (list "-s" (format "-C%s" default-directory) (format "CHK_SOURCES=%s" temp-file) "SYNTAX_CHECK_MODE=1" "check-syntax")))))
  17.  
  18. (add-hook 'c++-mode-hook
  19. (lambda ()
  20. (push '("\\.cpp$" flymake-cc-init) flymake-allowed-file-name-masks)
  21. (push '("\\.h$" flymake-cc-init) flymake-allowed-file-name-masks)
  22. (if (and (not (null buffer-file-name)) (file-writable-p buffer-file-name))
  23. (flymake-mode t))
  24. ))

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.