]> code.delx.au - gnu-emacs/blobdiff - lisp/desktop.el
* lisp/textmodes/rst.el (rst-compile-toolsets): Add pdf and s5 to option alist.
[gnu-emacs] / lisp / desktop.el
index 1085356b85f25d105b02ade130eb5a872691293c..b4d3dfd55c87e6e772bef399a1853708dfc5d6b8 100644 (file)
@@ -1,7 +1,8 @@
 ;;; 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 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
 ;; Keywords: convenience
@@ -220,12 +221,12 @@ the normal hook `desktop-not-loaded-hook' is run."
   :group 'desktop
   :version "22.2")
 
-(defcustom desktop-path '("." "~")
+(defcustom desktop-path (list "." user-emacs-directory "~")
   "List of directories to search for the desktop file.
 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.
@@ -302,10 +303,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)
 
@@ -333,19 +336,19 @@ modes are restored automatically; they should not be listed here."
   :type '(repeat symbol)
   :group 'desktop)
 
-;; We skip .log files because they are normally temporary.
-;;         (ftp) files because they require passwords and whatnot.
-(defcustom desktop-buffers-not-to-save
-  "\\(^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\)$"
+(defcustom desktop-buffers-not-to-save nil
   "Regexp identifying buffers that are to be excluded from saving."
-  :type 'regexp
+  :type '(choice (const :tag "None" nil)
+                regexp)
+  :version "23.2"                       ; set to nil
   :group 'desktop)
 
 ;; Skip tramp and ange-ftp files
 (defcustom desktop-files-not-to-save
-  "^/[^/:]*:"
+  "\\(^/[^/:]*:\\|(ftp)$\\)"
   "Regexp identifying files whose buffers are to be excluded from saving."
-  :type 'regexp
+  :type '(choice (const :tag "None" nil)
+                regexp)
   :group 'desktop)
 
 ;; We skip TAGS files to save time (tags-file-name is saved instead).
@@ -619,7 +622,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)))
@@ -811,16 +817,23 @@ which means to truncate VAR's value to at most MAX-SIZE elements
 FILENAME is the visited file name, BUFNAME is the buffer name, and
 MODE is the major mode.
 \n\(fn FILENAME BUFNAME MODE)"
-  (let ((case-fold-search nil))
-    (and (not (string-match desktop-buffers-not-to-save bufname))
+  (let ((case-fold-search nil)
+        dired-skip)
+    (and (not (and (stringp desktop-buffers-not-to-save)
+                  (not filename)
+                  (string-match desktop-buffers-not-to-save bufname)))
          (not (memq mode desktop-modes-not-to-save))
+         ;; FIXME this is broken if desktop-files-not-to-save is nil.
          (or (and filename
+                 (stringp desktop-files-not-to-save)
                   (not (string-match desktop-files-not-to-save filename)))
              (and (eq mode 'dired-mode)
                   (with-current-buffer bufname
-                    (not (string-match desktop-files-not-to-save
-                                       default-directory))))
+                    (not (setq dired-skip
+                               (string-match desktop-files-not-to-save
+                                             default-directory)))))
              (and (null filename)
+                  (null dired-skip)     ; bug#5755
                  (with-current-buffer bufname desktop-save-buffer))))))
 
 ;; ----------------------------------------------------------------------------
@@ -1277,7 +1290,7 @@ If there are no buffers left to create, kill the timer."
     (setq desktop-lazy-timer nil))
   (when desktop-buffer-args-list
     (setq desktop-buffer-args-list nil)
-    (when (interactive-p)
+    (when (called-interactively-p 'interactive)
       (message "Lazy desktop load aborted"))))
 
 ;; ----------------------------------------------------------------------------