unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Ryan Thompson <rct@thompsonclan.org>
Cc: 9765@debbugs.gnu.org
Subject: bug#9765: 24.0.90; Multiple calls to desktop-read cause problems
Date: Mon, 07 Dec 2020 18:54:26 +0100	[thread overview]
Message-ID: <87y2i97b8t.fsf@gnus.org> (raw)
In-Reply-To: <CAHCt_aYzzSB7kFWLZ=TgodQvJ3f6n7mL3sjSObYdL5b_bPAauA@mail.gmail.com> (Ryan Thompson's message of "Sun, 16 Oct 2011 03:47:31 -0700")

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	other threads:[~2020-12-07 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16 10:47 bug#9765: 24.0.90; Multiple calls to desktop-read cause problems Ryan Thompson
2020-12-07 17:54 ` Lars Ingebrigtsen [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87y2i97b8t.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=9765@debbugs.gnu.org \
    --cc=rct@thompsonclan.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).