GNU bug report logs - #28442
26.0.50; desktop-save-mode no longer restores correct frame size on macOS

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Wed, 13 Sep 2017 11:07:01 UTC

Severity: normal

Found in version 26.0.50

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Aaron Jensen <aaronjensen <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>, Alan Third <alan <at> idiocy.org>
Cc: 28442 <at> debbugs.gnu.org
Subject: bug#28442: 26.0.50; [PATCH] Save and restore frame pixel size with desktop-save-mode
Date: Sun, 26 Nov 2017 10:47:37 -0800
How’s this?

---
 ChangeLog.3      | 11 +++++++++++
 lisp/frameset.el | 28 +++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.3 b/ChangeLog.3
index 46d98d8026..00cc440479 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1,3 +1,14 @@
+2017-11-26  Aaron Jensen  <aaronjensen <at> gmail.com>
+
+	Save and restore text-pixel height and width of
+	frames. (Bug#28442)
+
+	* lisp/frameset.el
+	(frameset--record-relationships): Record text-pixel-height and
+	text-pixel-width of frame.
+	(frameset--restore-frame): Restore text-pixel-height and
+	text-pixel-width of frame if available.
+
 2017-10-11  Michael Albinus  <michael.albinus <at> gmx.de>

 	Format shell commands in tramp.texi
diff --git a/lisp/frameset.el b/lisp/frameset.el
index 16940f814a..e2d26411e9 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -745,6 +745,8 @@ frameset--record-relationships
 - `delete-before' via `frameset--delete-before'
 - `parent-frame' via `frameset--parent-frame'
 - `mouse-wheel-frame' via `frameset--mouse-wheel-frame'
+- `text-pixel-width' via `frameset--text-pixel-width'
+- `text-pixel-height' via `frameset--text-pixel-height'

 Internal use only."
   ;; Record frames with their own minibuffer
@@ -791,7 +793,23 @@ frameset--record-relationships
              'frameset--mini
              (cons nil
                    (and mb-frame
-                        (frameset-frame-id mb-frame))))))))))
+                        (frameset-frame-id mb-frame)))))))))
+  ;; Now store text-pixel width and height if it differs from the calculated
+  ;; width and height and the frame is not fullscreen.
+  (dolist (frame frame-list)
+    (unless (frame-parameter frame 'fullscreen)
+      (unless (eq (* (frame-parameter frame 'width)
+                     (frame-char-width frame))
+                  (frame-text-width frame))
+        (set-frame-parameter
+         frame 'frameset--text-pixel-width
+         (frame-text-width frame)))
+      (unless (eq (* (frame-parameter frame 'height)
+                     (frame-char-height frame))
+                  (frame-text-height frame))
+        (set-frame-parameter
+         frame 'frameset--text-pixel-height
+         (frame-text-height frame))))))

 ;;;###autoload
 (cl-defun frameset-save (frame-list
@@ -1002,6 +1020,14 @@ frameset--restore-frame
 	 (display (cdr (assq 'display filtered-cfg))) ;; post-filtering
 	 alt-cfg frame)

+    ;; Use text-pixels for height and width, if available.
+    (let ((text-pixel-width (cdr (assq 'frameset--text-pixel-width
parameters)))
+          (text-pixel-height (cdr (assq 'frameset--text-pixel-height
parameters))))
+      (when text-pixel-width
+        (setf (alist-get 'width filtered-cfg) (cons 'text-pixels
text-pixel-width)))
+      (when text-pixel-height
+        (setf (alist-get 'height filtered-cfg) (cons 'text-pixels
text-pixel-height))))
+
     (when fullscreen
       ;; Currently Emacs has the limitation that it does not record the size
       ;; and position of a frame before maximizing it, so we cannot save &
--
2.15.0




This bug report was last modified 7 years and 221 days ago.

Previous Next


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