2013-10-19 56 views
7

我有一個緩衝區,我想在按鍵的emacs窗口中「開啓」窗口。Emacs,切換一個特定的窗口

例如:

________________  ________________  ________________ 
|    |  | |   |  |    | 
|    |  | |   |  |    | 
|    |  | |   |  |    | 
|  W  | -> | S |  W  | -> |  W  | 
|    | <f3> | |   | <f3> |    | 
|    |  | |   |  |    | 
----------------  ----------------  ---------------- 

S在左手側窗口是一個特定的緩衝區。

問題出現了,無論W的窗口結構是什麼,都會發生這種情況。如果W有幾個不同的窗口,按<F3>仍然應該在屏幕邊緣創建一個新窗口,並將特定的緩衝區放入它,然後它應該把它拿走。

但我不確定如何做到這一點是emacs但是。

回答

6

以此爲起點,需要包popwin

(require 'popwin) 
(popwin-mode 1) 

(generate-new-buffer "special-buffer") 

(setq eab/special-buffer-displaedp nil) 
(setq eab/special-buffer "special-buffer") 

(add-to-list 'popwin:special-display-config 
     `(,eab/special-buffer :width 20 :position left :stick t))  

(defun eab/special-buffer-toggle() 
    (interactive) 
    (if eab/special-buffer-displaedp 
     (progn 
     (popwin:close-popup-window) 
     (setq eab/special-buffer-displaedp nil)) 
    (progn 
     (ignore-errors (popwin:display-buffer eab/special-buffer)) 
     (setq eab/special-buffer-displaedp 't)))) 

(global-set-key (kbd "<f3>") 'eab/special-buffer-toggle) 
+0

很棒的包!感謝您的建議。 –

+0

推測是指:http://www.emacswiki.org/emacs/PopWin – phils