all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acm@muc.de, 58634@debbugs.gnu.org, akrl@sdf.org
Subject: bug#58634: Long delay with blank screen whilst loading desktop at emacs startup
Date: Thu, 20 Oct 2022 10:55:40 +0000	[thread overview]
Message-ID: <Y1EpLKhm85c1rQFI@ACM> (raw)
In-Reply-To: <837d0vyssv.fsf@gnu.org>

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 <eliz@gnu.org>, 58634@debbugs.gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > 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).





  reply	other threads:[~2022-10-20 10:55 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 13:28 bug#58634: Long delay with blank screen whilst loading desktop at emacs startup Alan Mackenzie
2022-10-19 15:49 ` Eli Zaretskii
2022-10-19 19:11   ` Andrea Corallo
2022-10-19 19:58     ` Alan Mackenzie
2022-10-20  5:20       ` Eli Zaretskii
2022-10-20 10:55         ` Alan Mackenzie [this message]
2022-10-20 13:07           ` Eli Zaretskii
2022-10-20 15:28             ` Alan Mackenzie
2022-10-20 16:28               ` Eli Zaretskii
2022-10-21  8:59                 ` Alan Mackenzie
2022-10-21 11:28                   ` Eli Zaretskii
2022-10-21 12:40                     ` Alan Mackenzie
2022-10-21 13:22                       ` Eli Zaretskii
2022-10-21 14:15                         ` Alan Mackenzie
2022-10-21 15:23                           ` Eli Zaretskii
2022-10-21 15:42                             ` Alan Mackenzie
2022-10-21 15:57                               ` Eli Zaretskii
2022-10-21 17:15                                 ` Alan Mackenzie
2022-10-21 18:12                                   ` Eli Zaretskii
2022-10-21 19:01                                     ` Alan Mackenzie
2022-10-21 19:14                                       ` Eli Zaretskii
2022-10-21 20:11                                         ` Alan Mackenzie
2022-10-22  6:26                                           ` Eli Zaretskii
2022-10-22 12:20                                             ` Alan Mackenzie
2022-10-22 13:11                                               ` Eli Zaretskii
2022-10-23 15:22                                                 ` Alan Mackenzie
2022-10-23 16:23                                                   ` Eli Zaretskii
2022-10-23 18:58                                                     ` Alan Mackenzie
2022-10-23 19:11                                                       ` Eli Zaretskii
2022-10-26 16:35                                                         ` Alan Mackenzie
2022-10-26 16:38                                                           ` Eli Zaretskii
2022-10-26 19:39                                                           ` Stefan Kangas
2022-10-27  5:19                                                             ` Eli Zaretskii
2022-10-21 19:09                       ` Stefan Kangas
2022-10-22 17:46                     ` Juri Linkov
2022-10-22 18:33                       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1EpLKhm85c1rQFI@ACM \
    --to=acm@muc.de \
    --cc=58634@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.