unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16157: 24.3.50; desktop-read doesn't claim the unused lock
@ 2013-12-15 21:49 Juri Linkov
  2014-02-04  7:54 ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Juri Linkov @ 2013-12-15 21:49 UTC (permalink / raw)
  To: 16157

When the previous session crashes or freezes, and .emacs.desktop.lock
contains the PID of the previous process, then `desktop-read' asks

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

But answering `y' doesn't claim the ownership of the lock,
desktop-owner is still an old nonexistent process, and thus
auto-saving doesn't save the desktop.

Maybe `desktop-read' should call `desktop-claim-lock' in this case?





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

* bug#16157: 24.3.50; desktop-read doesn't claim the unused lock
  2013-12-15 21:49 bug#16157: 24.3.50; desktop-read doesn't claim the unused lock Juri Linkov
@ 2014-02-04  7:54 ` Juri Linkov
  0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2014-02-04  7:54 UTC (permalink / raw)
  To: 16157

> When the previous session crashes or freezes, and .emacs.desktop.lock
> contains the PID of the previous process, then `desktop-read' asks
>
>   Warning: desktop file appears to be in use by PID...
>   Using it may cause conflicts.  Use it anyway? (y or n)  y
>
> But answering `y' doesn't claim the ownership of the lock,
> desktop-owner is still an old nonexistent process, and thus
> auto-saving doesn't save the desktop.
>
> Maybe `desktop-read' should call `desktop-claim-lock' in this case?

I guess the right thing to do here is what its comment suggests to do:
"mark it as in-use, to bother other desktop instances".  Actually it
shouldn't bother other desktop instances when other instances crashed.

=== modified file 'lisp/desktop.el'
--- lisp/desktop.el	2014-01-01 07:43:34 +0000
+++ lisp/desktop.el	2014-02-04 07:53:37 +0000
@@ -1103,9 +1106,12 @@ (defun desktop-read (&optional dirname)
 	    ;; Evaluate desktop buffer and remember when it was modified.
 	    (load (desktop-full-file-name) t t t)
 	    (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name))))
-	    ;; If it wasn't already, mark it as in-use, to bother other
+	    ;; If it wasn't already owned, mark it as in-use, to bother other
 	    ;; desktop instances.
-	    (unless owner
+	    (unless (eq (emacs-pid) owner)
 	      (condition-case nil
 		  (desktop-claim-lock)
 		(file-error (message "Couldn't record use of desktop file")





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

end of thread, other threads:[~2014-02-04  7:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-15 21:49 bug#16157: 24.3.50; desktop-read doesn't claim the unused lock Juri Linkov
2014-02-04  7:54 ` Juri Linkov

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