2

How is it possible to enforce display-buffer-reuse-frames-like behavior for certain frames with display-buffer-alist?

I have tried doing

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

, but to no avail. The documentation is long and cryptic even by Emacs standards, and has no examples.

This is not the same as question 3311577 because (setq-default display-buffer-reuse-frames t) is deprecated.

Community
  • 1
  • 1
Mischa Arefiev
  • 5,227
  • 4
  • 26
  • 34

1 Answers1

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.

phils
  • 71,335
  • 11
  • 153
  • 198
  • Thank you, but unfortunately it does not work — it switches my current frame in which I press `F9` to `*compilation*` regardless of whether there is already a frame (X window) with `*compilation*` open, so I end up with two monitors showing GCC output. – Mischa Arefiev May 21 '13 at 07:20
  • I have also tried setting `inhibit-same-window` to `t`, but it did not help either. – Mischa Arefiev May 21 '13 at 07:21
  • You've bound `F9` to `compile` ? – phils May 21 '13 at 09:34
  • phils, `(global-set-key [f9] 'compile)` – Mischa Arefiev May 21 '13 at 11:04
  • @phils Should it be F10? –  Sep 20 '20 at 21:55
  • @Roadowl Probably not? The key sequences reserved solely for use by end users are "those consisting of ‘C-c’ followed by a letter (either upper or lower case), and function keys through without modifiers", so F9 should never be used by anything else, whereas F10 is likely to be (by default it's a global binding to open the menus). In the end it's your call, though. – phils Sep 20 '20 at 22:15
  • @phils Any thoughts on a Sun Type 5c keyboard US edition hanging through a tmk programmed Teensy off a USB connector to a Linux machine? As you probably know, it has the 10 extra keys on the left (Stop, Again, Props, etc.). (As well as a Help key, a Compose key [with LED!] and an Alt Graph key.) –  Sep 21 '20 at 00:13
  • No particular thoughts -- but if feel you can make good use of the extra keys in Emacs, go for it. I don't have a keyboard like that, but most of the 'extra' keys I have are bound to various Emacs things (in some cases this means ensuring that my window manager ignores them). – phils Sep 21 '20 at 00:21
  • Same ;-) Btw., I forgot: UNIX layout. Have fun! –  Sep 21 '20 at 00:21