From 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 Aug 2025 22:58:58 -0500 Subject: removing all downloaded devdocs files --- devdocs/elisp/session-management.html | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 devdocs/elisp/session-management.html (limited to 'devdocs/elisp/session-management.html') diff --git a/devdocs/elisp/session-management.html b/devdocs/elisp/session-management.html deleted file mode 100644 index 401e6430..00000000 --- a/devdocs/elisp/session-management.html +++ /dev/null @@ -1,19 +0,0 @@ -

Session Management

Emacs supports the X Session Management Protocol, which is used to suspend and restart applications. In the X Window System, a program called the session manager is responsible for keeping track of the applications that are running. When the X server shuts down, the session manager asks applications to save their state, and delays the actual shutdown until they respond. An application can also cancel the shutdown.

When the session manager restarts a suspended session, it directs these applications to individually reload their saved state. It does this by specifying a special command-line argument that says what saved session to restore. For Emacs, this argument is ‘--smid session’.

Variable: emacs-save-session-functions -
-

Emacs supports saving state via a hook called emacs-save-session-functions. Emacs runs this hook when the session manager tells it that the window system is shutting down. The functions are called with no arguments, and with the current buffer set to a temporary buffer. Each function can use insert to add Lisp code to this buffer. At the end, Emacs saves the buffer in a file, called the session file.

Subsequently, when the session manager restarts Emacs, it loads the session file automatically (see Loading). This is performed by a function named emacs-session-restore, which is called during startup. See Startup Summary.

If a function in emacs-save-session-functions returns non-nil, Emacs tells the session manager to cancel the shutdown.

-
-

Here is an example that just inserts some text into *scratch* when Emacs is restarted by the session manager.

(add-hook 'emacs-save-session-functions 'save-yourself-test)
-
- -
(defun save-yourself-test ()
-  (insert
-   (format "%S" '(with-current-buffer "*scratch*"
-                   (insert "I am restored"))))
-  nil)
-
-
-

- Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Session-Management.html -

-
-- cgit v1.2.3