[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp files.el
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] emacs/lisp files.el |
Date: |
Mon, 22 Dec 2008 19:48:08 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Richard M. Stallman <rms> 08/12/22 19:48:08
Modified files:
lisp : files.el
Log message:
(buffer-swapped-with): New variable.
(basic-save-buffer-0): Most of basic-save-buffer moved here.
(basic-save-buffer): Unswap the buffer temporarily if nec.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/files.el?cvsroot=emacs&r1=1.1024&r2=1.1025
Patches:
Index: files.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/files.el,v
retrieving revision 1.1024
retrieving revision 1.1025
diff -u -b -r1.1024 -r1.1025
--- files.el 9 Dec 2008 23:43:11 -0000 1.1024
+++ files.el 22 Dec 2008 19:48:08 -0000 1.1025
@@ -4065,6 +4065,13 @@
(make-variable-buffer-local 'save-buffer-coding-system)
(put 'save-buffer-coding-system 'permanent-local t)
+(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)
+
(defun basic-save-buffer ()
"Save the current buffer in its visited file, if it has been modified.
The hooks `write-contents-functions' and `write-file-functions' get a chance
@@ -4073,6 +4080,17 @@
Before and after saving the buffer, this function runs
`before-save-hook' and `after-save-hook', respectively."
(interactive)
+ (if (not buffer-swapped-with)
+ (basic-save-buffer-0)
+ ;; If this buffer's real contents are "swapped" with some other buffer,
+ ;; temporarily unswap in order to save the real contents.
+ (unwind-protect
+ (progn
+ (buffer-swap-text buffer-swapped-with)
+ (basic-save-buffer-0))
+ (buffer-swap-text buffer-swapped-with))))
+
+(defun basic-save-buffer-0 ()
(save-current-buffer
;; In an indirect buffer, save its base buffer instead.
(if (buffer-base-buffer)
- [Emacs-diffs] emacs/lisp files.el, Chong Yidong, 2008/12/02
- [Emacs-diffs] emacs/lisp files.el, Chong Yidong, 2008/12/09
- [Emacs-diffs] emacs/lisp files.el,
Richard M. Stallman <=
- [Emacs-diffs] emacs/lisp files.el, Richard M. Stallman, 2008/12/22
- [Emacs-diffs] emacs/lisp files.el, Eli Zaretskii, 2008/12/26
- [Emacs-diffs] emacs/lisp files.el, Eli Zaretskii, 2008/12/26
- [Emacs-diffs] emacs/lisp files.el, Chong Yidong, 2008/12/27
- [Emacs-diffs] emacs/lisp files.el, Chong Yidong, 2008/12/30