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: Andreas Schwab
Subject: [Emacs-diffs] emacs/lisp ChangeLog tar-mode.el
Date: Wed, 31 Dec 2008 09:58:53 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Andreas Schwab <schwab> 08/12/31 09:58:53

Modified files:
        lisp           : ChangeLog tar-mode.el 

Log message:
        (tar-mode): Set write-contents-functions instead of
        write-region-annotate-functions.
        (tar-mode-write-contents): New function.
        (tar-write-region-annotate): Remove.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15017&r2=1.15018
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/tar-mode.el?cvsroot=emacs&r1=1.132&r2=1.133

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15017
retrieving revision 1.15018
diff -u -b -r1.15017 -r1.15018
--- ChangeLog   31 Dec 2008 02:13:04 -0000      1.15017
+++ ChangeLog   31 Dec 2008 09:58:49 -0000      1.15018
@@ -1,3 +1,10 @@
+2008-12-31  Andreas Schwab  <address@hidden>
+
+       * tar-mode.el (tar-mode): Set write-contents-functions instead of
+       write-region-annotate-functions.
+       (tar-mode-write-contents): New function.
+       (tar-write-region-annotate): Remove.
+
 2008-12-31  Chong Yidong  <address@hidden>
 
        * files.el (basic-save-buffer): Revert 2008-12-22 change.

Index: tar-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tar-mode.el,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- tar-mode.el 30 Dec 2008 21:59:54 -0000      1.132
+++ tar-mode.el 31 Dec 2008 09:58:53 -0000      1.133
@@ -637,7 +637,7 @@
   ;; buffer for the summary.
   (assert (not (tar-data-swapped-p)))
   (set (make-local-variable 'revert-buffer-function) 'tar-mode-revert)
-  (add-hook 'write-region-annotate-functions 'tar-write-region-annotate nil t)
+  (add-hook 'write-contents-functions 'tar-mode-write-contents 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,15 +1213,18 @@
             (insert (make-string (- goal-end (point-max)) ?\0))))))))
 
 
-;; 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)))
+;; 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))))
     (tar-clear-modification-flags)
-    (set-buffer tar-data-buffer)
-    nil))
+  (set-buffer-modified-p nil)
+  ;; Return t because we've written the file.
+  t)
 
 (provide 'tar-mode)
 




reply via email to

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