diff options
| author | Richard M. Stallman | 2002-03-11 09:10:19 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-03-11 09:10:19 +0000 |
| commit | f8e7eebe8330226ab20d42b2337ee79b6b7273ea (patch) | |
| tree | bab46c3349b2909263e30cb6fa2da4a1e91817f5 | |
| parent | 8a5782b5da0b1305734714b37ed8d6e4c6ac41f0 (diff) | |
| download | emacs-f8e7eebe8330226ab20d42b2337ee79b6b7273ea.tar.gz emacs-f8e7eebe8330226ab20d42b2337ee79b6b7273ea.zip | |
Clean up session manager node.
| -rw-r--r-- | lispref/os.texi | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lispref/os.texi b/lispref/os.texi index 476511a41b6..2e3bae972c3 100644 --- a/lispref/os.texi +++ b/lispref/os.texi | |||
| @@ -2000,36 +2000,38 @@ This variable is non-@code{nil} when Emacs is running in batch mode. | |||
| 2000 | 2000 | ||
| 2001 | @node Session Management | 2001 | @node Session Management |
| 2002 | @section Session Management | 2002 | @section Session Management |
| 2003 | @cindex session management | 2003 | @cindex session manager |
| 2004 | @cindex X session management protocol | ||
| 2005 | 2004 | ||
| 2006 | X has defined the X Session Management Protocol to handle start and | 2005 | Emacs supports the X Session Management Protocol for suspension and |
| 2007 | restart of applications. There is one session manager who has the | 2006 | restart of applications. In the X Window System, a program called the |
| 2008 | responsibility to keep track of the applications that are running | 2007 | @dfn{session manager} has the responsibility to keep track of the |
| 2009 | when the window system shuts down, so the session manager later can | 2008 | applications that are running. During shutdown, the session manager |
| 2010 | restart them. | 2009 | asks applications to save their state, and delays the actual shutdown |
| 2010 | until they respond. An application can also cancel the shutdown. | ||
| 2011 | 2011 | ||
| 2012 | Before the session manager shuts down the window system it informs | 2012 | When the session manager restarts a suspended session, it directs |
| 2013 | applications that they should save their state. When the applications | 2013 | these applications to individually reload their saved state. It does |
| 2014 | are restarted, the applications will restore their state. | 2014 | this by specifying a special command-line argument that says what |
| 2015 | saved session to restore. For Emacs, this argument is @samp{--smid | ||
| 2016 | @var{session}}. | ||
| 2015 | 2017 | ||
| 2016 | @defvar emacs-save-session-functions | 2018 | @defvar emacs-save-session-functions |
| 2017 | @tindex emacs-save-session-functions | 2019 | @tindex emacs-save-session-functions |
| 2018 | Emacs supports saving state by using a hook called | 2020 | Emacs supports saving state by using a hook called |
| 2019 | @code{emacs-save-session-functions}. Each function in this hook is | 2021 | @code{emacs-save-session-functions}. Each function in this hook is |
| 2020 | called when the session manager tells Emacs that the window system is | 2022 | called when the session manager tells Emacs that the window system is |
| 2021 | shutting down. The functions are called with the current buffer set to | 2023 | shutting down. The functions are called with the current buffer set |
| 2022 | a temporary buffer. Functions can use @code{insert} to add lisp code | 2024 | to a temporary buffer. Each functions can use @code{insert} to add |
| 2023 | to this buffer. The buffer will then be saved in a lisp file that is | 2025 | Lisp code to this buffer. At the end, Emacs saves the buffer in a |
| 2024 | loaded when Emacs is restarted. | 2026 | file that Emacs will load in order to restart the saved session. |
| 2025 | 2027 | ||
| 2026 | If a function in @code{emacs-save-session-functions} returns non-nil | 2028 | If a function in @code{emacs-save-session-functions} returns |
| 2027 | Emacs will inform the session manager that the window system shutdown | 2029 | non-@code{nil}, Emacs tells the session manager to cancel the |
| 2028 | shall be cancelled. | 2030 | shutdown. |
| 2029 | @end defvar | 2031 | @end defvar |
| 2030 | 2032 | ||
| 2031 | Here is an example that just inserts some text into *scratch* when Emacs | 2033 | Here is an example that just inserts some text into *scratch* when |
| 2032 | is restarted by the session manager. | 2034 | Emacs is restarted by the session manager. |
| 2033 | 2035 | ||
| 2034 | @example | 2036 | @example |
| 2035 | @group | 2037 | @group |
| @@ -2038,11 +2040,9 @@ is restarted by the session manager. | |||
| 2038 | 2040 | ||
| 2039 | @group | 2041 | @group |
| 2040 | (defun save-yourself-test () | 2042 | (defun save-yourself-test () |
| 2041 | (progn | 2043 | (insert "(save-excursion |
| 2042 | (insert | 2044 | (switch-to-buffer \"*scratch*\") |
| 2043 | "(save-excursion | 2045 | (insert \"I am restored\"))") |
| 2044 | (switch-to-buffer \"*scratch*\") | 2046 | nil) |
| 2045 | (insert \"I am restored\"))") | ||
| 2046 | @result{} nil)) | ||
| 2047 | @end group | 2047 | @end group |
| 2048 | @end example | 2048 | @end example |