我正试着设置
compilation-error-regexp-alist
在我添加为模式挂钩的函数中。
(defun cheeso-javascript-mode-fn ()
(turn-on-font-lock)
...bunch of other stuff
;; for JSLINT
(make-local-variable 'compilation-error-regexp-alist)
(setq compilation-error-regexp-alist
'(
("^[ \t]*\\([A-Za-z.0-9_: \\-]+\\)(\\([0-9]+\\)[,]\\( *[0-9]+\\))\\( Microsoft JScript runtime error\\| JSLINT\\): \\(.+\\)$" 1 2 3)
))
;;(make-local-variable 'compile-command)
(setq compile-command
(let ((file (file-name-nondirectory buffer-file-name)))
(concat "%windir%\\system32\\cscript.exe \\cheeso\\bin\\jslint.js " file)))
)
(add-hook 'javascript-mode-hook 'cheeso-javascript-mode-fn)
模式挂钩运行。我在钩子模式中设置的各种东西都起作用。这个
compile-command
获取设置。但出于某种原因,
编译错误regexp-alist
价值不起作用。
如果我以后做一个
M-x describe-variable
在
编译错误regexp-alist
,它显示了我认为它应该具有的价值。但是…编译缓冲区中的错误不会突出显示,并且
M-x next-error
不起作用。
alt text http://i40.tinypic.com/drb3g4.jpg
如果我将error regexp值添加到
编译错误regexp-alist
通过
setq-default
,像这样:
(setq-default compilation-error-regexp-alist
'(
... jslint regexp here ...
... many other regexp's here...
))
……那就行了。编译缓冲区中的错误被正确地突出显示,并且
M-X下一个错误
功能如预期。
alt text http://i40.tinypic.com/10nclxv.jpg