From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#58634: Long delay with blank screen whilst loading desktop at emacs startup Date: Thu, 20 Oct 2022 10:55:40 +0000 Message-ID: References: <83edv3zud8.fsf@gnu.org> <837d0vyssv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33592"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 58634@debbugs.gnu.org, akrl@sdf.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 20 13:37:09 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 1olTrJ-0008aO-C1 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Oct 2022 13:37:09 +0200 Original-Received: from localhost ([::1]:55472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTrF-00059R-D0 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Oct 2022 07:37:05 -0400 Original-Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olTgB-0003Q6-Gj for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Oct 2022 07:25:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olTDX-0004Pr-9A for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2022 06:56:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34037) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olTDW-0008Mq-Bq for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2022 06:56:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1olTDW-0008JL-0C for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2022 06:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Oct 2022 10:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58634 X-GNU-PR-Package: emacs Original-Received: via spool by 58634-submit@debbugs.gnu.org id=B58634.166626335331926 (code B ref 58634); Thu, 20 Oct 2022 10:56:01 +0000 Original-Received: (at 58634) by debbugs.gnu.org; 20 Oct 2022 10:55:53 +0000 Original-Received: from localhost ([127.0.0.1]:33113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olTDN-0008Is-57 for submit@debbugs.gnu.org; Thu, 20 Oct 2022 06:55:53 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]:28995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olTDJ-0008IX-Fl for 58634@debbugs.gnu.org; Thu, 20 Oct 2022 06:55:51 -0400 Original-Received: (qmail 69101 invoked by uid 3782); 20 Oct 2022 12:55:41 +0200 Original-Received: from acm.muc.de (p4fe15bc5.dip0.t-ipconnect.de [79.225.91.197]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 20 Oct 2022 12:55:41 +0200 Original-Received: (qmail 20190 invoked by uid 1000); 20 Oct 2022 10:55:40 -0000 Content-Disposition: inline In-Reply-To: <837d0vyssv.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:245933 Archived-At: Hello, Eli. On Thu, Oct 20, 2022 at 08:20:48 +0300, Eli Zaretskii wrote: > > Date: Wed, 19 Oct 2022 19:58:36 +0000 > > Cc: Eli Zaretskii , 58634@debbugs.gnu.org > > From: Alan Mackenzie > > I have a theory. The function desktop-restore-file-buffer visits a file > > with find-file-noselect, then calls switch-to-buffer on it. (This is the > > interactive command on C-x b.) In earlier times, there would be a delay > > in visiting the next file, and in this delay redisplay would happen. The > > user would thus see a sequence of short displays of his files being > > loaded. Nowadays, the time to visit a file is so short that redisplay > > never registers a delay, and so doesn't redisplay. But with something > > slowing the processing down a little (outputting "Restoring > > desktop......", for example), the OS's file system goes to sleep, and > > takes long enough to wake up for redisplay to trigger. Or something like > > that. > > What do you think? > Does this happen with Emacs 28 as well in your configuration? It does, yes. More precisely, it did after I commented out some variables in several .dir-locals that were causing "unsafe variable" warning messages. > Because with Emacs 28 I use desktop.el all the time, and I do see the > frame displaying some files and messages in the echo-area. Remember, the blank screen only happens for me in emacs -nw and on the linux console, not in GUI X. > If the same happens for you with Emacs 28, I guess it's somehow > related to your init files and/or what exactly is in your session. > For example, my sessions always include some buffers under Text mode > or its descendants, and those turn on Flyspell mode in my > configuration; starting Flyspell mode launches the speller as a > sub-process, and that usually triggers some form of redisplay. In > addition, I have garbage-collection-messages turned on, so GC-related > messages are shown in the echo-area, which also is a kind of > redisplay. Restoring file buffers sometimes produces prompts, e.g. if > the file is too large or there are local variables there that require > confirmation -- and those prompts trigger redisplay as well. > If you have none of that in your configuration, perhaps desktop.el can > indeed produce a completely blank frame. Although it sounds strange > to me, since I never saw anything like that. But it could be because > I'm used to starting Emacs with my configuration. All this supports my hypothesis (above). Anything which is "slow" causes a redisplay during desktop loading. For each buffer loaded, there is a switch-to-buffer call, so anything causing a redisplay will display that buffer. If you agree with me that this needs fixing (I think you do), I have two ideas on how to fix it: (i) (Rough and ready): Output a "progress report" in the form of a dot for each buffer, showing "Restoring desktop.......", exactly as in the patch I included yesterday. The user might not see any buffers here, but will at least be reassured his Emacs hasn't hung. (ii) (More complicated): Count the number of buffers since the last redisplay. When this reaches, say, 10, cause the next buffer to be redisplayed by something like (sit-for 0.1), or even (redisplay) in desktop-restore-file-buffer. The counter would be reset by a function on the hook pre-redisplay-functions. What do you think? -- Alan Mackenzie (Nuremberg, Germany).