diff options
| author | Lars Hansen | 2004-04-26 18:58:19 +0000 |
|---|---|---|
| committer | Lars Hansen | 2004-04-26 18:58:19 +0000 |
| commit | ebb395551edd4bb9406f9219cdea943c35872f5d (patch) | |
| tree | 38fc858c6029f15bf02667d10177c1cbfc2420b6 | |
| parent | cb5f1f67384bda216e2cbd3716f13d19566ee5dd (diff) | |
| download | emacs-ebb395551edd4bb9406f9219cdea943c35872f5d.tar.gz emacs-ebb395551edd4bb9406f9219cdea943c35872f5d.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/desktop.el | 61 |
2 files changed, 45 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cf2c0aad49f..5390465e7e1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2004-04-26 Lars Hansen <larsh@math.ku.dk> | ||
| 2 | * desktop.el (desktop-buffer-misc-data-function): Rename to | ||
| 3 | desktop-save-buffer and change docstring. | ||
| 4 | (desktop-buffer-modes-to-save): Delete. | ||
| 5 | (desktop-save-buffer-p): Use desktop-save-buffer instead of | ||
| 6 | desktop-buffer-modes-to-save. | ||
| 7 | (desktop-save): Rename desktop-buffer-misc-data-function to | ||
| 8 | desktop-save-buffer and allow non-function value. | ||
| 9 | (desktop-missing-file-warning): Correct docstring. | ||
| 10 | * dired.el (dired-mode): Rename desktop-buffer-misc-data-function | ||
| 11 | to desktop-save-buffer. | ||
| 12 | * info.el (Info-mode): Rename desktop-buffer-misc-data-function to | ||
| 13 | desktop-save-buffer. | ||
| 14 | * mail/rmail.el (rmail-variables): Bind desktop-save-buffer to t. | ||
| 15 | * mh-e/mh-e.el (mh-folder-mode): Bind desktop-save-buffer to t. | ||
| 16 | |||
| 1 | 2004-04-25 Luc Teirlinck <teirllm@auburn.edu> | 17 | 2004-04-25 Luc Teirlinck <teirllm@auburn.edu> |
| 2 | 18 | ||
| 3 | * ielm.el (ielm-prompt-read-only, ielm-prompt): Expand docstring. | 19 | * ielm.el (ielm-prompt-read-only, ielm-prompt): Expand docstring. |
diff --git a/lisp/desktop.el b/lisp/desktop.el index 5589097dfde..e9b130388a2 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el | |||
| @@ -145,8 +145,11 @@ The base name of the file is specified in `desktop-base-file-name'." | |||
| 145 | :group 'desktop) | 145 | :group 'desktop) |
| 146 | 146 | ||
| 147 | (defcustom desktop-missing-file-warning nil | 147 | (defcustom desktop-missing-file-warning nil |
| 148 | "*If non-nil then `desktop-read' warns when a file no longer exists. | 148 | "*If non-nil then `desktop-read' asks if a non-existent file should be recreated. |
| 149 | Otherwise it simply ignores that file." | 149 | Also pause for a moment to display message about errors signaled in |
| 150 | `desktop-buffer-mode-handlers'. | ||
| 151 | |||
| 152 | If nil, just print error messages in the message buffer." | ||
| 150 | :type 'boolean | 153 | :type 'boolean |
| 151 | :group 'desktop) | 154 | :group 'desktop) |
| 152 | 155 | ||
| @@ -244,15 +247,6 @@ The variables are saved only when they really are local." | |||
| 244 | :type 'regexp | 247 | :type 'regexp |
| 245 | :group 'desktop) | 248 | :group 'desktop) |
| 246 | 249 | ||
| 247 | (defcustom desktop-buffer-modes-to-save | ||
| 248 | '(Info-mode rmail-mode) | ||
| 249 | "If a buffer is of one of these major modes, save the buffer state. | ||
| 250 | This applies to buffers not visiting a file and not beeing a dired buffer. | ||
| 251 | Modes specified here must have a handler in `desktop-buffer-mode-handlers' | ||
| 252 | to be restored." | ||
| 253 | :type '(repeat symbol) | ||
| 254 | :group 'desktop) | ||
| 255 | |||
| 256 | (defcustom desktop-modes-not-to-save nil | 250 | (defcustom desktop-modes-not-to-save nil |
| 257 | "List of major modes whose buffers should not be saved." | 251 | "List of major modes whose buffers should not be saved." |
| 258 | :type '(repeat symbol) | 252 | :type '(repeat symbol) |
| @@ -268,21 +262,25 @@ Possible values are: | |||
| 268 | :group 'desktop) | 262 | :group 'desktop) |
| 269 | 263 | ||
| 270 | ;;;###autoload | 264 | ;;;###autoload |
| 271 | (defvar desktop-buffer-misc-data-function nil | 265 | (defvar desktop-save-buffer nil |
| 272 | "Function returning major mode specific data for desktop file. | 266 | "When non-nil, save buffer status in desktop file. |
| 273 | This variable becomes buffer local when set. | 267 | This variable becomes buffer local when set. |
| 274 | The function specified is called by `desktop-save', with argument | 268 | |
| 275 | DESKTOP-DIRNAME. If it returns non-nil, its value is saved along | 269 | If the value is a function, it called by `desktop-save' with argument |
| 276 | with the state of the buffer for which it was called. | 270 | DESKTOP-DIRNAME to obtain auxiliary information to saved in the desktop |
| 271 | file along with the state of the buffer for which it was called. | ||
| 277 | 272 | ||
| 278 | When file names are returned, they should be formatted using the call | 273 | When file names are returned, they should be formatted using the call |
| 279 | \"(desktop-file-name FILE-NAME DESKTOP-DIRNAME)\". | 274 | \"(desktop-file-name FILE-NAME DESKTOP-DIRNAME)\". |
| 280 | 275 | ||
| 281 | Later, when `desktop-read' calls a function in `desktop-buffer-mode-handlers' | 276 | Later, when `desktop-read' calls a function in `desktop-buffer-mode-handlers' |
| 282 | to restore the buffer, the auxiliary information is passed as argument.") | 277 | to restore the buffer, the auxiliary information is passed as the argument |
| 283 | (make-variable-buffer-local 'desktop-buffer-misc-data-function) | 278 | DESKTOP-BUFFER-MISC.") |
| 279 | (make-variable-buffer-local 'desktop-save-buffer) | ||
| 280 | (make-obsolete-variable 'desktop-buffer-modes-to-save | ||
| 281 | 'desktop-save-buffer) | ||
| 284 | (make-obsolete-variable 'desktop-buffer-misc-functions | 282 | (make-obsolete-variable 'desktop-buffer-misc-functions |
| 285 | 'desktop-buffer-misc-data-function) | 283 | 'desktop-save-buffer) |
| 286 | 284 | ||
| 287 | (defcustom desktop-buffer-mode-handlers '( | 285 | (defcustom desktop-buffer-mode-handlers '( |
| 288 | (dired-mode . dired-restore-desktop-buffer) | 286 | (dired-mode . dired-restore-desktop-buffer) |
| @@ -541,21 +539,20 @@ which means to truncate VAR's value to at most MAX-SIZE elements | |||
| 541 | 539 | ||
| 542 | ;; ---------------------------------------------------------------------------- | 540 | ;; ---------------------------------------------------------------------------- |
| 543 | (defun desktop-save-buffer-p (filename bufname mode &rest dummy) | 541 | (defun desktop-save-buffer-p (filename bufname mode &rest dummy) |
| 544 | "Return t if the desktop should record a particular buffer for next startup. | 542 | "Return t if buffer should have its state saved in the desktop file. |
| 545 | FILENAME is the visited file name, BUFNAME is the buffer name, and | 543 | FILENAME is the visited file name, BUFNAME is the buffer name, and |
| 546 | MODE is the major mode." | 544 | MODE is the major mode." |
| 547 | (let ((case-fold-search nil)) | 545 | (let ((case-fold-search nil)) |
| 548 | (and (not (string-match desktop-buffers-not-to-save bufname)) | 546 | (and (not (string-match desktop-buffers-not-to-save bufname)) |
| 549 | (not (memq mode desktop-modes-not-to-save)) | 547 | (not (memq mode desktop-modes-not-to-save)) |
| 550 | (or (and filename | 548 | (or (and filename |
| 551 | (not (string-match desktop-files-not-to-save filename))) | 549 | (not (string-match desktop-files-not-to-save filename))) |
| 552 | (and (eq mode 'dired-mode) | 550 | (and (eq mode 'dired-mode) |
| 553 | (save-excursion | 551 | (with-current-buffer bufname |
| 554 | (set-buffer (get-buffer bufname)) | 552 | (not (string-match desktop-files-not-to-save |
| 555 | (not (string-match desktop-files-not-to-save | 553 | default-directory)))) |
| 556 | default-directory)))) | 554 | (and (null filename) |
| 557 | (and (null filename) | 555 | (with-current-buffer bufname desktop-save-buffer)))))) |
| 558 | (memq mode desktop-buffer-modes-to-save)))))) | ||
| 559 | 556 | ||
| 560 | ;; ---------------------------------------------------------------------------- | 557 | ;; ---------------------------------------------------------------------------- |
| 561 | (defun desktop-file-name (filename dirname) | 558 | (defun desktop-file-name (filename dirname) |
| @@ -610,8 +607,8 @@ See also `desktop-base-file-name'." | |||
| 610 | (list (mark t) mark-active) | 607 | (list (mark t) mark-active) |
| 611 | buffer-read-only | 608 | buffer-read-only |
| 612 | ;; Auxiliary information | 609 | ;; Auxiliary information |
| 613 | (when desktop-buffer-misc-data-function | 610 | (when (functionp desktop-save-buffer) |
| 614 | (funcall desktop-buffer-misc-data-function dirname)) | 611 | (funcall desktop-save-buffer dirname)) |
| 615 | (let ((locals desktop-locals-to-save) | 612 | (let ((locals desktop-locals-to-save) |
| 616 | (loclist (buffer-local-variables)) | 613 | (loclist (buffer-local-variables)) |
| 617 | (ll)) | 614 | (ll)) |