所以我通常在Emacs中打开3个缓冲区。
如何禁用此第三个缓冲区,以便当我按 C-x o 时,我只在缓冲区1和缓冲区2之间切换?目前,我在缓冲区1,缓冲区2,缓冲区3,缓冲区1等之间切换。具体来说,我希望 C-x o 仅在缓冲区1和2之间切换。
谢谢。
答案 0 :(得分:7)
对此的一般解决方案(可以看)如下所示:
(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)))))
将变量自定义为与要跳过的缓冲区名称匹配的正则表达式。
答案 1 :(得分:5)
Trey的回答将完全符合您的要求(至少看起来会如此;我没有尝试过)。更通用的解决方案是将swbuff
与swbuff-x
或我自己的swbuff-advice
一起使用。有关这三者的信息可以在Emacs Wiki swbuff page上找到。