bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9765: 24.0.90; Multiple calls to desktop-read cause problems


From: Lars Ingebrigtsen
Subject: bug#9765: 24.0.90; Multiple calls to desktop-read cause problems
Date: Mon, 07 Dec 2020 18:54:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Ryan Thompson <rct@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]