我的Windows配置如下:
+----------+-----------+
| | |
| | |
| | |
| | |
| | |
| +-----------+
| | |
+----------+-----------+
我使用右下角的窗口来显示特殊内容(如帮助,自动完成等)。但是当我调用命令(
find-file-other-window
等)使用display-buffer
时,Emacs会坚持使用该窗口,并且还会调整该窗口的大小。这很烦人...有没有办法强制Emacs不使用那个窗口?我想过建议display-buffer
,但它是一个C函数。对此有什么想法吗?编辑: 在Trey的答案的基础上,这是目前适合我的解决方案:
(setq special-display-function 'my-display-buffer)
(setq special-display-regexps '(".*"))
(defun display-special-buffer (buf)
"put the special buffers in the right spot (bottom rigt)"
(let ((target-window (window-at (- (frame-width) 4) (- (frame-height) 4)))
(pop-up-windows t))
(set-window-buffer target-window buf)
target-window))
(defun my-display-buffer (buf)
"put all buffers in a window other than the one in the bottom right"
(message (buffer-name buf))
(if (member (buffer-name buf) special-display-buffer-names)
(display-special-buffer buf)
(progn
(let ((pop-up-windows t)
(windows (delete (window-at (- (frame-width) 4) (- (frame-height) 4))
(delete (minibuffer-window) (window-list)))))
(message (buffer-name (window-buffer (car windows))))
(set-window-buffer (car (cdr windows)) buf)
(car (cdr windows))))))
let
绑定只能有一个值形式:如果,(<= 2(length windows)),(progn(select-window(cadr windows))(split-window-vertically)) - lawlist