unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to stop desktop.lock file creation
@ 2022-03-24 22:33 Angelo Graziosi
  2022-03-25  6:34 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Angelo Graziosi @ 2022-03-24 22:33 UTC (permalink / raw)
  To: emacs-devel@gnu.org

It is very annoying that each time I forgot to close Emacs when logout from OS I have to delete that file manually at the next start...

Please, let me know what to add to the init.el file to avoid that Emacs creates that file...

TIA,
 Angelo.



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

* Re: How to stop desktop.lock file creation
  2022-03-24 22:33 How to stop desktop.lock file creation Angelo Graziosi
@ 2022-03-25  6:34 ` Eli Zaretskii
  2022-03-25 22:53   ` Angelo Graziosi
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-03-25  6:34 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: emacs-devel

> Date: Thu, 24 Mar 2022 23:33:59 +0100 (CET)
> From: Angelo Graziosi <angelo.g0@libero.it>
> 
> It is very annoying that each time I forgot to close Emacs when logout from OS I have to delete that file manually at the next start...
> 
> Please, let me know what to add to the init.el file to avoid that Emacs creates that file...

Why do you need to delete the desktop lock file?  If you are annoyed
by the question Emacs asks when you invoke it the next time, you can
simply customize desktop-load-locked-desktop to the value t, then it
will not ask any questions.

If there's some other problem with that lock file, please describe it,
so we understand what problem you are trying to solve.



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

* Re: How to stop desktop.lock file creation
  2022-03-25  6:34 ` Eli Zaretskii
@ 2022-03-25 22:53   ` Angelo Graziosi
  2022-03-26  5:48     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Angelo Graziosi @ 2022-03-25 22:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

> Il 25/03/2022 07:34 Eli Zaretskii  ha scritto:
> 
>  
> > Date: Thu, 24 Mar 2022 23:33:59 +0100 (CET)
> > From: Angelo Graziosi
> > 
> > It is very annoying that each time I forgot to close Emacs when logout from OS I have to delete that file manually at the next start...
> > 
> > Please, let me know what to add to the init.el file to avoid that Emacs creates that file...
> 
> Why do you need to delete the desktop lock file?  If you are annoyed

The alternative is to accept to load it or not but why should i play this game.. 

> by the question Emacs asks when you invoke it the next time, you can
> simply customize desktop-load-locked-desktop to the value t, then it
> will not ask any questions.

You do not say if Emacs can be configured to avoid its creation, i.e. the creation of the 'desktop.lock' file..

> 
> If there's some other problem with that lock file, please describe it,
> so we understand what problem you are trying to solve.

I don't like it, I don't see its usefulness in my case, I am the only user of this PC and the only user of Emacs and I only start it once. Emacs worked the same before its introduction...



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

* Re: How to stop desktop.lock file creation
  2022-03-25 22:53   ` Angelo Graziosi
@ 2022-03-26  5:48     ` Eli Zaretskii
  2022-03-26 21:30       ` Angelo Graziosi
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-03-26  5:48 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: emacs-devel

> Date: Fri, 25 Mar 2022 23:53:19 +0100 (CET)
> From: Angelo Graziosi <angelo.g0@libero.it>
> Cc: emacs-devel@gnu.org
> 
> > Why do you need to delete the desktop lock file?  If you are annoyed
> 
> The alternative is to accept to load it or not but why should i play this game.. 

You don't need to play this game.  If you set
desktop-load-locked-desktop to t, Emacs will unconditionally load the
desktop even if locked, no questions asked.  Its effect is the same as
not having the lock at all, when the process which locked the desktop
no longer runs.

> > by the question Emacs asks when you invoke it the next time, you can
> > simply customize desktop-load-locked-desktop to the value t, then it
> > will not ask any questions.
> 
> You do not say if Emacs can be configured to avoid its creation, i.e. the creation of the 'desktop.lock' file..

That's because you cannot, not without changing desktop.el.  Maybe you
can do that by customizing desktop-base-lock-name to "NUL", but I
didn't test that and am not sure it will work.  The customization of
desktop-load-locked-desktop I suggested above will have the same
effect, so I see no reason for you to try something that is
unsupported and untested instead.

> > If there's some other problem with that lock file, please describe it,
> > so we understand what problem you are trying to solve.
> 
> I don't like it, I don't see its usefulness in my case, I am the only user of this PC and the only user of Emacs and I only start it once.

Then I think customizing desktop-load-locked-desktop to t is exactly
for your situation.  Does it cause any further problems?  If not, why
not use it?

> Emacs worked the same before its introduction...

The lock was introduced in Emacs 22.2, quite some time ago.  It isn't
a new feature.



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

* Re: How to stop desktop.lock file creation
  2022-03-26  5:48     ` Eli Zaretskii
@ 2022-03-26 21:30       ` Angelo Graziosi
  2022-03-27  5:03         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Angelo Graziosi @ 2022-03-26 21:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel


> Il 26/03/2022 06:48 Eli Zaretskii  ha scritto:
> 
>  
> > Date: Fri, 25 Mar 2022 23:53:19 +0100 (CET)
> > From: Angelo Graziosi 
> > Cc: emacs-devel@gnu.org
> > 
> > > Why do you need to delete the desktop lock file?  If you are annoyed
> > 
> > The alternative is to accept to load it or not but why should i play this game.. 
> 
> You don't need to play this game.  If you set
> desktop-load-locked-desktop to t, Emacs will unconditionally load the
> desktop even if locked, no questions asked.  Its effect is the same as
> not having the lock at all, when the process which locked the desktop
> no longer runs.

When Emacs ask for loading the desktop file it says

"Warning: desktop file appears to be in use by PID xyza.
Using it may cause conflicts.  Use it anyway? (y or n)"

So, _if it says that could be conflicts_, in my opinion, the best way to go is to accept it, close Emacs, restart Emacs, so that it starts in a clean state.

Why I have to to all this? Really I need this? or should I accept with the risk of conflicts (i am sure they do not occur!)?

> 
> > > by the question Emacs asks when you invoke it the next time, you can
> > > simply customize desktop-load-locked-desktop to the value t, then it
> > > will not ask any questions.

Yes, I could do that, but implicitly accepting the risk of conflicts (I am sure they do not occur!)

In all this, It seems I have to do a sterile work.

> 
> > Emacs worked the same before its introduction...
> 
> The lock was introduced in Emacs 22.2, quite some time ago.  It isn't
> a new feature.

I know this and it is what I did mean. 

If users could live without the lock file until version 22 why can't they live without it with the current version?

In short: really we need this lock file? really it is useful in all situations? Why not adding a flag to avoid its creation and that the user sets at its own risk?

Yes, setting desktop-load-locked-desktop to the value t is something similar to what I am asking but not exactly the equivalent.

In any case, thanks for all clarifications.



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

* Re: How to stop desktop.lock file creation
  2022-03-26 21:30       ` Angelo Graziosi
@ 2022-03-27  5:03         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2022-03-27  5:03 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: emacs-devel

> Date: Sat, 26 Mar 2022 22:30:00 +0100 (CET)
> From: Angelo Graziosi <angelo.g0@libero.it>
> Cc: emacs-devel@gnu.org
> 
> > You don't need to play this game.  If you set
> > desktop-load-locked-desktop to t, Emacs will unconditionally load the
> > desktop even if locked, no questions asked.  Its effect is the same as
> > not having the lock at all, when the process which locked the desktop
> > no longer runs.
> 
> When Emacs ask for loading the desktop file it says
> 
> "Warning: desktop file appears to be in use by PID xyza.
> Using it may cause conflicts.  Use it anyway? (y or n)"
> 
> So, _if it says that could be conflicts_, in my opinion, the best way to go is to accept it, close Emacs, restart Emacs, so that it starts in a clean state.

What it wants to say that it doesn't know whether the process that
locked the desktop file is still running.  If it is still running,
then yes, using this file in two Emacs processes could cause
conflicts.  And please note that the process which locked it could run
on another computer.  If that process is not running, there could be
no conflicts, and it is safe to answer "y".

> Why I have to to all this? Really I need this? or should I accept with the risk of conflicts (i am sure they do not occur!)?

You should verify (or in your case know in advance) that the locking
Emacs process no longer runs.

> > > Emacs worked the same before its introduction...
> > 
> > The lock was introduced in Emacs 22.2, quite some time ago.  It isn't
> > a new feature.
> 
> I know this and it is what I did mean. 
> 
> If users could live without the lock file until version 22 why can't they live without it with the current version?

The lock was introduced to handle the cases in which users did
encounter conflicts by using the same desktop file from two or more
Emacs processes.  See

  https://lists.gnu.org/archive/html/emacs-devel/2006-04/msg01253.html

> In short: really we need this lock file?

Yes, IMO.

> really it is useful in all situations?

It is a safety net that is definitely useful in some situations.  As
any safety net, it can sometimes produce false positives, and we are
working on making those more rare.  For example, Emacs 29 will have an
additional value of desktop-load-locked-desktop that will be capable
of taking the lock silently if it was locked by a local process that
is no longer running.

> Why not adding a flag to avoid its creation and that the user sets at its own risk?

Because we think desktop-load-locked-desktop is that flag.



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

end of thread, other threads:[~2022-03-27  5:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 22:33 How to stop desktop.lock file creation Angelo Graziosi
2022-03-25  6:34 ` Eli Zaretskii
2022-03-25 22:53   ` Angelo Graziosi
2022-03-26  5:48     ` Eli Zaretskii
2022-03-26 21:30       ` Angelo Graziosi
2022-03-27  5:03         ` Eli Zaretskii

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