]> code.delx.au - gnu-emacs/blobdiff - lisp/desktop.el
Fix spelling errors.
[gnu-emacs] / lisp / desktop.el
index f8be1f0685da61ff0dde626aa760bf050b875908..f56e2204e78b90e88933f2c5da664727b72bd443 100644 (file)
@@ -1,7 +1,7 @@
 ;;; desktop.el --- save partial status of Emacs when killed
 
 ;; Copyright (C) 1993, 1994, 1995, 1997, 2000, 2001, 2002, 2003,
-;;   2004, 2005 Free Software Foundation, Inc.
+;;   2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
 ;; Maintainter: Lars Hansen <larsh@soem.dk>
 ;; are supplied to handle special major and minor modes respectively.
 ;; `desktop-buffer-mode-handlers' is an alist of major mode specific functions
 ;; to restore a desktop buffer. Elements must have the form
-;; 
+;;
 ;;    (MAJOR-MODE . RESTORE-BUFFER-FUNCTION).
-;; 
+;;
 ;; Functions listed are called by `desktop-create-buffer' when `desktop-read'
 ;; evaluates the desktop file. Buffers with a major mode not specified here,
 ;; are restored by the default handler `desktop-restore-file-buffer'.
 ;; `desktop-minor-mode-handlers' is an alist of functions to restore
 ;; non-standard minor modes.  Elements must have the form
-;; 
+;;
 ;;    (MINOR-MODE . RESTORE-FUNCTION).
-;; 
+;;
 ;; Functions are called by `desktop-create-buffer' to restore minor modes.
 ;; Minor modes not specified here, are restored by the standard minor mode
 ;; function.  If you write a module that defines a major or minor mode that
@@ -293,9 +293,8 @@ modes are restored automatically; they should not be listed here."
 
 ;; We skip .log files because they are normally temporary.
 ;;         (ftp) files because they require passwords and whatnot.
-;;         TAGS files to save time (tags-file-name is saved instead).
 (defcustom desktop-buffers-not-to-save
-  "\\(^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS\\)$"
+  "\\(^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\)$"
   "Regexp identifying buffers that are to be excluded from saving."
   :type 'regexp
   :group 'desktop)
@@ -307,7 +306,9 @@ modes are restored automatically; they should not be listed here."
   :type 'regexp
   :group 'desktop)
 
-(defcustom desktop-modes-not-to-save nil
+;; We skip TAGS files to save time (tags-file-name is saved instead).
+(defcustom desktop-modes-not-to-save
+  '(tags-table-mode)
   "List of major modes whose buffers should not be saved."
   :type '(repeat symbol)
   :group 'desktop)
@@ -403,13 +404,15 @@ code like
 
 Furthermore the major mode function must be autoloaded.")
 
+;;;###autoload
 (put 'desktop-buffer-mode-handlers 'risky-local-variable t)
 (make-obsolete-variable 'desktop-buffer-handlers
                         'desktop-buffer-mode-handlers "22.1")
 
 (defcustom desktop-minor-mode-table
   '((auto-fill-function auto-fill-mode)
-    (vc-mode nil))
+    (vc-mode nil)
+    (vc-dired-mode nil))
   "Table mapping minor mode variables to minor mode functions.
 Each entry has the form (NAME RESTORE-FUNCTION).
 NAME is the name of the buffer-local variable indicating that the minor
@@ -465,6 +468,7 @@ Furthermore the minor mode function must be autoloaded.
 
 See also `desktop-minor-mode-table'.")
 
+;;;###autoload
 (put 'desktop-minor-mode-handlers 'risky-local-variable t)
 
 ;; ----------------------------------------------------------------------------
@@ -657,7 +661,7 @@ Not all types of values are supported."
 (defun desktop-outvar (varspec)
   "Output a setq statement for variable VAR to the desktop file.
 The argument VARSPEC may be the variable name VAR (a symbol),
-or a cons cell of the form  (VAR . MAX-SIZE),
+or a cons cell of the form (VAR . MAX-SIZE),
 which means to truncate VAR's value to at most MAX-SIZE elements
 \(if the value is a list) before saving the value."
   (let (var size)
@@ -680,7 +684,8 @@ which means to truncate VAR's value to at most MAX-SIZE elements
 (defun desktop-save-buffer-p (filename bufname mode &rest dummy)
   "Return t if buffer should have its state saved in the desktop file.
 FILENAME is the visited file name, BUFNAME is the buffer name, and
-MODE is the major mode."
+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))
          (not (memq mode desktop-modes-not-to-save))
@@ -942,7 +947,7 @@ directory DIRNAME."
                                  desktop-buffer-file-name)))
                  (if desktop-missing-file-warning
                     (y-or-n-p (concat msg " Re-create? "))
-                   (message msg)
+                   (message "%s" msg)
                    nil)))
          (let* ((auto-insert nil) ; Disable auto insertion
                 (coding-system-for-read
@@ -961,10 +966,11 @@ directory DIRNAME."
 
 (defun desktop-load-file (function)
   "Load the file where auto loaded FUNCTION is defined."
-  (let ((fcell (symbol-function function)))
-    (when (and (listp fcell)
-               (eq 'autoload (car fcell)))
-      (load (cadr fcell)))))
+  (when function
+    (let ((fcell (and (fboundp function) (symbol-function function))))
+      (when (and (listp fcell)
+                 (eq 'autoload (car fcell)))
+        (load (cadr fcell))))))
 
 ;; ----------------------------------------------------------------------------
 ;; Create a buffer, load its file, set its mode, ...;
@@ -1099,7 +1105,7 @@ ARGS must be an argument list for `desktop-create-buffer'."
            (msg (format "Desktop lazily opening %s (%s remaining)..."
                             buffer-name remaining)))
       (when desktop-lazy-verbose
-        (message msg))
+        (message "%s" msg))
       (let ((desktop-first-buffer nil)
             (desktop-buffer-ok-count 0)
             (desktop-buffer-fail-count 0))