emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog tar-mode.el


From: Stefan Monnier
Subject: [Emacs-diffs] emacs/lisp ChangeLog tar-mode.el
Date: Wed, 07 Jan 2009 02:15:44 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/01/07 02:15:43

Modified files:
        lisp           : ChangeLog tar-mode.el 

Log message:
        (tar-mode, tar-mode-write-contents)
        (tar-write-region-annotate): Undo Andreas's last change.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15052&r2=1.15053
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/tar-mode.el?cvsroot=emacs&r1=1.134&r2=1.135

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15052
retrieving revision 1.15053
diff -u -b -r1.15052 -r1.15053
--- ChangeLog   6 Jan 2009 07:52:49 -0000       1.15052
+++ ChangeLog   7 Jan 2009 02:15:37 -0000       1.15053
@@ -1,3 +1,8 @@
+2009-01-07  Stefan Monnier  <address@hidden>
+
+       * tar-mode.el (tar-mode, tar-mode-write-contents)
+       (tar-write-region-annotate): Undo Andreas's last change.
+
 2009-01-06  Michael Albinus  <address@hidden>
 
        * net/tramp.el (tramp-do-copy-or-rename-file-directly)

Index: tar-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tar-mode.el,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -b -r1.134 -r1.135
--- tar-mode.el 5 Jan 2009 03:19:48 -0000       1.134
+++ tar-mode.el 7 Jan 2009 02:15:43 -0000       1.135
@@ -637,7 +637,10 @@
   ;; buffer for the summary.
   (assert (not (tar-data-swapped-p)))
   (set (make-local-variable 'revert-buffer-function) 'tar-mode-revert)
-  (add-hook 'write-contents-functions 'tar-mode-write-contents nil t)
+  ;; We started using write-contents-functions, but this hook is not
+  ;; used during auto-save, so we now use
+  ;; write-region-annotate-functions which hooks at a lower-level.
+  (add-hook 'write-region-annotate-functions 'tar-write-region-annotate nil t)
   (add-hook 'kill-buffer-hook 'tar-mode-kill-buffer-hook nil t)
   (add-hook 'change-major-mode-hook 'tar-change-major-mode-hook nil t)
   ;; Tar data is made of bytes, not chars.
@@ -1213,18 +1216,15 @@
             (insert (make-string (- goal-end (point-max)) ?\0))))))))
 
 
-;; Used in write-contents-functions to write tar-files out correctly.
-(defun tar-mode-write-contents ()
-  (save-excursion
-    (unwind-protect
-       (progn
-         (when (tar-data-swapped-p) (tar-swap-data))
-         (write-region nil nil buffer-file-name nil t))
-      (unless (tar-data-swapped-p) (tar-swap-data))))
+;; Used in write-region-annotate-functions to write tar-files out correctly.
+(defun tar-write-region-annotate (start end)
+  ;; When called from write-file (and auto-save), `start' is nil.
+  ;; When called from M-x write-region, we assume the user wants to save
+  ;; (part of) the summary, not the tar data.
+  (unless (or start (not (tar-data-swapped-p)))
   (tar-clear-modification-flags)
-  (set-buffer-modified-p nil)
-  ;; Return t because we've written the file.
-  t)
+    (set-buffer tar-data-buffer)
+    nil))
 
 (provide 'tar-mode)
 




reply via email to

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