+2004-04-26 Lars Hansen <larsh@math.ku.dk>
+ * desktop.el (desktop-buffer-misc-data-function): Rename to
+ desktop-save-buffer and change docstring.
+ (desktop-buffer-modes-to-save): Delete.
+ (desktop-save-buffer-p): Use desktop-save-buffer instead of
+ desktop-buffer-modes-to-save.
+ (desktop-save): Rename desktop-buffer-misc-data-function to
+ desktop-save-buffer and allow non-function value.
+ (desktop-missing-file-warning): Correct docstring.
+ * dired.el (dired-mode): Rename desktop-buffer-misc-data-function
+ to desktop-save-buffer.
+ * info.el (Info-mode): Rename desktop-buffer-misc-data-function to
+ desktop-save-buffer.
+ * mail/rmail.el (rmail-variables): Bind desktop-save-buffer to t.
+ * mh-e/mh-e.el (mh-folder-mode): Bind desktop-save-buffer to t.
+
2004-04-25 Luc Teirlinck <teirllm@auburn.edu>
* ielm.el (ielm-prompt-read-only, ielm-prompt): Expand docstring.
:group 'desktop)
(defcustom desktop-missing-file-warning nil
- "*If non-nil then `desktop-read' warns when a file no longer exists.
-Otherwise it simply ignores that file."
+ "*If non-nil then `desktop-read' asks if a non-existent file should be recreated.
+Also pause for a moment to display message about errors signaled in
+`desktop-buffer-mode-handlers'.
+
+If nil, just print error messages in the message buffer."
:type 'boolean
:group 'desktop)
:type 'regexp
:group 'desktop)
-(defcustom desktop-buffer-modes-to-save
- '(Info-mode rmail-mode)
- "If a buffer is of one of these major modes, save the buffer state.
-This applies to buffers not visiting a file and not beeing a dired buffer.
-Modes specified here must have a handler in `desktop-buffer-mode-handlers'
-to be restored."
- :type '(repeat symbol)
- :group 'desktop)
-
(defcustom desktop-modes-not-to-save nil
"List of major modes whose buffers should not be saved."
:type '(repeat symbol)
:group 'desktop)
;;;###autoload
-(defvar desktop-buffer-misc-data-function nil
- "Function returning major mode specific data for desktop file.
+(defvar desktop-save-buffer nil
+ "When non-nil, save buffer status in desktop file.
This variable becomes buffer local when set.
-The function specified is called by `desktop-save', with argument
-DESKTOP-DIRNAME. If it returns non-nil, its value is saved along
-with the state of the buffer for which it was called.
+
+If the value is a function, it called by `desktop-save' with argument
+DESKTOP-DIRNAME to obtain auxiliary information to saved in the desktop
+file along with the state of the buffer for which it was called.
When file names are returned, they should be formatted using the call
\"(desktop-file-name FILE-NAME DESKTOP-DIRNAME)\".
Later, when `desktop-read' calls a function in `desktop-buffer-mode-handlers'
-to restore the buffer, the auxiliary information is passed as argument.")
-(make-variable-buffer-local 'desktop-buffer-misc-data-function)
+to restore the buffer, the auxiliary information is passed as the argument
+DESKTOP-BUFFER-MISC.")
+(make-variable-buffer-local 'desktop-save-buffer)
+(make-obsolete-variable 'desktop-buffer-modes-to-save
+ 'desktop-save-buffer)
(make-obsolete-variable 'desktop-buffer-misc-functions
- 'desktop-buffer-misc-data-function)
+ 'desktop-save-buffer)
(defcustom desktop-buffer-mode-handlers '(
(dired-mode . dired-restore-desktop-buffer)
;; ----------------------------------------------------------------------------
(defun desktop-save-buffer-p (filename bufname mode &rest dummy)
- "Return t if the desktop should record a particular buffer for next startup.
+ "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."
(let ((case-fold-search nil))
(and (not (string-match desktop-buffers-not-to-save bufname))
- (not (memq mode desktop-modes-not-to-save))
- (or (and filename
- (not (string-match desktop-files-not-to-save filename)))
- (and (eq mode 'dired-mode)
- (save-excursion
- (set-buffer (get-buffer bufname))
- (not (string-match desktop-files-not-to-save
- default-directory))))
- (and (null filename)
- (memq mode desktop-buffer-modes-to-save))))))
+ (not (memq mode desktop-modes-not-to-save))
+ (or (and filename
+ (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))))
+ (and (null filename)
+ (with-current-buffer bufname desktop-save-buffer))))))
;; ----------------------------------------------------------------------------
(defun desktop-file-name (filename dirname)
(list (mark t) mark-active)
buffer-read-only
;; Auxiliary information
- (when desktop-buffer-misc-data-function
- (funcall desktop-buffer-misc-data-function dirname))
+ (when (functionp desktop-save-buffer)
+ (funcall desktop-save-buffer dirname))
(let ((locals desktop-locals-to-save)
(loclist (buffer-local-variables))
(ll))