GNU bug report logs - #63455
30.0.50; display-buffer-in-direction is always resizing

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Fri, 12 May 2023 01:07:01 UTC

Severity: normal

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 63455 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: bug#63455: 30.0.50; display-buffer-in-direction is always resizing
Date: Wed, 17 May 2023 19:56:56 +0300
[Message part 1 (text/plain, inline)]
> 'temp-buffer-window-show' has a third argument NO-RESIZE and its last
> lines are rewritten as
>
> 	(with-selected-window window
> 	  (run-hooks 'temp-buffer-window-show-hook)
> 	  (when (and (not no-resize) temp-buffer-resize-mode)
> 	    (resize-temp-buffer-window window)))
> 	;; Return the window.
> 	window))))
>
> Maybe Juri can make heads or tails of this.

Does your complete patch look like this?

[bug_63455.patch (text/x-diff, inline)]
diff --git a/lisp/files.el b/lisp/files.el
index 148f47cbc97..b3962145e79 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3772,7 +3772,8 @@ hack-local-variables-confirm
 
       ;; Display the buffer and read a choice.
       (save-window-excursion
-	(pop-to-buffer buf '(display-buffer--maybe-at-bottom))
+	(pop-to-buffer buf '(display-buffer--maybe-at-bottom
+			     (window-height . fit-window-to-buffer)))
 	(let* ((exit-chars '(?y ?n ?\s))
 	       (prompt (format "Please type %s%s: "
 			       (if offer-save
diff --git a/lisp/help.el b/lisp/help.el
index 6f55136049b..676c18f2411 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -2175,7 +2175,8 @@ help--window-setup
     (setq-local help-mode--current-data nil)
     (buffer-disable-undo)
     (let ((inhibit-read-only t)
-	  (inhibit-modification-hooks t))
+	  (inhibit-modification-hooks t)
+	  window)
       (erase-buffer)
       (delete-all-overlays)
       (prog1
@@ -2186,7 +2187,12 @@ help--window-setup
         (help-make-xrefs (current-buffer))
         ;; This must be done after the buffer has been completely
         ;; generated, since `temp-buffer-resize-mode' may be enabled.
-        (help-window-setup (temp-buffer-window-show (current-buffer)))))))
+        (help-window-setup
+         (setq window (temp-buffer-window-show (current-buffer) nil t)))
+        (help-make-xrefs (current-buffer))
+        (when (and window temp-buffer-resize-mode)
+          (let (resize-temp-buffer-window-inhibit)
+            (resize-temp-buffer-window window)))))))
 
 ;; Called from C, on encountering `help-char' when reading a char.
 ;; Don't print to *Help*; that would clobber Help history.
diff --git a/lisp/window.el b/lisp/window.el
index aa7520f30fa..b816d10298a 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -110,7 +110,7 @@ temp-buffer-window-setup
 ;; Defined in help.el.
 (defvar resize-temp-buffer-window-inhibit)
 
-(defun temp-buffer-window-show (buffer &optional action)
+(defun temp-buffer-window-show (buffer &optional action no-resize)
   "Show temporary buffer BUFFER in a window.
 Return the window showing BUFFER.  Pass ACTION as action argument
 to `display-buffer'."
@@ -139,7 +139,7 @@ temp-buffer-window-show
 	(set-window-hscroll window 0)
 	(with-selected-window window
 	  (run-hooks 'temp-buffer-window-show-hook)
-	  (when temp-buffer-resize-mode
+	  (when (and (not no-resize) temp-buffer-resize-mode)
 	    (resize-temp-buffer-window window)))
 	;; Return the window.
 	window))))
@@ -8300,14 +8305,6 @@ display-buffer-in-direction
 	 (t
 	  (setq direction 'below)))
 
-	(setq alist
-	      (append alist
-		      `(,(if temp-buffer-resize-mode
-		             '(window-height . resize-temp-buffer-window)
-	                   '(window-height . fit-window-to-buffer))
-	                ,(when temp-buffer-resize-mode
-	                   '(preserve-size . (nil . t))))))
-
 	(setq windows (windows-sharing-edge window direction within))
 	(dolist (other windows)
 	  (cond
@@ -8384,15 +8381,10 @@ display-buffer-below-selected
 	     (window--display-buffer buffer window 'reuse alist)))))
 
 (defun display-buffer--maybe-at-bottom (buffer alist)
-  (let ((alist (append alist `(,(if temp-buffer-resize-mode
-		                    '(window-height . resize-temp-buffer-window)
-	                          '(window-height . fit-window-to-buffer))
-	                       ,(when temp-buffer-resize-mode
-	                          '(preserve-size . (nil . t)))))))
-    (or (display-buffer--maybe-same-window buffer alist)
+  (or (display-buffer--maybe-same-window buffer alist)
         (display-buffer-reuse-window buffer alist)
         (display-buffer--maybe-pop-up-frame buffer alist)
-        (display-buffer-at-bottom buffer alist))))
+        (display-buffer-at-bottom buffer alist)))
 
 ;; This should be rewritten as
 ;; (display-buffer-in-direction buffer (cons '(direction . bottom) alist))
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index eb903f093f9..c6ce1b78e52 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -433,7 +433,8 @@ ediff-setup-windows-plain-compare
 
     (select-window (display-buffer-in-direction
                     control-buffer
-                    '((direction . bottom))))
+                    '((direction . bottom)
+                      (window-height . fit-window-to-buffer))))
     (ediff-setup-control-buffer control-buffer)
     ))
 

This bug report was last modified 2 years and 22 days ago.

Previous Next


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