emacs:我可以在模式hook fn中设置编译错误regexp-alist吗?

emacs:我可以在模式hook fn中设置编译错误regexp-alist吗?,emacs,jslint,Emacs,Jslint,我试图在作为模式挂钩添加的函数中设置编译错误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 '( ("^[

我试图在作为模式挂钩添加的函数中设置编译错误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命令
已设置。但是由于某种原因,
编译错误regexp alist
值不会生效

如果我以后在
编译错误regexp list
上执行
M-x descripe变量
,它将显示我认为应该具有的值。但是编译缓冲区中的错误不会突出显示,并且
M-x next error
不起作用

如果我通过
setq default
将error regexp值添加到
编译错误regexp列表中,如下所示:

(setq-default compilation-error-regexp-alist
  '(
     ... jslint regexp here ...
     ... many other regexp's here...
   ))
…然后就行了。编译缓冲区中的错误将正确突出显示,
M-x next error
按预期运行


我不相信
compile
命令会继承您为
编译错误regexp list
设置的本地值。解决方案是为
*编译*
缓冲区本身定制一个钩子,请参阅和编译开始钩子