4

display-buffer-reuse-frames tells Emacs to re-use frames for displaying buffers. However, as of 24.3 this variable is obsolete (emphasis mine):

display-buffer-reuse-frames is a variable defined in window.el.
Its value is t
Original value was nil

This variable is obsolete since 24.3; use a reusable-frames alist entry in display-buffer-alist.

Documentation:
Non-nil means display-buffer should reuse frames. If the buffer in question is already displayed in a frame, raise that frame.

I understand that I am supposed to replace that variable with display-buffer-alist. I'm familiar with the latter, and use it at many different places in my configuration, but nonetheless this docstring is a mystery to me.

What entry exactly do I need to add to display-buffer-alist to replicate this variable? IOW, what entry do I need to add to display-buffer-alist to make Emacs reuse frames for all buffers, while still using the default display actions?

And please, dear Emacs developers, write less hand-wavy docstrings for obsolete options…

  • I suspect you cannot easily reproduce the original functionality of that obsoleted variable as the code suggests you can only enable it for specific display-buffer-alist items otherwise. – wasamasa Jul 21 '15 at 9:17
  • 1
    The doc (doc string and manual) for display-buffer-alist is a hard nut to crack, indeed. Consider filing a doc bug report, if you can say something concrete about a problem you encounter with it or you have a suggestion for improving it: M-x report-emacs-bug. FWIW, the doc, although still difficult to fathom, is better than it was at first. – Drew Jul 21 '15 at 13:46
  • @Drew Thanks, but as I said I'm familiar with display-buffer-alist, and I'm fine with its docstring. My remark refers to the deprecation notice in the docstring of display-buffer-reuse-frames, which doesn't tell me the proper alternative instead. – lunaryorn Jul 21 '15 at 13:50
  • Same comment applies in that case. A deprecation notice should make clear what to replace the deprecated construct with. Or if there is no replacement then it should say that. (IMHO.) – Drew Jul 21 '15 at 14:31
  • It may behoove the original poster to clarify the question by explaining why the (2) two examples in the documentation that utilize a display-buffer-alist entry of (reusable-frames . 0) do not address the issue at hand: gnu.org/software/emacs/manual/html_node/elisp/… In other words, explain why neither of these examples replicates the behaviour of display-buffer-reuse-frames, and shows how to reuse frames for all buffers, using the default display actions. – lawlist Jul 21 '15 at 15:26
4

display-buffer merges the various alists. Something like this should apply reuse-frames to all buffers.

(add-to-list 'display-buffer-alist
             '("." nil (reusable-frames . t)))

Alternatively use display-buffer-overriding-action or even display-buffer-function (as a wrapper), if feasible.

  • Thanks, that's what I needed. I didn't know that nil was an acceptable value at this place. Still, it's not perfect, though. It must be the last entry in display-buffer-alist, because it overrides any later entry with more specific actions. Apparently, display-buffer merges alists, but not actions. – lunaryorn Jul 22 '15 at 7:39
  • Yes, that's a problem. Replacements of deperecations rarely provide the exact same functionality, I guess. – politza Jul 22 '15 at 14:03
  • 1
    Looking at the code, it doesn't even merge alists, as I thought for some reason. At least not the ones from display-buffer-alist, i.e. first match wins. – politza Jul 22 '15 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.