unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Not reloading the desktop; already loaded
@ 2022-10-27 22:24 Tim Johnson
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Johnson @ 2022-10-27 22:24 UTC (permalink / raw)
  To: MLEmacs

Using GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 
3.24.20, cairo version 1.16.0)

I have written my own project management module using 'desktop.
If I have loaded a desktop file for a project and attempt to switch to a 
different project
I get the following message:

"Not reloading the desktop; already loaded"

and the loading of the second desktop file is suppressed.

I suspect that the problem will be solved by customizing 'desktop,
but do not know how to proceed.

Please advise. I am retired and as they say "If you don't use it, you 
lose it." :)

-- 
Tim
tj49.com




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Not reloading the desktop; already loaded
@ 2022-10-27 22:41 Tim Johnson
  2022-10-28  0:09 ` Emanuel Berg
  2022-10-28  6:03 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Tim Johnson @ 2022-10-27 22:41 UTC (permalink / raw)
  To: MLEmacs

Using GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 
3.24.20, cairo version 1.16.0)

I have written my own project management module using 'desktop.
If I have loaded a desktop file for a project and attempt to switch to a 
different project
I get the following message:

"Not reloading the desktop; already loaded"

and the loading of the second desktop file is suppressed.

I suspect that the problem will be solved by customizing 'desktop,
but do not know how to proceed.

Please advise. I am retired and as they say "If you don't use it, you 
lose it." :)

-- 
Tim
tj49.com




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Not reloading the desktop; already loaded
  2022-10-27 22:41 Not reloading the desktop; already loaded Tim Johnson
@ 2022-10-28  0:09 ` Emanuel Berg
  2022-10-28  6:03 ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Emanuel Berg @ 2022-10-28  0:09 UTC (permalink / raw)
  To: help-gnu-emacs

Tim Johnson wrote:

> Using GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+
> Version 3.24.20, cairo version 1.16.0)
>
> I have written my own project management module using
> 'desktop. If I have loaded a desktop file for a project and
> attempt to switch to a different project I get the following
> message:
>
>   "Not reloading the desktop; already loaded"
>
> and the loading of the second desktop file is suppressed.
>
> I suspect that the problem will be solved by customizing
> 'desktop, but do not know how to proceed.

Grep the source for that error message, it is in
`desktop-read' in desktop.el as you suspected.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Not reloading the desktop; already loaded
  2022-10-27 22:41 Not reloading the desktop; already loaded Tim Johnson
  2022-10-28  0:09 ` Emanuel Berg
@ 2022-10-28  6:03 ` Eli Zaretskii
  2022-10-28 19:27   ` Tim Johnson
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2022-10-28  6:03 UTC (permalink / raw)
  To: Help-gnu-emacs

> Date: Thu, 27 Oct 2022 14:41:42 -0800
> From: Tim Johnson <tim@akwebsoft.com>
> 
> I have written my own project management module using 'desktop.
> If I have loaded a desktop file for a project and attempt to switch to a 
> different project
> I get the following message:
> 
> "Not reloading the desktop; already loaded"
> 
> and the loading of the second desktop file is suppressed.
> 
> I suspect that the problem will be solved by customizing 'desktop,
> but do not know how to proceed.

Look at the code which issues this message:

  (if (or noninteractive
          (and (desktop-owner)
               (= (desktop-owner) (emacs-pid))))
      (message "Not reloading the desktop%s"
               (if noninteractive
                   ""
                 "; already loaded"))

I assume yours is an interactive (i.e., no "--batch") session, so the
condition that applies in your case is the one about the "owner" of
the desktop file.  So the problem is that the desktop file was (of
course) written by the same Emacs process as the current one, and you
need to work around that.  One way is to override the definition of
desktop-owner.  Another way is to release the desktop file lock before
you load the second one, and then re-lock it afterwards.  And there
are probably others.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Not reloading the desktop; already loaded
  2022-10-28  6:03 ` Eli Zaretskii
@ 2022-10-28 19:27   ` Tim Johnson
  2022-10-29  5:48     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Johnson @ 2022-10-28 19:27 UTC (permalink / raw)
  To: help-gnu-emacs



On 10/27/22 10:03 PM, Eli Zaretskii wrote:
>> Date: Thu, 27 Oct 2022 14:41:42 -0800
>> From: Tim Johnson <tim@akwebsoft.com>
>>
>> I have written my own project management module using 'desktop.
>> If I have loaded a desktop file for a project and attempt to switch to a
>> different project
>> I get the following message:
>>
>> "Not reloading the desktop; already loaded"
>>
>> and the loading of the second desktop file is suppressed.
>>
>> I suspect that the problem will be solved by customizing 'desktop,
>> but do not know how to proceed.
> Look at the code which issues this message:
>
>    (if (or noninteractive
>            (and (desktop-owner)
>                 (= (desktop-owner) (emacs-pid))))
>        (message "Not reloading the desktop%s"
>                 (if noninteractive
>                     ""
>                   "; already loaded"))
Thank you for the reply Eli
I have for years just deleted .emacs.desktop.lock, it works for me and
and I wasn't switching projects all that often. However, I would prefer 
a more
emacsen approach, so bottom-posting your content:
> I assume yours is an interactive (i.e., no "--batch") session, so the
> condition that applies in your case is the one about the "owner" of
> the desktop file.  So the problem is that the desktop file was (of
> course) written by the same Emacs process as the current one, and you
> need to work around that.  One way is to override the definition of
> desktop-owner.
How would I do that? (feel free to point to documentation and I will 
also search
on your last phrase)
>    Another way is to release the desktop file lock before
> you load the second one, and then re-lock it afterwards.
Again: how would I do that?
>   And there
> are probably others.
Sure, such as use elisp instead of bash to delete the file lock ...
cheers

-- 
Tim
tj49.com




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Not reloading the desktop; already loaded
  2022-10-28 19:27   ` Tim Johnson
@ 2022-10-29  5:48     ` Eli Zaretskii
  2022-10-29 15:17       ` Tim Johnson
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2022-10-29  5:48 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 28 Oct 2022 11:27:12 -0800
> From: Tim Johnson <tim@akwebsoft.com>
> 
> > I assume yours is an interactive (i.e., no "--batch") session, so the
> > condition that applies in your case is the one about the "owner" of
> > the desktop file.  So the problem is that the desktop file was (of
> > course) written by the same Emacs process as the current one, and you
> > need to work around that.  One way is to override the definition of
> > desktop-owner.
> How would I do that? (feel free to point to documentation and I will 
> also search
> on your last phrase)

The simplest way is to define your own version of that function that
is similar, but not identical.  A less brute-force way is to "advise"
the function; see the node "Advising Functions" in the ELisp manual.

> >    Another way is to release the desktop file lock before
> > you load the second one, and then re-lock it afterwards.
> Again: how would I do that?

Look at the functions in desktop.el which do that: desktop-claim-lock
and desktop-release-lock.  You can call them from your code.

> >   And there
> > are probably others.
> Sure, such as use elisp instead of bash to delete the file lock ...

Deleting the lock is not something I'd recommend.  It is there for a
reason.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Not reloading the desktop; already loaded
  2022-10-29  5:48     ` Eli Zaretskii
@ 2022-10-29 15:17       ` Tim Johnson
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Johnson @ 2022-10-29 15:17 UTC (permalink / raw)
  To: help-gnu-emacs



On 10/28/22 9:48 PM, Eli Zaretskii wrote:
>> Date: Fri, 28 Oct 2022 11:27:12 -0800
>> From: Tim Johnson <tim@akwebsoft.com>
>>
>>> I assume yours is an interactive (i.e., no "--batch") session, so the
>>> condition that applies in your case is the one about the "owner" of
>>> the desktop file.  So the problem is that the desktop file was (of
>>> course) written by the same Emacs process as the current one, and you
>>> need to work around that.  One way is to override the definition of
>>> desktop-owner.
>> How would I do that? (feel free to point to documentation and I will
>> also search
>> on your last phrase)
> The simplest way is to define your own version of that function that
> is similar, but not identical.  A less brute-force way is to "advise"
> the function; see the node "Advising Functions" in the ELisp manual.
>
>>>     Another way is to release the desktop file lock before
>>> you load the second one, and then re-lock it afterwards.
>> Again: how would I do that?
> Look at the functions in desktop.el which do that: desktop-claim-lock
> and desktop-release-lock.  You can call them from your code.
>
>>>    And there
>>> are probably others.
>> Sure, such as use elisp instead of bash to delete the file lock ...
> Deleting the lock is not something I'd recommend.  It is there for a
> reason.
>
Thank you Eli. I am good to go.
Regards

-- 
Tim
tj49.com




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-29 15:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 22:41 Not reloading the desktop; already loaded Tim Johnson
2022-10-28  0:09 ` Emanuel Berg
2022-10-28  6:03 ` Eli Zaretskii
2022-10-28 19:27   ` Tim Johnson
2022-10-29  5:48     ` Eli Zaretskii
2022-10-29 15:17       ` Tim Johnson
  -- strict thread matches above, loose matches on Subject: below --
2022-10-27 22:24 Tim Johnson

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