emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/mail pmail.el


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp/mail pmail.el
Date: Wed, 31 Dec 2008 02:44:00 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      08/12/31 02:44:00

Modified files:
        lisp/mail      : pmail.el 

Log message:
        (buffer-swapped-with): New var, moved from files.el.  Add advice to
        basic-save-buffer to use it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/pmail.el?cvsroot=emacs&r1=1.42&r2=1.43

Patches:
Index: pmail.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/pmail.el,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- pmail.el    29 Dec 2008 19:16:37 -0000      1.42
+++ pmail.el    31 Dec 2008 02:44:00 -0000      1.43
@@ -41,6 +41,34 @@
 (require 'mail-utils)
 (eval-when-compile (require 'mule-util)) ; for detect-coding-with-priority
 
+
+;; The buffer-swapped-with feature has been moved here temporarily.
+;; When pmail is merged, this advice must be eliminated and the
+;; functionality somehow reimplemented.
+
+(defvar buffer-swapped-with nil
+  "Buffer that this buffer's contents are temporarily swapped with.
+You should only set this variable in file-visiting buffers,
+because it only affects how to save the buffer in its file.")
+
+(make-variable-buffer-local 'buffer-swapped-with)
+
+(defadvice basic-save-buffer
+  (around check-swap activate)
+  "If this buffer's real contents are swapped with some other buffer,
+temporarily unswap in order to save the real contents.  This
+advice is temporarily used by pmail until a satisfactory solution
+can be written."
+  (if (not buffer-swapped-with)
+      ad-do-it
+    (unwind-protect
+       (let ((modp (buffer-modified-p)))
+         (buffer-swap-text buffer-swapped-with)
+         (set-buffer-modified-p modp)
+         ad-do-it)
+      (buffer-swap-text buffer-swapped-with)
+      (set-buffer-modified-p nil))))
+
 (defconst pmail-attribute-header "X-RMAIL-ATTRIBUTES"
   "The header that stores the Pmail attribute data.")
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]