【问题标题】:How can I prevent emacs from opening a new window for a buffer I already have open in this session?如何防止 emacs 为我在此会话中打开的缓冲区打开新窗口?
【发布时间】:2012-08-16 11:07:14
【问题描述】:

我通常会同时打开两个 emacs 框架。

当我运行vc-diff 时,会创建一个新窗口,无论窗口是否已经显示该缓冲区。

是否有防止这种情况发生的通用方法?

【问题讨论】:

  • 默认情况下不这样做。您是否已将其设置为运行 ediff 或类似的?
  • 不,我的初始化文件中没有任何内容。我在这里指的是 emacs 意义上的 windows,而不是 X windows。

标签: emacs elisp


【解决方案1】:

pop-up-frames 设置为非零值将阻止pop-to-buffer 打开新窗口。相反,*vc-diff* 缓冲区将成为显示它的框架中的活动窗口。

(setq pop-up-frames t)

更改此变量也会影响使用pop-to-buffer 的其他函数。

【讨论】:

    【解决方案2】:

    我认为您需要通过添加将display-buffer-base-action 自定义为display-buffer--other-frame-action

    (custom-set-variables
     '(display-buffer-base-action display-buffer--other-frame-action))
    

    到你的.emacs.el 或者也许

    (custom-set-variables
     '(display-buffer-base-action 
       '(display-buffer-reuse-window (reusable-frames . t))))
    

    我建议阅读上述所有变量 (C-h v) 和函数 (C-h f) 的帮助。

    祝你好运!

    【讨论】:

      猜你喜欢
      • 2014-10-17
      • 1970-01-01
      • 1970-01-01
      • 2010-09-19
      • 2010-10-22
      • 1970-01-01
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多