diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-01-07 02:15:37 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-01-07 02:15:37 +0000 |
commit | 3006c8dcfb577eb0ea0bec01db048f45fb5e7007 (patch) | |
tree | 69ff38f369c43c0fe498331f6028d58731ef10bd /lisp/tar-mode.el | |
parent | 41ec3f54f69fd626748db0811d76facf1136253b (diff) | |
download | emacs-3006c8dcfb577eb0ea0bec01db048f45fb5e7007.tar.gz emacs-3006c8dcfb577eb0ea0bec01db048f45fb5e7007.tar.bz2 emacs-3006c8dcfb577eb0ea0bec01db048f45fb5e7007.zip |
(tar-mode, tar-mode-write-contents)
(tar-write-region-annotate): Undo Andreas's last change.
Diffstat (limited to 'lisp/tar-mode.el')
-rw-r--r-- | lisp/tar-mode.el | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index b15c0b89587..7e091d8d038 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -637,7 +637,10 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'. ;; 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 @@ Leaves the region wide." (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) |