Ste*_*gle 7 emacs window-management
所以我通常在Emacs中打开3个缓冲区.
如何禁用此第三个缓冲区,以便在按下时C-x o我只在缓冲区1和缓冲区2之间切换?目前,我在缓冲区1,缓冲区2,缓冲区3,缓冲区1等C-x o之间切换.具体来说,我只想在缓冲区1和2之间切换.
谢谢.
对此的一般解决方案(可以看)如下所示:
(defvar ignore-windows-containing-buffers-matching-res '("\\*Help")
"List of regular expressions specifying windows to skip (if window contains buffer that matches, skip)")
(defadvice other-window (before other-window-ignore-windows-containing activate)
"skip over windows containing buffers which match regular expressions in 'ignore-windows-containing-buffers-matching-res"
(if (and (= 1 (ad-get-arg 0)) (interactive-p))
(let* ((win (next-window))
(bname (buffer-name (window-buffer win))))
(when (some 'identity (mapcar '(lambda (re)
(string-match re bname))
ignore-windows-containing-buffers-matching-res))
(ad-set-arg 0 2)))))
Run Code Online (Sandbox Code Playgroud)
将变量自定义为与要跳过的缓冲区名称匹配的正则表达式.
Trey的答案将完全符合您的要求(至少看起来会如此;我没有尝试过).更通用的解决方案是swbuff与swbuff-x我们自己一起使用swbuff-advice.有关这三个的信息可以在Emacs Wiki swbuff页面上找到.