2

如何使用display-buffer-reuse-frames对某些帧强制执行类似行为display-buffer-alist

我试过做

(setq display-buffer-alist
      '(("\\*compilation\\*" .
         (display-buffer-reuse-window '((inhibit-same-window . t))))
        ))

,但无济于事。即使按照 Emacs 标准,该文档也很长而且很神秘,并且没有示例。

这与问题 3311577 不同,因为(setq-default display-buffer-reuse-frames t)已弃用。

4

1 回答 1

3

It sounds like you want to be using the reusable-frames entry in your ALIST argument to display-buffer-reuse-window, rather than inhabit-same-window? (or perhaps you wanted both?)

You also want to be using add-to-list rather than clobbering the entire list with setq.

Edit: My original answer messed up the list structure, as I was using the dotted-pair notation from the documentation, but had omitted one of the dots!

So the correct value is:

(add-to-list
 'display-buffer-alist
 '("\\*compilation\\*" . (display-buffer-reuse-window
                          . ((reusable-frames . t)))))

or equivalently:

(add-to-list
 'display-buffer-alist
 '("\\*compilation\\*" display-buffer-reuse-window
                         (reusable-frames . t)))

I also notice that there's a good customize interface for configuring this.

于 2013-05-21T02:07:12.343 回答