[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Eli Zaretskii
Subject: bug#30421: 25.3; desktop.el: Steal lock when no living "emacs" process owns it
Date: Sat, 03 Mar 2018 13:33:14 +0200

> Date: Sat, 24 Feb 2018 22:09:26 +0200
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden, address@hidden
> > I correctly get prompted if I want to load the desktop then.
> OK, thanks for testing.
> So like I said, we need a new hook, which would be called when the
> server creates a frame, but doesn't switch to any new buffers in that
> frame.

Can you see if the patch below gives good results?  It should work
both when you invoke emacsclient with one or more file names, or
without any file names.  In both cases, the new hook
server-after-make-frame-hook should be invoked, with the new frame
being the selected frame.  If you run your code in that new hook, you
should get prompted whether you want to load the desktop, regardless
whether or not you specify files for emacscilent to visit.

diff --git a/lisp/server.el b/lisp/server.el
index a892203..ff03cbe 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -188,6 +188,13 @@ server-switch-hook
   :group 'server
   :type 'hook)
+(defcustom server-after-make-frame-hook nil
+  "Hook run when the Emacs server creates a client frame.
+The created frame is selected when the hook is called."
+  :group 'server
+  :type 'hook
+  :version "27.1")
 (defcustom server-done-hook nil
   "Hook run when done editing a buffer for the Emacs server."
   :group 'server
@@ -1336,9 +1343,11 @@ server-execute
            ((or isearch-mode (minibufferp))
            ((and frame (null buffers))
+            (run-hooks 'server-after-make-frame-hook)
             (message "%s" (substitute-command-keys
                            "When done with this frame, type 
            ((not (null buffers))
+            (run-hooks 'server-after-make-frame-hook)
             (server-switch-buffer (car buffers) nil (cdr (car files)))
             (run-hooks 'server-switch-hook)
             (unless nowait

reply via email to

[Prev in Thread] Current Thread [Next in Thread]