2010-05-24

在Emacs里使用 PHPCS

类归于: symfonybobhero @ 13:36

前文书说的好 MAKER 可以在VIM 里使用PHPCS ,VIM是很牛B 的编辑器,但是还有一个更牛B 的编辑器就是 EMACS。

具体有多牛,去GOOGLE 百度一下

PHPCS是什么 ,请参考前文

这里贴上 EMACS 下使用的代码


(defun php-lint ()
(interactive)
(let ((compilation-error-regexp-alist '(php))
(compilation-error-regexp-alist-alist ()))
(pushnew '(php "\\(syntax error.*\\) in \\(.*\\) on line \\([0-9]+\\)$" 2 3 nil nil 1)
compilation-error-regexp-alist-alist)
(compile (concat "php -l -f \"" (buffer-file-name) "\""))))
(define-key php-mode-map (kbd " ") 'php-lint)
(defun phpcs ()
"Performs a PHP code sniffer check on the current file."
(interactive)
(let ((compilation-error-regexp-alist '(gnu)))
;; (compile (format "phpcs --standard=PEAR --report=emacs \"%s\""
(compile (format "phpcs --standard=Zend --report=emacs \"%s\""
(buffer-file-name)))))
;; Check code style
(define-key php-mode-map (kbd " ") 'phpcs)

完成以后可以用 快键调用也可以用 命令行调用。
什么 你看不懂? 没有关系 ,看不懂就看不懂吧,早晚能看懂的

随机日志

评论暂缺 »

还没有任何评论。

这篇文章上的评论 RSS feed TrackBack URL

留下评论

WordPress 所驱动