GNU bug report logs - #1806
dired-pop-to-buffer in wrong place

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 6 Jan 2009 15:40:04 UTC

Severity: normal

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


Message #697 received at 1806 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 1806 <at> debbugs.gnu.org
Subject: Re: dired-pop-to-buffer in wrong place
Date: Wed, 26 Sep 2012 10:48:51 +0200
> Like Dired and Proced, VC shrinks the window to fit the buffer in
> `log-edit-show-files', so it could use `with-temp-buffer-window' too
> if it will retain the original behavior in the affected commands.

Maybe.  But when a buffer already exists, `with-temp-buffer-window' is
not suitable since it erases its contents.

> There is no need to combine specifiers and no need to add
> `temp-buffer-resize-regexps'.  In your current implementation
> it's perfectly possible to use the following call in `dired-mark-pop-up':
>
> 	  (with-temp-buffer-window
> 	   buffer
> 	   (cons 'display-buffer-below-selected
> 		 '((fit-window-to-buffer . t)))
>            ...
>
> and to add the following code to `display-buffer-below-selected'
> (copied and adapted from `dired-pop-to-buffer'):
>
> (defun display-buffer-below-selected (buffer alist)
>   "Try displaying BUFFER in a window below the selected window.
> This either splits the selected window or reuses the window below
> the selected one."
>   (let (window)
>     (or (and (not (frame-parameter nil 'unsplittable))
> 	     (setq window (window--try-to-split-window (selected-window)))
> 	     (window--display-buffer
> 	      buffer window 'window display-buffer-mark-dedicated))
> 	(and (setq window (window-in-direction 'below))
> 	     (not (window-dedicated-p window))
> 	     (window--display-buffer
> 	      buffer window 'reuse display-buffer-mark-dedicated)))
>     ;; See Bug#12281.
>     (set-window-start window (point-min))
>     ;; If fit-window-to-buffer is t, make its window fit its contents.
>     (when (cdr (assq 'fit-window-to-buffer alist))
>       ;; Try to not delete window when we want to display less than
>       ;; `window-min-height' lines.
>       (fit-window-to-buffer window nil 1))
>     window))

How would we handle the case where `window--try-to-split-window' fails
for the selected window and some other window (like the frame's bottom
window) gets split?

>> Too many people don't like to automatically fit windows to
>> their buffers.  They must be able to turn that off.
>
> With the fixes above, users will be able to turn that off by customizing
> `display-buffer-alist' to the following value (this should be done via the
> Customization UI, but `setq' is used below for testing purposes):
>
> (setq display-buffer-alist '(("Marked Files" .
>                               (display-buffer-below-selected
>                                (fit-window-to-buffer . nil)))))

And how would they handle the frame bottom window case sketched above?

martin




This bug report was last modified 12 years and 236 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.