我想在没有错误和没有警告时自动关闭编译缓冲区,但我想在出现警告时显示它。任何人都可以帮助我? emacswiki这个代码只做第一个要求。如何改变它?emacs编译缓冲区自动关闭?
;; Helper for compilation. Close the compilation window if
;; there was no error at all.
(defun compilation-exit-autoclose (status code msg)
;; If M-x compile exists with a 0
(when (and (eq status 'exit) (zerop code))
;; then bury the *compilation* buffer, so that C-x b doesn't go there
(bury-buffer)
;; and delete the *compilation* window
(delete-window (get-buffer-window (get-buffer "*compilation*"))))
;; Always return the anticipated result of compilation-exit-message-function
(cons msg code))
;; Specify my function (maybe I should have done a lambda function)
(setq compilation-exit-message-function 'compilation-exit-autoclose)
你在编译什么? – Thomas
@Thomas这不是关键问题 – Iceman
知道你正在运行哪个编译器可能很有用,因为你可以使用'msg'参数来检查是否有错误或警告。 – Thomas