all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Pierre Neidhardt <ambrevar@gmail.com>
Cc: 30421@debbugs.gnu.org, npostavs@users.sourceforge.net
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	[thread overview]
Message-ID: <834llxv1fp.fsf@gnu.org> (raw)
In-Reply-To: <83fu5q2lqh.fsf@gnu.org> (message from Eli Zaretskii on Sat, 24 Feb 2018 22:09:26 +0200)

> Date: Sat, 24 Feb 2018 22:09:26 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 30421@debbugs.gnu.org, npostavs@users.sourceforge.net
> 
> > 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))
             nil)
            ((and frame (null buffers))
+            (run-hooks 'server-after-make-frame-hook)
             (message "%s" (substitute-command-keys
                            "When done with this frame, type \\[delete-frame]")))
            ((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	other threads:[~2018-03-03 11:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-11  9:54 bug#30421: 25.3; desktop.el: Steal lock when no living "emacs" process owns it Pierre Neidhardt
2018-02-11 15:50 ` Eli Zaretskii
2018-02-11 16:08   ` Pierre Neidhardt
2018-02-11 16:15     ` Noam Postavsky
2018-02-11 16:32       ` Eli Zaretskii
2018-02-11 16:57         ` Pierre Neidhardt
2018-02-11 17:18           ` Eli Zaretskii
2018-02-11 17:23             ` Pierre Neidhardt
2018-02-11 18:00               ` Eli Zaretskii
2018-02-11 18:41                 ` Pierre Neidhardt
2018-02-11 18:54                   ` Eli Zaretskii
2018-02-11 19:01                     ` Pierre Neidhardt
2018-02-15 22:56                       ` Pierre Neidhardt
2018-02-16  8:11                         ` Eli Zaretskii
2018-02-16 22:58                           ` Pierre Neidhardt
2018-02-17  7:43                             ` Eli Zaretskii
2018-02-18 11:26                               ` Pierre Neidhardt
2018-02-18 16:37                                 ` Eli Zaretskii
2018-02-24 10:39                                   ` Eli Zaretskii
2018-02-24 19:44                                     ` Pierre Neidhardt
2018-02-24 20:09                                       ` Eli Zaretskii
2018-03-03 11:33                                         ` Eli Zaretskii [this message]
2018-03-03 18:05                                           ` Pierre Neidhardt
2018-03-10 11:52                                             ` Eli Zaretskii
2018-03-19 11:06                                               ` Pierre Neidhardt
2018-03-19 12:47                                                 ` Eli Zaretskii
2018-03-19 13:09                                                   ` Pierre Neidhardt
2018-02-11 20:40 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834llxv1fp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=30421@debbugs.gnu.org \
    --cc=ambrevar@gmail.com \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.