emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master a8be860: Improve support for desktop restoration in


From: Eli Zaretskii
Subject: [Emacs-diffs] master a8be860: Improve support for desktop restoration in daemon mode
Date: Sat, 10 Mar 2018 06:49:57 -0500 (EST)

branch: master
commit a8be860e17e2a737bda7a4c5075b71f0fb627a92
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Improve support for desktop restoration in daemon mode
    
    * lisp/server.el (server-after-make-frame-hook): New hook.
    (server-execute): Call it after creating a new frame or before
    switching to a buffer shown in a client frame.  (Bug#30421)
    
    * doc/emacs/misc.texi (Saving Emacs Sessions): Adjust advice for
    restoring desktop in daemon mode to the new hook.
    * doc/lispref/frames.texi (Creating Frames, Standard Hooks):
    Document server-after-make-frame-hook.
    
    * etc/NEWS: Mention server-after-make-frame-hook.
---
 doc/emacs/misc.texi     | 2 +-
 doc/lispref/frames.texi | 6 ++++++
 doc/lispref/hooks.texi  | 1 +
 etc/NEWS                | 9 +++++++++
 lisp/server.el          | 9 +++++++++
 5 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 6098634..68bd308 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2529,7 +2529,7 @@ e.g., the daemon cannot use GUI features, so parameters 
such as frame
 position, size, and decorations cannot be restored.  For that reason,
 you may wish to delay restoring the desktop in daemon mode until the
 first client connects, by calling @code{desktop-read} in a hook
-function that you add to @code{after-make-frame-functions}
+function that you add to @code{server-after-make-frame-hook}
 (@pxref{Creating Frames,,, elisp, The Emacs Lisp Reference Manual}).
 
 @node Recursive Edit
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 2f9bb39..459f05c 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -181,6 +181,12 @@ the value of that parameter in the created frame to its 
value in the
 selected frame.
 @end defvar
 
address@hidden server-after-make-frame-hook
+A normal hook run when the Emacs server creates a client frame.  When
+this hook is called, the created frame is the selected one.
address@hidden Server,,, emacs, The GNU Emacs Manual}.
address@hidden defopt
+
 
 @node Multiple Terminals
 @section Multiple Terminals
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi
index db4e413..e374d02 100644
--- a/doc/lispref/hooks.texi
+++ b/doc/lispref/hooks.texi
@@ -66,6 +66,7 @@ not exactly a hook, but does a similar job.
 
 @item after-make-frame-functions
 @itemx before-make-frame-hook
address@hidden server-after-make-frame-hook
 @xref{Creating Frames}.
 
 @c Not general enough?
diff --git a/etc/NEWS b/etc/NEWS
index 14926ba..8d69dc6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -84,6 +84,15 @@ behavior where the tooltip text is also shown when the 
corresponding
 action does not apply.
 
 +++
+** New hook 'server-after-make-frame-hook'.
+This hook is a convenient place to perform initializations in daemon
+mode which require GUI features to be available.  One example is
+restoration of the previous session using the desktop.el package: put
+the call to 'desktop-read' in this hook, if you want the GUI settings
+to be restored, or if desktop.el needs to interact with you during
+restoration of the session.
+
++++
 ** New function 'logcount' calculates an integer's Hamming weight.
 
 +++
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 @@ space (this means characters from ! to ~; or from code 33 
to
   :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 @@ The following commands are accepted by the client:
            ((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 via email to

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