GNU bug report logs -
#55070
28.1; desktop-load doesn't work in -nw (non-gui) emacs
Previous Next
Reported by: Eric Swenson <eric <at> swenson.org>
Date: Sat, 23 Apr 2022 00:00:02 UTC
Severity: normal
Tags: moreinfo, patch
Found in version 28.1
Fixed in version 29.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #28 received at 55070 <at> debbugs.gnu.org (full text, mbox):
> OK, thanks for the details. They tell me that what you see is the
> intended behavior: desktop.el doesn't restore frames and windows on
> text-mode terminals. This is because restoring frames and windows in
> a -nw session is problematic, especially if the desktop was saved from
> a GUI session.
Interesting, I see this is disabled explicitly by display-graphic-p in:
(defun desktop-restoring-frameset-p ()
"True if calling `desktop-restore-frameset' will actually restore it."
(and desktop-restore-frames desktop-saved-frameset (display-graphic-p) t))
When I tried to remove display-graphic-p, then it's problematic indeed
and fails with:
frameset-move-onscreen(#<frame F1 0x5645998d8be0> t)
frameset--restore-frame(((minibuffer . t) (tty-type . "xterm-256color") ...
frameset-restore([frameset 1 ...
desktop-restore-frameset()
desktop-read(nil (4))
funcall-interactively(desktop-read nil (4))
command-execute(desktop-read record)
So the problem is in frameset-move-onscreen. A little debugging
revealed that it fails on the nil frame-parameter 'left',
so a small patch could fix it, then restoring frames
in a -nw session works fine:
diff --git a/lisp/frameset.el b/lisp/frameset.el
index 05884eed3a..32966376d8 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -883,8 +883,8 @@ frameset-move-onscreen
(pcase-let* ((`(,left ,top ,width ,height) (cdadr (frame-monitor-attributes frame)))
(right (+ left width -1))
(bottom (+ top height -1))
- (fr-left (frameset-compute-pos (frame-parameter frame 'left) left right))
- (fr-top (frameset-compute-pos (frame-parameter frame 'top) top bottom))
+ (fr-left (frameset-compute-pos (or (frame-parameter frame 'left) 0) left right))
+ (fr-top (frameset-compute-pos (or (frame-parameter frame 'top) 0) top bottom))
(ch-width (frame-char-width frame))
(ch-height (frame-char-height frame))
(fr-width (max (frame-pixel-width frame) (* ch-width (frame-width frame))))
This bug report was last modified 3 years and 19 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.