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

Vim、Emacs配置和使用
回复
goghl
帖子: 32
注册时间: 2007-06-13 16:54

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

#1

帖子 goghl » 2007-07-20 1:04

错误一般格式
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)
)
)
怎么错了?
谢谢
forcotton
帖子: 57
注册时间: 2006-10-06 21:10

#2

帖子 forcotton » 2007-07-20 5:16

在 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。
goghl
帖子: 32
注册时间: 2007-06-13 16:54

#3

帖子 goghl » 2007-07-20 11:10

楼上的对不起,能不能再说详细点怎么做
goghl
帖子: 32
注册时间: 2007-06-13 16:54

#4

帖子 goghl » 2007-07-20 11:52

哦,我成功匹配了,他可以高亮显示错误信息,但是他每次都跳转到第一行,怎么做呢?
谢谢
附件
.JPG
goghl
帖子: 32
注册时间: 2007-06-13 16:54

#5

帖子 goghl » 2007-07-20 11:54

我在compie.el中加入了
(pascal
"\\(.*.pas\\)\\(([0-9]+,[0-9]+)\\) \\(\\(Error.*\\|Warning.*\\|Fatal.*\\)\\)" 1 2 3)
goghl
帖子: 32
注册时间: 2007-06-13 16:54

#6

帖子 goghl » 2007-07-20 13:16

多谢你了!终于搞定了!可以跳转了!
不过还有一个问题,怎么把这几行代码放如.emacs里呢?不放入compile.el里
多谢了,太好了
forcotton
帖子: 57
注册时间: 2006-10-06 21:10

#7

帖子 forcotton » 2007-07-21 11:23

哎, 我也不知到具体的,没有搞过这个嘛。 既然弄好了,不如整理一下贴上来,也好

普 济 众 生

:)
herberteuler
帖子: 45
注册时间: 2007-01-27 14:11

#8

帖子 herberteuler » 2007-07-21 16:42

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 还是换成一个稍微特定的名字好一些。
回复