aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Hansen2004-05-07 18:02:13 +0000
committerLars Hansen2004-05-07 18:02:13 +0000
commitf730cc626cdfe832a4297146c7f7ef99d287a197 (patch)
treed9ddbe7c304eef0fb352e71a36c53e00c83c55d1
parent5577544820922791c0be22a7928e7a07f9eb885e (diff)
downloademacs-f730cc626cdfe832a4297146c7f7ef99d287a197.tar.gz
emacs-f730cc626cdfe832a4297146c7f7ef99d287a197.zip
(Desktop Save Mode): Add.
(Modes): Add menu entry Desktop Save Mode.
-rw-r--r--lispref/modes.texi55
1 files changed, 55 insertions, 0 deletions
diff --git a/lispref/modes.texi b/lispref/modes.texi
index 4b879cf476a..12a597484df 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -26,6 +26,8 @@ user. For related topics such as keymaps and syntax tables, see
26* Imenu:: How a mode can provide a menu 26* Imenu:: How a mode can provide a menu
27 of definitions in the buffer. 27 of definitions in the buffer.
28* Font Lock Mode:: How modes can highlight text according to syntax. 28* Font Lock Mode:: How modes can highlight text according to syntax.
29* Desktop Save Mode:: How modes can have buffer state saved between
30 Emacs sessions.
29* Hooks:: How to use hooks; how to write code that provides hooks. 31* Hooks:: How to use hooks; how to write code that provides hooks.
30@end menu 32@end menu
31 33
@@ -2426,6 +2428,59 @@ strings.
2426 2428
2427@end defvar 2429@end defvar
2428 2430
2431@node Desktop Save Mode
2432@section Desktop Save Mode
2433@cindex desktop save mode
2434
2435@dfn{Desktop Save Mode} is a feature to save the state of Emacs from
2436one session to another. The user-level commands for using Desktop
2437Save Mode are described in the GNU Emacs Manual (@pxref{Saving Emacs
2438Sessions,,, emacs, the GNU Emacs Manual}). Modes whose buffers visit
2439a file, don't have to do anything to use this feature.
2440
2441For buffers not visiting a file to have their state saved, the major
2442mode must bind the buffer local variable @code{desktop-save-buffer} to
2443a non-nil value.
2444
2445@defvar desktop-save-buffer
2446If this buffer-local variable is non-@code{nil}, the buffer will have
2447its state saved in the desktop file at desktop save. If the value is
2448a function, it is called at desktop save with argument
2449@var{desktop-dirname}, and its value is saved in the desktop file along
2450with the state of the buffer for which it was called. When file names
2451are returned as part of the auxiliary information, they should be
2452formatted using the call
2453
2454@example
2455(desktop-file-name @var{file-name} @var{desktop-dirname})
2456@end example
2457
2458@end defvar
2459
2460For buffers not visiting a file to be restored, the major mode must
2461define a function to do the job, and that function must be listed in
2462the alist @code{desktop-buffer-mode-handlers}.
2463
2464@defvar desktop-buffer-mode-handlers
2465Alist with elements
2466
2467@example
2468(@var{major-mode} . @var{restore-buffer-function})
2469@end example
2470
2471The function @var{restore-buffer-function} will be called with
2472argument list
2473
2474@example
2475(@var{buffer-file-name} @var{buffer-name} @var{desktop-buffer-misc})
2476@end example
2477
2478and it should return the restored buffer.
2479Here @var{desktop-buffer-misc} is the value returned by the function
2480optionally bound to @code{desktop-save-buffer}.
2481
2482@end defvar
2483
2429@node Hooks 2484@node Hooks
2430@section Hooks 2485@section Hooks
2431@cindex hooks 2486@cindex hooks