GNU bug report logs - #9765
24.0.90; Multiple calls to desktop-read cause problems

Previous Next

Package: emacs;

Reported by: Ryan Thompson <rct <at> thompsonclan.org>

Date: Sun, 16 Oct 2011 10:49:02 UTC

Severity: normal

Tags: fixed

Found in version 24.0.90

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 9765 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ryan Thompson <rct <at> thompsonclan.org>
Cc: 9765 <at> debbugs.gnu.org
Subject: Re: bug#9765: 24.0.90; Multiple calls to desktop-read cause problems
Date: Mon, 07 Dec 2020 18:54:26 +0100
Ryan Thompson <rct <at> thompsonclan.org> writes:

> If a desktop has already been loaded and "desktop-read" is called a
> second time, it will set "desktop-dirname" to nil, which can cause
> problems when trying to save the desktop later. The "desktop-read"
> function checks whether a desktop file is owned before loading it, and
> if the file is owned, it refuses to "steal" the file (assuming
> appropriate options are set) and sets "desktop-dirname" to nil to
> indicate that it does not own the file. This behavior occurs even when
> the owner of the desktop file is the Emacs process itself. Thus, calling
> "desktop-read" once loads the desktop file, and calling "desktop-read" a
> second time effectively abandons it. This behavior can be fixed with the
> following advice, which turns "desktop-read" into a no-op when the
> current Emacs process is already the desktop owner.
>
> (defadvice desktop-read (around avoid-redundant-read activate)
>   "Don't abandon an already-loaded desktop"
>   (if (and (desktop-owner) (= (desktop-owner) (emacs-pid)))
>       (message "Desktop file already loaded. Skipping reload.")
>     ad-do-it))
>
> I'm not sure if this is an appropriate fix, but I think this is the
> correct behavior.

I've now done something similar to what you suggest in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.