我想在沒有錯誤和沒有警告時自動關閉編譯緩衝區,但我想在出現警告時顯示它。任何人都可以幫助我? 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