Subject: Re: bug#3419: 23.0.94; calc, calendar and temp-buffer-resize-mode

From: Juri Linkov <[email-masked]>
Date: Wed, 02 Nov 2011 11:35:39 +0200

>> (let ((display-buffer-overriding-action '(display-buffer-reuse-window
>>                                           (inhibit-same-window . t))))
>
> Better would be
>
>> (let ((display-buffer-overriding-action '(nil (inhibit-same-window . t))))

Yes, this works too.

Looking at the available display actions in window.el, I found that
there are `display-buffer--other-frame-action' and the command
`display-buffer-other-frame' that uses it, but their counterpart
window functions are missing.

Copying these frame-related functions and replacing "frame" with "window"
in their names, produces two new functions:

(defvar display-buffer--other-window-action
  '((display-buffer-reuse-window
     display-buffer--special
     display-buffer-pop-up-window)
    (inhibit-same-window . t)))

(defun display-buffer-other-window (buffer)
  (interactive "BDisplay buffer in other window: ")
  (display-buffer buffer display-buffer--other-window-action))

I don't know why these window functions are omitted from window.el,
but the `display-buffer--other-window-action' would be useful for this case:

(let ((display-buffer-overriding-action display-buffer--other-window-action))
  (with-output-to-temp-buffer "*Help*"
    (princ "GNU Emacs Calculator.\n")))