From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#55070: 28.1; desktop-load doesn't work in -nw (non-gui) emacs Date: Tue, 26 Apr 2022 10:58:28 +0300 Organization: LINKOV.NET Message-ID: <86wnfcxnvf.fsf@mail.linkov.net> References: <83fsm4pbs4.fsf@gnu.org> <6961B895-263C-4632-AA4E-8DE29D6160BC@swenson.org> <83sfq3op15.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20333"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: Eric Swenson , 55070@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 26 10:19:42 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njGQA-000592-1F for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Apr 2022 10:19:42 +0200 Original-Received: from localhost ([::1]:42012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njGQ8-00040M-LW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Apr 2022 04:19:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njGPX-0003z1-0X for bug-gnu-emacs@gnu.org; Tue, 26 Apr 2022 04:19:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njGPW-0003nW-G1 for bug-gnu-emacs@gnu.org; Tue, 26 Apr 2022 04:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1njGPW-0000b7-9d for bug-gnu-emacs@gnu.org; Tue, 26 Apr 2022 04:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Apr 2022 08:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55070 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 55070-submit@debbugs.gnu.org id=B55070.16509611072254 (code B ref 55070); Tue, 26 Apr 2022 08:19:02 +0000 Original-Received: (at 55070) by debbugs.gnu.org; 26 Apr 2022 08:18:27 +0000 Original-Received: from localhost ([127.0.0.1]:36977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njGOx-0000aI-2z for submit@debbugs.gnu.org; Tue, 26 Apr 2022 04:18:27 -0400 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:51775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njGOv-0000a5-8Z for 55070@debbugs.gnu.org; Tue, 26 Apr 2022 04:18:25 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 76F3B1BF209; Tue, 26 Apr 2022 08:18:16 +0000 (UTC) In-Reply-To: <83sfq3op15.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 23 Apr 2022 17:25:10 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:230688 Archived-At: > 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(# 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))))