如何防止emacs打开编译输出的新窗口? [英] How can I prevent emacs from opening new window for compilation output?

查看:104
本文介绍了如何防止emacs打开编译输出的新窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我调用编译命令时,如何防止emacs打开新窗口?
我想把它绑定到一个特定的现有窗口。

How can I prevent emacs from opening new window when I invoke compile command? I would like to bind it to a particular existing window.

推荐答案

根据您对Luke的意见,我会推荐检查我使用的这个功能。我喜欢它,因为如果没有错误,它会编译缓冲区,否则会将其保留,以便您可以看到它们。

Based on your comments with Luke, I would recommend checking out this function that I use. I like it because it buries the compilation buffer if there were no errors, otherwise it leaves it up so you can see them.

您可以检查页面的emacs wiki,但以下代码为:

You can check emacs wiki for the page, but here is the code:

;; Helper for compilation. Close the compilation window if
;; there was no error at all. (emacs wiki)
(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)

您可以随时切换回编译缓冲区查看任何警告。

You can always switch back to the compilation buffer to view any warnings.

这篇关于如何防止emacs打开编译输出的新窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆