分页: 1 / 1

[问题]NTEMACS怎么配置PASCAL编译错误分析

发表于 : 2007-07-20 1:04
goghl
错误一般格式
ex.pas(3,10) Fatal: 错误信息
或者
ex.pas(3,10) Warning: 错误信息
ex.pas是文件名,PASCAL-MODE
怎么配置

(eval-after-load "compile"
'(add-to-list
'compilation-error-regexp-alist-alist
'(pascal
"\\(.*\\)(\\([0-9]+\\),\\([0-9]+\\)): \\(Fatal\\|Warning\\):" 1 2 3)
)
)
怎么错了?
谢谢

发表于 : 2007-07-20 5:16
forcotton
在 compilation-error-regexp-alist 的文档中:

Instead of an alist element, you can use a symbol, which is
looked up in `compilation-error-regexp-alist-alist'. You can see
the predefined symbols and their effects in the file
`etc/compilation.txt' (linked below if you are customizing this).

所以要在 compilation-error-regexp-alist 加上一个 'pascal .

regular expression 是否匹配可以在compilation window用 M-x re-builder。

发表于 : 2007-07-20 11:10
goghl
楼上的对不起,能不能再说详细点怎么做

发表于 : 2007-07-20 11:52
goghl
哦,我成功匹配了,他可以高亮显示错误信息,但是他每次都跳转到第一行,怎么做呢?
谢谢

发表于 : 2007-07-20 11:54
goghl
我在compie.el中加入了
(pascal
"\\(.*.pas\\)\\(([0-9]+,[0-9]+)\\) \\(\\(Error.*\\|Warning.*\\|Fatal.*\\)\\)" 1 2 3)

发表于 : 2007-07-20 13:16
goghl
多谢你了!终于搞定了!可以跳转了!
不过还有一个问题,怎么把这几行代码放如.emacs里呢?不放入compile.el里
多谢了,太好了

发表于 : 2007-07-21 11:23
forcotton
哎, 我也不知到具体的,没有搞过这个嘛。 既然弄好了,不如整理一下贴上来,也好

普 济 众 生

:)

发表于 : 2007-07-21 16:42
herberteuler
goghl 写了:多谢你了!终于搞定了!可以跳转了!
不过还有一个问题,怎么把这几行代码放如.emacs里呢?不放入compile.el里
多谢了,太好了
试试这个成不:

代码: 全选

(require 'compile)
(add-to-list 'compilation-error-regexp-alist-alist
             '(pascal
               "\\(.*.pas\\)\\(([0-9]+,[0-9]+)\\) \\(\\(Error.*\\|Warning.*\\|Fatal.*\\)\\)" 1 2 3))
(add-to-list 'compilation-error-regexp-alist
             'pascal)
pascal 是你定义的那个元素。不过我觉得 pascal 还是换成一个稍微特定的名字好一些。