Subject: bug#1806: dired-pop-to-buffer in wrong place

From: Stefan Monnier <[email-masked]>
Date: Thu, 30 Apr 2009 14:29:06 -0400

>> Why would it override it?  It would of course bind
>> split-window-preferred-function to a function that selects the right
>> window and then calls the previous value.

> Maybe you can come up with some advanced technique to do that but here I
> would have to define a variable to save the current (user provided)
> `split-window-preferred-function' and call the function I save there
> within the body of the function provided by dired.

I'd use something like

  (lexical-let ((oldfun split-window-preferred-function))
    (let ((split-window-preferred-function
           (lambda () (with-selected-window TOTO (funcall oldfun)))))
      BLABLA))

> Hence an extra variable would be needed anyway and I suppose it's
> easier to define that in window.el rather than in all packages that
> want to change the window to split (IIRC Calendar was one of these).

The above coding should be close to "standard practice" for locally
rebinding a *-function variable.  The "extra variable" doesn't matter,
it's not like we count variables.

Maybe what you're getting at is that we should make a hook to influence
the window-choice.  Maybe so.  But it doesn't seem urgent.

        Stefan