From d582ed9dc9be516f17dc9a526c3f9615001a46a6 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 5 Apr 2025 10:30:30 +0800 Subject: [PATCH] Disable desktop-restore-frames by default on Android * lisp/desktop.el (desktop-restore-frames): Default to nil when \(featurep 'android). * doc/emacs/misc.texi (Saving Emacs Sessions): Adjust to match. --- doc/emacs/misc.texi | 13 ++++++++----- etc/NEWS | 7 +++++++ lisp/desktop.el | 10 +++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 08a7f910c5c..8b0f96a3de3 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2924,11 +2924,14 @@ can use @kbd{M-x desktop-read} to restore a previously-saved desktop if the current Emacs session didn't load any desktop yet. @vindex desktop-restore-frames - By default, the desktop tries to save and restore the frame and -window configuration. To disable this, set -@code{desktop-restore-frames} to @code{nil}. (See that variable's -documentation for some related options that you can customize to -fine-tune this behavior.) + By default, the desktop tries to save and restore the frame and window +configuration.@footnote{Except on Android, where this option defaults to +@code{nil} because the window manager (@pxref{Android Windowing}) is too +prohibitive to admit of restoring frame configurations.} To disable or +enable this, set @code{desktop-restore-frames} to @code{nil} or any +non-@code{nil} value respectively. (See that variable's documentation +for some related options that you can customize to fine-tune this +behavior.) @vindex frameset-filter-alist When the desktop restores the frame and window configuration, it diff --git a/etc/NEWS b/etc/NEWS index dc77aff7ef2..fc202a795e4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2085,6 +2085,13 @@ Put differently, this enables input events to be read and recursive editing sessions to be started from non-main threads. The only platform where this remains unsupported is Nextstep (GNUstep or Mac OS). +--- +** 'desktop-restore-frames' has been disabled by default on Android systems. +Restrictions imposed on clients by the window manager on these systems +are too prohibitive to admit of restoring frame configurations, and on +the same account many window management facilities are unimplemented by +Emacs also. + --- ** 'NSSpeechRecognitionUsageDescription' now included in "Info.plist" (macOS). Should Emacs (or any built-in shell) invoke a process using macOS speech diff --git a/lisp/desktop.el b/lisp/desktop.el index 761d4558700..4067b5a1286 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -423,13 +423,17 @@ host is off-line." :type '(repeat symbol) :group 'desktop) -(defcustom desktop-restore-frames t +(defcustom desktop-restore-frames (not (featurep 'android)) "When non-nil, save and restore the frame and window configuration. See related options `desktop-restore-reuses-frames', -`desktop-restore-in-current-display', and `desktop-restore-forces-onscreen'." +`desktop-restore-in-current-display', and `desktop-restore-forces-onscreen'. + +This option is enabled by default elsewhere than on Android, where it is +disabled by default as programs are too handicapped by the window +manager for frames to be restored." :type 'boolean :group 'desktop - :version "24.4") + :version "31.1") (defcustom desktop-restore-in-current-display t "Controls how restoring of frames treats displays.