我的Windows配置如下所示:
+----------+-----------+ | | | | | | | | | | | | | | | | +-----------+ | | | +----------+-----------+
我使用右下方的窗口进行特殊显示(如帮助,完成等),但是当我调用使用的命令(find-file-other-window
等等)时,emacs仍坚持使用该窗口display-buffer
,并调整该窗口的大小.这很烦人......有没有办法可以强制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))))))
Trey Jackson.. 18
好吧,有人已经问完了同样的问题.我写了一个似乎运作良好的答案.
看起来你可以使用相同的解决方案,除了不添加special-display-buffer-names
,你可以使用变量special-display-regexps
.所以有些东西:
(add-to-list 'special-display-regexps '(".*" my-display-buffers)) (defun my-display-buffers (buf) "put all buffers in a window other than the one in the bottom right" (let ((windows (delete (window-at (- (frame-width) 2) (- (frame-height) 4)) (delete (minibuffer-window) (window-list)))) (if (<= 2 (length windows)) (progn (select-window (cadr windows)) (split-window-vertically))) (let ((pop-up-windows t)) (set-window-buffer (car windows) buf) (car windows)))))
显然,你必须修改正则表达式,使其与*Help*
右下方窗口中实际需要的缓冲区不匹配.
关于建议display-buffer
,这将有效.您可以建议使用c编写的函数,建议几乎可以在您想要的每种情况下工作,除非从c 调用函数或建议宏(这不起作用b/c,宏通常已经扩展到它们使用的任何地方).
好吧,有人已经问完了同样的问题.我写了一个似乎运作良好的答案.
看起来你可以使用相同的解决方案,除了不添加special-display-buffer-names
,你可以使用变量special-display-regexps
.所以有些东西:
(add-to-list 'special-display-regexps '(".*" my-display-buffers)) (defun my-display-buffers (buf) "put all buffers in a window other than the one in the bottom right" (let ((windows (delete (window-at (- (frame-width) 2) (- (frame-height) 4)) (delete (minibuffer-window) (window-list)))) (if (<= 2 (length windows)) (progn (select-window (cadr windows)) (split-window-vertically))) (let ((pop-up-windows t)) (set-window-buffer (car windows) buf) (car windows)))))
显然,你必须修改正则表达式,使其与*Help*
右下方窗口中实际需要的缓冲区不匹配.
关于建议display-buffer
,这将有效.您可以建议使用c编写的函数,建议几乎可以在您想要的每种情况下工作,除非从c 调用函数或建议宏(这不起作用b/c,宏通常已经扩展到它们使用的任何地方).