Today I am going to share one of the more amazing pieces of elisp that I have run across… it’s not that it is remarkable code or something, it is simply that it proves to be helpfull beyond compare. It is called flymake and allows you to see the nifty things that IDE users are so used to… (a picture says more then a thousand words; showing 1 error (missing std::) and 1 warning (unused variable))

I had to do some things to get it working in my project though; firstly I needed to add a check-syntax target in my makefiles:
.PHONY: check-syntax
check-syntax:
$(CXX) $(CXXFLAGS) -Wall -Wextra -pedantic -fsyntax-only $(SRCS)I changed to font settings for the error and warning faces to do some underlining.
'(flymake-errline ((((class color)) (:underline "OrangeRed")))) '(flymake-warnline ((((class color)) (:underline "yellow"))))
And finally I hooked up to c-mode-common-hook to turn on flymake automatically and set up a keybinding to quickly see the next error message:
;; flymake (defun my-flymake-show-next-error() (interactive) (flymake-goto-next-error) (flymake-display-err-menu-for-current-line) ) ;; ;; Setting some C / C++ defaults ;; (add-hook 'c-mode-common-hook (function (lambda () ;; more stuff here (flymake-mode t) (global-set-key "C-cC-v" 'my-flymake-show-next-error) )))
The neat thing is that there are also on the fly syntax checking additions for PHP, Ruby, Action Script 3 and some more
One Comment
Hi, I have flymake.em but i can not run the features of it. Do u make a setup in .emacs file ? I will be very happy if you could send me the .emacs flymake.em a simple .cpp file and its makefile
( Namely the helloworld of flymake ).
Thanks in advance
One Trackback
[...] couple of days ago I wrote about using fly-make. Even though I had only used flymake with C++ code, I tend to do most of my work related coding in [...]