From 348a60a8f3ee881a5fbeda36ae73bec64c6237ac Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 22 Dec 2008 20:20:25 +0000 Subject: [PATCH] (shadow-copy-file): Handle buffer-swapped-with. --- lisp/ChangeLog | 6 ++++++ lisp/shadowfile.el | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 15ef4269f51..5c15bfb1f4d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2008-12-22 Richard M Stallman + * shadowfile.el (shadow-copy-file): Handle buffer-swapped-with. + + * files.el (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. + * dired.el (dired-readin): Inhibit modification hooks. 2008-12-22 Ulf Jasper diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el index 751a33d260d..ece12c367e1 100644 --- a/lisp/shadowfile.el +++ b/lisp/shadowfile.el @@ -574,8 +574,14 @@ site." (when buffer (set-buffer buffer) (condition-case i - (progn - (write-region nil nil to) + (progn + (if buffer-swapped-with + (progn + (buffer-swap-text buffer-swapped-with) + (unwind-protect + (write-region nil nil to) + (buffer-swap-text buffer-swapped-with))) + (write-region nil nil to)) (shadow-remove-from-todo s)) (error (message "Shadow %s not updated!" (cdr s))))))) -- 2.39.2