bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: martin rudalics
Subject: bug#1806: dired-pop-to-buffer in wrong place
Date: Fri, 01 May 2009 12:04:17 +0200
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

>> 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))

We probably need something like in the attached patch but my knowledge
of closures within Elisp is very limited.

> 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.

I was aiming at an extra variable to work around "advanced techniques"
like closures.  `lexical-let' doesn't even indent reasonably :-(

martin
*** dired.el.~1.422.~   2009-04-18 08:32:56.546875000 +0200
--- dired.el    2009-05-01 11:47:49.109375000 +0200
***************
*** 2686,2694 ****
  
  (defun dired-pop-to-buffer (buf)
    "Pop up buffer BUF in a way suitable for Dired."
!   ;; Don't split window horizontally.  (Bug#1806)
!   (let (split-width-threshold)
!     (pop-to-buffer (get-buffer-create buf)))
    ;; If dired-shrink-to-fit is t, make its window fit its contents.
    (when dired-shrink-to-fit
      ;; Try to not delete window when we want to display less than
--- 2686,2696 ----
  
  (defun dired-pop-to-buffer (buf)
    "Pop up buffer BUF in a way suitable for Dired."
!   (lexical-let ((old-fun split-window-preferred-function)
!               (old-window (selected-window)))
!     (let ((split-window-preferred-function
!          (lambda () (with-selected-window old-window (funcall old-fun)))))
!       (pop-to-buffer (get-buffer-create buf))))
    ;; If dired-shrink-to-fit is t, make its window fit its contents.
    (when dired-shrink-to-fit
      ;; Try to not delete window when we want to display less than

reply via email to

[Prev in Thread] Current Thread [Next in Thread]