如何使窗口移动命令忽略某个窗口?

发布于 2024-08-07 20:20:36 字数 341 浏览 15 评论 0原文

所以我通常在 Emacs 中打开 3 个缓冲区。

  1. 我正在编写的实际代码的一个缓冲区。
  2. 用于对所述代码进行单元测试的一个缓冲区。
  3. 第三个缓冲区显示单元测试的结果。这个缓冲区就应运而生了 当我运行单元测试 Cx SPACE 时,它位于其他两个缓冲区下方。

如何禁用第三个缓冲区,以便当我按 Cx o 时,我只在缓冲区 1 和缓冲区 2 之间切换?目前,我在缓冲区 1、缓冲区 2、缓冲区 3、缓冲区 1 之间切换,等等。具体来说,我希望 Cx o 仅在缓冲区 1 和缓冲区 2 之间切换。

谢谢。

So I generally have 3 buffers open in Emacs.

  1. One buffer for the actual code I am writing.
  2. One buffer for the unit test for said code.
  3. A third buffer that displays the results of the unit test. This buffer comes into being
    below the two other buffers when I run my unit test C-x SPACE.

How do I disable this third buffer such that when I press C-x o I am only switching between buffer 1 and buffer 2? Currently, I switch between buffer 1, then buffer 2, then buffer 3, then buffer 1, etc. To be specific, I want C-x o to only switch between buffer 1 and 2.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放我走吧 2024-08-14 20:20:36

对此的一般解决方案(可以看起来)类似于以下内容:

(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)))))

将变量自定义为与要跳过的缓冲区名称匹配的正则表达式。

A general solution to this (can look) something like the following:

(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)))))

Customize the variable to be a regular expression matching the buffer names you want to skip.

笑梦风尘 2024-08-14 20:20:36

特雷的答案将完全符合你的要求(至少看起来会如此;我还没有尝试过)。更通用的解决方案是将 swbuffswbuff-x 或我自己的 swbuff-advice 一起使用。有关这三者的信息可以在 Emacs Wiki swbuff 页面 上找到。

Trey's answer will do exactly what you want (at least it looks like it will; I haven't tried it). A more generic solution would be to use swbuff with either swbuff-x or my own swbuff-advice. Info about all three can be found on the Emacs Wiki swbuff page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文