diff options
| author | Chong Yidong | 2008-12-31 02:44:00 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-12-31 02:44:00 +0000 |
| commit | aae1ecbbc8f532609e8cd334b234bc81dba5e6d8 (patch) | |
| tree | edfc0bd042138ca26d69ae165385d8fdef3a6fd7 | |
| parent | 9b854b5c5ee247a4d37d4aa544310de0388785b5 (diff) | |
| download | emacs-aae1ecbbc8f532609e8cd334b234bc81dba5e6d8.tar.gz emacs-aae1ecbbc8f532609e8cd334b234bc81dba5e6d8.zip | |
(buffer-swapped-with): New var, moved from files.el. Add advice to
basic-save-buffer to use it.
| -rw-r--r-- | lisp/mail/pmail.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lisp/mail/pmail.el b/lisp/mail/pmail.el index 3a43cc0ce90..428102bdfc3 100644 --- a/lisp/mail/pmail.el +++ b/lisp/mail/pmail.el | |||
| @@ -41,6 +41,34 @@ | |||
| 41 | (require 'mail-utils) | 41 | (require 'mail-utils) |
| 42 | (eval-when-compile (require 'mule-util)) ; for detect-coding-with-priority | 42 | (eval-when-compile (require 'mule-util)) ; for detect-coding-with-priority |
| 43 | 43 | ||
| 44 | |||
| 45 | ;; The buffer-swapped-with feature has been moved here temporarily. | ||
| 46 | ;; When pmail is merged, this advice must be eliminated and the | ||
| 47 | ;; functionality somehow reimplemented. | ||
| 48 | |||
| 49 | (defvar buffer-swapped-with nil | ||
| 50 | "Buffer that this buffer's contents are temporarily swapped with. | ||
| 51 | You should only set this variable in file-visiting buffers, | ||
| 52 | because it only affects how to save the buffer in its file.") | ||
| 53 | |||
| 54 | (make-variable-buffer-local 'buffer-swapped-with) | ||
| 55 | |||
| 56 | (defadvice basic-save-buffer | ||
| 57 | (around check-swap activate) | ||
| 58 | "If this buffer's real contents are swapped with some other buffer, | ||
| 59 | temporarily unswap in order to save the real contents. This | ||
| 60 | advice is temporarily used by pmail until a satisfactory solution | ||
| 61 | can be written." | ||
| 62 | (if (not buffer-swapped-with) | ||
| 63 | ad-do-it | ||
| 64 | (unwind-protect | ||
| 65 | (let ((modp (buffer-modified-p))) | ||
| 66 | (buffer-swap-text buffer-swapped-with) | ||
| 67 | (set-buffer-modified-p modp) | ||
| 68 | ad-do-it) | ||
| 69 | (buffer-swap-text buffer-swapped-with) | ||
| 70 | (set-buffer-modified-p nil)))) | ||
| 71 | |||
| 44 | (defconst pmail-attribute-header "X-RMAIL-ATTRIBUTES" | 72 | (defconst pmail-attribute-header "X-RMAIL-ATTRIBUTES" |
| 45 | "The header that stores the Pmail attribute data.") | 73 | "The header that stores the Pmail attribute data.") |
| 46 | 74 | ||