GNU bug report logs - #78418
31.0.50; Change in fit-frame-to-buffer doesn't work with transient-posframe

Previous Next

Package: emacs;

Reported by: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Date: Wed, 14 May 2025 07:22:01 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: yhaoxie <at> gmail.com, 78418 <at> debbugs.gnu.org
Subject: bug#78418: 31.0.50; Change in fit-frame-to-buffer doesn't work with transient-posframe
Date: Wed, 14 May 2025 11:08:09 +0200
>> what are the values of 'text-minus-body-height' and 'char-height' when
>> the problem happens?
>>
>> martin
>
> text-minus-body-height 0, char-height 1

Thanks.  Silly thinko then and the below should fix it.

martin

diff --git a/lisp/window.el b/lisp/window.el
index e0e626e9500..e372ef8b9bb 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -10153,14 +10153,14 @@ fit-frame-to-buffer-1
 	;; this may cause lines getting wrapped.  To avoid that, round
 	;; sizes up here which will, however, leave a blank space at the
 	;; end of the longest line(s).
-	(setq text-minus-body-width
-	      (+ text-minus-body-width
-		 (- char-width
-		    (% text-minus-body-width char-width))))
-	(setq text-minus-body-height
-	      (+ text-minus-body-height
-		 (- char-height
-		    (% text-minus-body-height char-height)))))
+	(let ((remainder (% text-minus-body-width char-width)))
+	  (unless (zerop remainder)
+	    (setq text-minus-body-width
+		  (+ text-minus-body-width (- char-width remainder)))))
+	(let ((remainder (% text-minus-body-height char-height)))
+	  (unless (zerop remainder)
+	    (setq text-minus-body-height
+		  (+ text-minus-body-height(- char-height remainder))))))
       (setq text-width
             (if width
                 (+ width text-minus-body-width)




This bug report was last modified 86 days ago.

Previous Next


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