[Top][All Lists]

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

bug#7218: 24.0.50; Weird window resizing with ibuffer-auto-mode

From: martin rudalics
Subject: bug#7218: 24.0.50; Weird window resizing with ibuffer-auto-mode
Date: Fri, 15 Oct 2010 08:34:42 +0200
User-agent: Thunderbird (Windows/20090302)

> After invoking ibuffer with ibuffer-auto-mode enabled, all windows I
> switch to using `C-x o' are shrunken to fit their contents.  Switching
> windows again restores the original size.  That's pretty annoying.
> Here's a recipe:
> 1) emacs -Q
> 2) In *scratch*, evaluate these settings:
> --8<---------------cut here---------------start------------->8---
> (defun th-ibuffer-mode-init ()
>   (ibuffer-auto-mode 1))
> (add-hook 'ibuffer-mode-hook
>      'th-ibuffer-mode-init)
> (global-set-key (kbd "C-x C-b")
>            (lambda ()
>              (interactive)
>              (ibuffer t nil nil nil 'onewindow)))
> --8<---------------cut here---------------end--------------->8---
> 3) Press C-x C-b
> 4) The *IBuffer* buffer window shows *scratch* and *Messages* and is
>    resized to fit its contents.
> 5) Press C-x o multiple times, and see how windows start shrinking and
>    growing.
> As long as the *IBuffer* buffer is alive, I get that strange window
> resizing also when it's not visible and switching between windows
> showing for example *scratch* and *Messages*.  As soon as I kill the
> *IBuffer* buffer, it works again.

It happens because `ibuffer-shrink-to-fit' shrinks the selected window
regardless of the buffer it displays.  I suppose doing something like

(defun ibuffer-shrink-to-fit (&optional owin)
  ;; Make sure that redisplay is performed, otherwise there can be a
  ;; bad interaction with code in the window-scroll-functions hook
  (redisplay t)
  (when (with-current-buffer (window-buffer)
    (fit-window-to-buffer nil (when owin (/ (frame-height)
                                            (length (window-list 

would cure it.  But I'd rather not comment on calling a function like
`ibuffer-shrink-to-fit' in `post-command-hook' ;-)


reply via email to

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