summaryrefslogtreecommitdiff
path: root/lispref
diff options
context:
space:
mode:
authorLars Hansen <larsh@soem.dk>2004-05-07 18:02:13 +0000
committerLars Hansen <larsh@soem.dk>2004-05-07 18:02:13 +0000
commitab0709666cdd6e3f77a841551a1482813b3fbc81 (patch)
treee87deb8184fa9505751ed0a1f1a8f3e54855b0d9 /lispref
parentffa864257589f04fd2dfa947619a9fd330aeff1c (diff)
downloademacs-ab0709666cdd6e3f77a841551a1482813b3fbc81.tar.gz
(Desktop Save Mode): Add.
(Modes): Add menu entry Desktop Save Mode.
Diffstat (limited to 'lispref')
-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
* Imenu:: How a mode can provide a menu
of definitions in the buffer.
* Font Lock Mode:: How modes can highlight text according to syntax.
+* Desktop Save Mode:: How modes can have buffer state saved between
+ Emacs sessions.
* Hooks:: How to use hooks; how to write code that provides hooks.
@end menu
@@ -2426,6 +2428,59 @@ strings.
@end defvar
+@node Desktop Save Mode
+@section Desktop Save Mode
+@cindex desktop save mode
+
+@dfn{Desktop Save Mode} is a feature to save the state of Emacs from
+one session to another. The user-level commands for using Desktop
+Save Mode are described in the GNU Emacs Manual (@pxref{Saving Emacs
+Sessions,,, emacs, the GNU Emacs Manual}). Modes whose buffers visit
+a file, don't have to do anything to use this feature.
+
+For buffers not visiting a file to have their state saved, the major
+mode must bind the buffer local variable @code{desktop-save-buffer} to
+a non-nil value.
+
+@defvar desktop-save-buffer
+If this buffer-local variable is non-@code{nil}, the buffer will have
+its state saved in the desktop file at desktop save. If the value is
+a function, it is called at desktop save with argument
+@var{desktop-dirname}, and its value is saved in the desktop file along
+with the state of the buffer for which it was called. When file names
+are returned as part of the auxiliary information, they should be
+formatted using the call
+
+@example
+(desktop-file-name @var{file-name} @var{desktop-dirname})
+@end example
+
+@end defvar
+
+For buffers not visiting a file to be restored, the major mode must
+define a function to do the job, and that function must be listed in
+the alist @code{desktop-buffer-mode-handlers}.
+
+@defvar desktop-buffer-mode-handlers
+Alist with elements
+
+@example
+(@var{major-mode} . @var{restore-buffer-function})
+@end example
+
+The function @var{restore-buffer-function} will be called with
+argument list
+
+@example
+(@var{buffer-file-name} @var{buffer-name} @var{desktop-buffer-misc})
+@end example
+
+and it should return the restored buffer.
+Here @var{desktop-buffer-misc} is the value returned by the function
+optionally bound to @code{desktop-save-buffer}.
+
+@end defvar
+
@node Hooks
@section Hooks
@cindex hooks