沒有什麼內置的做你想做的。您可以使用以下代碼來執行您想要的操作(只需自定義正則表達式以匹配您想要避免的緩衝區的名稱)。
注意:my-other-window
沒有實現other-window
的所有功能,這是讀者的練習。
my-other-window
將嘗試切換到緩衝區不匹配avoid-window-regexp
的窗口。如果沒有這樣的窗口可用,那麼它就切換到下一個窗口。
(require 'cl)
(defvar avoid-window-regexp "^[0-9]$")
(defun my-other-window()
"Similar to 'other-window, only try to avoid windows whose buffers match avoid-window-regexp"
(interactive)
(let* ((window-list (delq (selected-window) (window-list)))
(filtered-window-list (remove-if
(lambda (w)
(string-match-p avoid-window-regexp (buffer-name (window-buffer w))))
window-list)))
(if filtered-window-list
(select-window (car filtered-window-list))
(and window-list
(select-window (car window-list))))))
,並適當地結合它:
(global-set-key (kbd "C-x o") 'my-other-window)
看到有用的功能`esc-toggle-window-selectability` http://ericscrosson.wordpress.com/2013/04/27/ignoring-windows-with-other-window/ – artscan 2013-11-07 00:51:36