summaryrefslogtreecommitdiff
path: root/lisp/desktop.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-12-29 20:58:19 +0000
committerRichard M. Stallman <rms@gnu.org>1997-12-29 20:58:19 +0000
commit5849c3b04bfd4b09a3aadc9910ad37f0425a354d (patch)
treed96c157d165d0df03c1b51c1d32f26450de1c16b /lisp/desktop.el
parentdbeaf8fa22ab171261fc5d3fbbec01c6f91418f5 (diff)
downloademacs-5849c3b04bfd4b09a3aadc9910ad37f0425a354d.tar.gz
(desktop-enable): New variable.
(after-init-hook): Add a hook to test desktop-enable. (desktop-save-hook): Doc fix.
Diffstat (limited to 'lisp/desktop.el')
-rw-r--r--lisp/desktop.el31
1 files changed, 26 insertions, 5 deletions
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 864d9e5bf74..e2a90dd9e40 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1,6 +1,6 @@
;;; desktop.el --- save partial status of Emacs when killed
-;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
;; Author: Morten Welinder <terra@diku.dk>
;; Keywords: customization
@@ -109,9 +109,18 @@
"Save status of Emacs when you exit."
:group 'frames)
-(defconst desktop-basefilename
+(defcustom desktop-enable nil
+ "*Non-nil enable Desktop to save the state of Emacs when you exit."
+ :group 'desktop
+ :type 'boolean
+ :require 'desktop
+ :initialize 'custom-initialize-default)
+
+(defcustom desktop-basefilename
(convert-standard-filename ".emacs.desktop")
- "File for Emacs desktop, not including the directory name.")
+ "File for Emacs desktop, not including the directory name."
+ :type 'file
+ :group 'desktop)
(defcustom desktop-missing-file-warning nil
"*If non-nil then desktop warns when a file no longer exists.
@@ -204,10 +213,11 @@ If the function returns t then the buffer is considered created."
"Opening of form for creation of new buffers.")
(defcustom desktop-save-hook nil
- "Hook run before saving the desktop to allow you to cut history lists and
-the like shorter."
+ "Hook run before desktop saves the state of Emacs.
+This is useful for truncating history lists, for example."
:type 'hook
:group 'desktop)
+
;; ----------------------------------------------------------------------------
(defvar desktop-dirname nil
"The directory in which the current desktop file resides.")
@@ -220,6 +230,7 @@ the like shorter."
(defvar desktop-delay-hook nil
"Hooks run after all buffers are loaded; intended for internal use.")
+
;; ----------------------------------------------------------------------------
(defun desktop-truncate (l n)
"Truncate LIST to at most N elements destructively."
@@ -619,6 +630,16 @@ to provide correct modes for autoloaded files."
(cons 'case-replace cr)
(cons 'overwrite-mode (car mim)))))
;; ----------------------------------------------------------------------------
+
+;; If the user set desktop-enable to t with Custom,
+;; do the rest of what it takes to use desktop,
+;; but do it after finishing loading the init file.
+(add-hook 'after-init-hook
+ '(lambda ()
+ (when desktop-enable
+ (desktop-load-default)
+ (desktop-read))))
+
(provide 'desktop)
;; desktop.el ends here.