如何让这个 Emacs 框架保持其缓冲区而不调整大小? [英] How do I make this Emacs frame keep its buffer and not get resized?
问题描述
我的 Emacs 框架如下所示:
My Emacs frame looks like this:
+---------------------------+
| | |
| | |
| | B |
| A | |
| | |
| | |
| |-------------|
| | C |
+---------------------------+
C
通常是具有某种长期运行进程的终端,例如 Web 服务器或守护进程.不幸的是,各种各样的事情都喜欢在那个窗口中切换缓冲区,有时它会被调整大小.如何锁定窗口 C
的缓冲区和高度?
C
is usually a terminal with some kind of long-running process, like a web server or daemon. Unfortunately, all sorts of things like to switch the buffer in that window and occasionally it gets resized. How can I lock the buffer and height of window C
?
推荐答案
如果您不想被窗口窃取和调整大小所困扰,请将以下几行放在您的 .emacs 中,以获得一个有效的解决方案甚至像 gud 这样的库会在无法窃取您的窗口时尝试打开一个新框架:
If you don't want to be annoyed by window stealing and resizing, put the following lines in your .emacs for a definitive solution that works even with libraries like gud that tries to open a new frame when they can't steal your windows :
(请参阅此答案了解有关以下建议
)
(see this answer for info on the following advice
)
(defadvice pop-to-buffer (before cancel-other-window first)
(ad-set-arg 1 nil))
(ad-activate 'pop-to-buffer)
;; Toggle window dedication
(defun toggle-window-dedicated ()
"Toggle whether the current active window is dedicated or not"
(interactive)
(message
(if (let (window (get-buffer-window (current-buffer)))
(set-window-dedicated-p window
(not (window-dedicated-p window))))
"Window '%s' is dedicated"
"Window '%s' is normal")
(current-buffer)))
;; Press [pause] key in each window you want to "freeze"
(global-set-key [pause] 'toggle-window-dedicated)
并将pop-up-windows
变量自定义为nil
.
您也可以使用 StickyWindows 而不是窗口专用功能.
you could also use StickyWindows instead of window-dedicated feature.
这篇关于如何让这个 Emacs 框架保持其缓冲区而不调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!