Subject: bug#30421: 25.3; desktop.el: Steal lock when no living "emacs" process owns it

From: Pierre Neidhardt <[email-masked]>
Date: Mon, 19 Mar 2018 16:36:49 +0530

What about this?
From a0b72f3c6c38308deba5da1b30e53e9b1923c7e0 Mon Sep 17 00:00:00 2001
From: Pierre Neidhardt <[email-masked]>
Date: Mon, 19 Mar 2018 16:32:55 +0530
Subject: [PATCH] Add example of delayed desktop loading

---
 doc/emacs/misc.texi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 68bd308983..65f6f3d75e 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2531,6 +2531,14 @@ Saving Emacs Sessions
 first client connects, by calling @code{desktop-read} in a hook
 function that you add to @code{server-after-make-frame-hook}
 (@pxref{Creating Frames,,, elisp, The Emacs Lisp Reference Manual}).
+A possible setup when @code{desktop-load-locked-desktop} is @code{nil}:
+@example
+(defun desktop-init (_frame)
+  (desktop-save-mode)
+  (desktop-read)
+  (remove-hook 'server-after-make-frame-hook 'desktop-init))
+(add-hook 'server-after-make-frame-hook 'desktop-init)
+@end example
 
 @node Recursive Edit
 @section Recursive Editing Levels
-- 
2.16.2

-- 
Pierre Neidhardt

Most people want either less corruption or more of a chance to
participate in it.