我试过了
(list (next-error)
(kill-ring-save (line-beginning-position) (line-end-position)))
在 M-x compile 之后
但是它将当前行推送到kill ring,而不是发现错误的行......
如果是这样,我如何让emacs在继续下一个命令之前等待(next-error)
完成?
答案 0 :(得分:0)
这一点建议会将错误指定的行复制到kill ring中:
(defadvice compilation-goto-locus (after next-error-copy-offending-line activate)
(kill-ring-save (line-beginning-position) (line-end-position)))
如果您决定要抓取错误消息,可以使用:
(progn
(next-error)
(with-current-buffer next-error-last-buffer
(kill-ring-save (line-beginning-position) (line-end-position))))