gpt4 book ai didi

c++ - 在新编译期间浏览以前的编译错误?

转载 作者:可可西里 更新时间:2023-11-01 17:56:18 26 4
gpt4 key购买 nike

如何设置 emacs 以便我可以在新编译期间浏览以前的编译错误?

有两件事对我不起作用:

  1. M-g M-g(下一个错误)功能在第二次编译正在进行时不起作用。

  2. 我将我的 emacs 分成 5 个不均匀的窗口(水平拆分窗口),编译“窗口”的大小是原来的两倍(dbl 监视器设置)。当我启动编译时,它总是出现在最后一个双重编译窗口中。现在它会为自己打开一个新窗口。

最佳答案

这是一个似乎可以满足您所有要求的解决方案:

  • *compilation-old* 缓冲区总是在同一个窗口中
  • next-error 不中断
  • 当编译过程终止时,所有连续的编译输出都附加在 *compilation-old* 的末尾
(defun my-compilation-finish-function (buffer msg)
;; Don't do anything if we are in a derived mode
(when (with-current-buffer buffer (eq major-mode 'compilation-mode))

;; Insert the last compilation output at the end of *compilation-old*
(if (get-buffer "*compilation-old*")
(with-current-buffer "*compilation-old*"
(save-excursion
(goto-char (point-max))
(insert-buffer buffer)))
(with-current-buffer buffer
(rename-buffer "*compilation-old*")))))

(add-hook 'compilation-finish-functions 'my-compilation-finish-function)



(defadvice compile (around my-compile-show-old activate)
"Show the *compilation-old* buffer after starting the compilation"
(let ((buffer (current-buffer)))
(when (get-buffer "*compilation-old*")
(pop-to-buffer "*compilation-old*")
(switch-to-buffer "*compilation*"))
ad-do-it
(when (get-buffer "*compilation-old*")
(switch-to-buffer "*compilation-old*")
(pop-to-buffer buffer))))

关于c++ - 在新编译期间浏览以前的编译错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13270454/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com