]> code.delx.au - gnu-emacs/blobdiff - lisp/desktop.el
Merge: Minor changes for problems found by GCC 4.5.2's static checks.
[gnu-emacs] / lisp / desktop.el
index 0e6153cfe47a4c68d73554554667bf6ba5ac8372..fd5baaf020f7c2b51391c82adb28168b55e090f5 100644 (file)
@@ -1,8 +1,6 @@
 ;;; desktop.el --- save partial status of Emacs when killed
 
-;; Copyright (C) 1993, 1994, 1995, 1997, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 1997, 2000-2011  Free Software Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
 ;; Keywords: convenience
@@ -226,7 +224,7 @@ the normal hook `desktop-not-loaded-hook' is run."
 The base name of the file is specified in `desktop-base-file-name'."
   :type '(repeat directory)
   :group 'desktop
-  :version "22.1")
+  :version "23.2")                      ; user-emacs-directory added
 
 (defcustom desktop-missing-file-warning nil
   "If non-nil, offer to recreate the buffer of a deleted file.
@@ -303,10 +301,12 @@ to the value obtained by evaluating FORM."
   :version "22.1")
 
 (defcustom desktop-clear-preserve-buffers
-  '("\\*scratch\\*" "\\*Messages\\*" "\\*server\\*" "\\*tramp/.+\\*")
+  '("\\*scratch\\*" "\\*Messages\\*" "\\*server\\*" "\\*tramp/.+\\*"
+    "\\*Warnings\\*")
   "List of buffers that `desktop-clear' should not delete.
 Each element is a regular expression.  Buffers with a name matched by any of
 these won't be deleted."
+  :version "23.3"                       ; added Warnings - bug#6336
   :type '(repeat string)
   :group 'desktop)
 
@@ -611,7 +611,8 @@ Furthermore, it clears the variables listed in `desktop-globals-to-clear'."
   (delete-other-windows))
 
 ;; ----------------------------------------------------------------------------
-(add-hook 'kill-emacs-hook 'desktop-kill)
+(unless noninteractive
+  (add-hook 'kill-emacs-hook 'desktop-kill))
 
 (defun desktop-kill ()
   "If `desktop-save-mode' is non-nil, do what `desktop-save' says to do.
@@ -620,7 +621,10 @@ is nil, ask the user where to save the desktop."
   (when (and desktop-save-mode
              (let ((exists (file-exists-p (desktop-full-file-name))))
                (or (eq desktop-save t)
-                   (and exists (memq desktop-save '(ask-if-new if-exists)))
+                   (and exists (eq desktop-save 'if-exists))
+                  ;; If it exists, but we aren't using it, we are going
+                  ;; to ask for a new directory below.
+                   (and exists desktop-dirname (eq desktop-save 'ask-if-new))
                    (and
                     (or (memq desktop-save '(ask ask-if-new))
                         (and exists (eq desktop-save 'ask-if-exists)))
@@ -1307,5 +1311,4 @@ If there are no buffers left to create, kill the timer."
 
 (provide 'desktop)
 
-;; arch-tag: 221907c3-1771-4fd3-9c2e-c6f700c6ede9
 ;;; desktop.el ends here