先看段我演示:
怎么样? 是不是有IDE的感觉? 进入配置过程.其实配置不复杂.
首先需要Makefile的支持(这里只拿C/C++作例子).
在Makefile中添加下面两行:
check-syntax: gcc -o nul -S ${CHK_SOURCES}
然后 进入要编写的代码启用flymake-mode即可
flymake目前支持一下语言:
Language | Compiler | OS |
C/C++ | Microsoft Visual C++ 6.0 | Windows 2000 |
C/C++ | gcc 2.9 | Windows 2000/XP/Linux |
MS IDL | midl 5.01 | Windows 2000 |
Java | IBM Jikes 1.17 | Windows 2000 |
Latex | MikTeX 2.2 | Windows 2000 |
HTML | HTML Tidy | Windows 2000/XP |
XML | XMLStarlet Command Line XML Toolkit 0.7.0 | Windows 2000/XP |
Perl | Perl 5.8 | Windows 2000/XP |
当然这里有一些有用的函数(ahei编写),可以把错误显示在minibuffer上:
;Code by ahei(defun flymake-display-current-error () "Display errors/warnings under cursor." (interactive) (let ((ovs (overlays-in (point) (1+ (point))))) (catch 'found (dolist (ov ovs) (when (flymake-overlay-p ov) (message (overlay-get ov 'help-echo)) (throw 'found t)))))) (defun flymake-goto-next-error-disp () "Go to next error in err ring, then display error/warning." (interactive) (flymake-goto-next-error) (flymake-display-current-error)) (defun flymake-goto-prev-error-disp () "Go to previous error in err ring, then display error/warning." (interactive) (flymake-goto-prev-error) (flymake-display-current-error))
flymake-display-current-error是显示当前的光标所在错误!
flymake-goto-next-error-disp显示下一个错误!
flymake-goto-prev-error-disp显示上一个错误!
是不是很给力?
当然这里有个性能问题,因为flymake是调用gcc的 大工程的话 会相对比较慢. 看你选择了!