;;; desktop.el --- save partial status of Emacs when killed
;; Copyright (C) 1993, 1994, 1995, 1997, 2000, 2001, 2002, 2003,
-;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Author: Morten Welinder <terra@diku.dk>
;; Keywords: convenience
;; (desktop-save-mode 1)
;;
;; For further usage information, look at the section
-;; "Saving Emacs Sessions" in the GNU Emacs Manual.
+;; (info "(emacs)Saving Emacs Sessions") in the GNU Emacs Manual.
;; When the desktop module is loaded, the function `desktop-kill' is
;; added to the `kill-emacs-hook'. This function is responsible for
: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)
tags-table-list
search-ring
regexp-search-ring
- register-alist)
+ register-alist
+ file-name-history)
"List of global variables saved by `desktop-save'.
An element may be variable name (a symbol) or a cons cell of the form
\(VAR . MAX-SIZE), which means to truncate VAR's value to at most
: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).
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))
+ (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))
(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
(if desktop-dirname
(desktop-save desktop-dirname)
(call-interactively 'desktop-save))
- (message "Desktop saved in %s" desktop-dirname))
+ (message "Desktop saved in %s" (abbreviate-file-name desktop-dirname)))
;; ----------------------------------------------------------------------------
;;;###autoload
(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"))))
;; ----------------------------------------------------------------------------