* lisp/ibuffer.el (ibuffer-shrink-to-fit): Fit window only if its
buffer is in 'ibuffer-mode' (Bug#7218, Bug#51029).
;; Make sure that redisplay is performed, otherwise there can be a
;; bad interaction with code in the window-scroll-functions hook
(redisplay t)
- (when (and (boundp 'ibuffer-auto-mode) ; ibuf-ext.el might not be loaded yet
- (buffer-local-value 'ibuffer-auto-mode (window-buffer)))
+ (when (with-current-buffer (window-buffer)
+ (eq major-mode 'ibuffer-mode))
(fit-window-to-buffer
nil (and owin
(/ (frame-height)