仅在需要时才能看到编辑屏幕 [英] See the compilation screen only when it is necessary

查看:171
本文介绍了仅在需要时才能看到编辑屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的 .emacs (global-set-key\Cx\Cm'compile) $ C>。因此,在 Emacs 下,如果我使用快捷方式 Cx Cm Cm ,1)我问我是否想要保存修改; 2)另外一个缓冲区将在 Emacs 下打开,编译过程显示(另外,它没有系统地显示编译结束,我们需要手动浏览) / p>

是否有可能不让包含编译的缓冲区令人不安?



理想情况下,我想要$ code> Cx Cm Cm 切换编译(默认情况下,我想保存修改)。如果没有错误,我不想看到编译屏幕;否则,我会找到屏幕并看到错误消息。



有人知道是否可以设置这个?



编辑1:



按照@maxy的答案,我修改了 .emacs 并做了一些测试。奇怪的是,有两种情况:



1)如果以前的编译成功,另一个编译将生成一个缓冲区,然后编译后不会删除缓冲区: p>



2)如果以前的编译没有成功,在删除编译缓冲区并纠正tex文件中的错误后,另一个编译将生成一个缓冲区,然后缓冲区将在编译后被删除。



有谁知道如何修改它?



编辑2:



在@maxy的答案中,将(run-at-time 0.5 nil'delete-windows-on buf)更改为(随时运行0.5 nil'delete-other-windows)会做的伎俩。

解决方案

我解决了这个问题很久以前,我以为这是emacs默认的。可悲的是不是。从我的 emacs.el

  ;;摆脱编译窗口成功
;;来源:http://www.bloomington.in.us/~brutt/emacs-c-dev.html [dead link]
(setq compilation-finish-function
(lambda(buf str)
(if(string-match异常退出)
;;有错误
;(消息编译错误,按Cx访问)
(消息错误同时编译)
;;没有错误,使编译窗口在0.5秒内消失
(run-at-time 0.5 nil'delete-windows-on buf)
(message编译完成))))

另外,使用 Mx自定义变量 for

 '(compilation-ask-about-save nil)
'编译上下文行0)
'(编译 - 滚动输出t)
'(编译窗口高度21)

如果您使用 swbuff ,请参阅 swbuff-exclude-buffer-regexps 忽略 * compilation * buffe r在最近使用的缓冲区列表中。


I have put (global-set-key "\C-x\C-m" 'compile) in my .emacs. As a result, under Emacs, if I use the shortcut C-x C-m C-m, 1) I am asked if I want to save the modification; 2) another buffer will be opened under Emacs where the compilation is displayed (Additionally, it does not show systematically the end of the compilation, we need to browse down manually).

Is it possible to not let the buffer containing the compilation be disturbing?

Ideally, I want C-x C-m C-m to toggle the compilation (I want to save the modification by default). If there is no error, I don't want to see the compilation screen; otherwise, I will find the screen and see the error message.

Does anyone know if it is possible to set this up?

Edit 1:

Following the answer of @maxy , I have modified .emacs and done some tests. Oddly, there are two cases:

1) If the previous compilation succeeded, another compilation will generate a buffer and then the buffer will NOT be deleted after the compilation:

2) If the previous compilation did not succeed, after deleting the compilation buffer and correcting the error in the tex file, another compilation will generate a buffer and then the buffer will be deleted after the compilation.

Does anyone know how to fix it?

Edit 2:

I've got it. In the answer of @maxy , changing (run-at-time 0.5 nil 'delete-windows-on buf) to (run-at-time 0.5 nil 'delete-other-windows) will do the trick.

解决方案

I solved this problem so long ago that I thought it was the emacs default. Sadly it isn't. From my emacs.el:

;; get rid of compilation window on success
;; source: http://www.bloomington.in.us/~brutt/emacs-c-dev.html [dead link]
(setq compilation-finish-function
      (lambda (buf str)
        (if (string-match "exited abnormally" str)
            ;;there were errors
            ;(message "compilation errors, press C-x ` to visit")
            (message "ERRORs while compiling.")
          ;;no errors, make the compilation window go away in 0.5 seconds
          (run-at-time 0.5 nil 'delete-windows-on buf)
          (message "Compilation done."))))

Also, use M-x customize-variable for:

 '(compilation-ask-about-save nil)
 '(compilation-context-lines 0)
 '(compilation-scroll-output t)
 '(compilation-window-height 21)

In case you are using swbuff, see the example for swbuff-exclude-buffer-regexps to ignore the *compilation* buffer in the list of recently used buffers.

这篇关于仅在需要时才能看到编辑屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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