diff options
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/tar-mode.el | 24 |
2 files changed, 17 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e404bceba07..398509369a4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2009-01-07 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * tar-mode.el (tar-mode, tar-mode-write-contents) | ||
| 4 | (tar-write-region-annotate): Undo Andreas's last change. | ||
| 5 | |||
| 1 | 2009-01-06 Michael Albinus <michael.albinus@gmx.de> | 6 | 2009-01-06 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 7 | ||
| 3 | * net/tramp.el (tramp-do-copy-or-rename-file-directly) | 8 | * net/tramp.el (tramp-do-copy-or-rename-file-directly) |
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'. | |||
| 637 | ;; buffer for the summary. | 637 | ;; buffer for the summary. |
| 638 | (assert (not (tar-data-swapped-p))) | 638 | (assert (not (tar-data-swapped-p))) |
| 639 | (set (make-local-variable 'revert-buffer-function) 'tar-mode-revert) | 639 | (set (make-local-variable 'revert-buffer-function) 'tar-mode-revert) |
| 640 | (add-hook 'write-contents-functions 'tar-mode-write-contents nil t) | 640 | ;; We started using write-contents-functions, but this hook is not |
| 641 | ;; used during auto-save, so we now use | ||
| 642 | ;; write-region-annotate-functions which hooks at a lower-level. | ||
| 643 | (add-hook 'write-region-annotate-functions 'tar-write-region-annotate nil t) | ||
| 641 | (add-hook 'kill-buffer-hook 'tar-mode-kill-buffer-hook nil t) | 644 | (add-hook 'kill-buffer-hook 'tar-mode-kill-buffer-hook nil t) |
| 642 | (add-hook 'change-major-mode-hook 'tar-change-major-mode-hook nil t) | 645 | (add-hook 'change-major-mode-hook 'tar-change-major-mode-hook nil t) |
| 643 | ;; Tar data is made of bytes, not chars. | 646 | ;; Tar data is made of bytes, not chars. |
| @@ -1213,18 +1216,15 @@ Leaves the region wide." | |||
| 1213 | (insert (make-string (- goal-end (point-max)) ?\0)))))))) | 1216 | (insert (make-string (- goal-end (point-max)) ?\0)))))))) |
| 1214 | 1217 | ||
| 1215 | 1218 | ||
| 1216 | ;; Used in write-contents-functions to write tar-files out correctly. | 1219 | ;; Used in write-region-annotate-functions to write tar-files out correctly. |
| 1217 | (defun tar-mode-write-contents () | 1220 | (defun tar-write-region-annotate (start end) |
| 1218 | (save-excursion | 1221 | ;; When called from write-file (and auto-save), `start' is nil. |
| 1219 | (unwind-protect | 1222 | ;; When called from M-x write-region, we assume the user wants to save |
| 1220 | (progn | 1223 | ;; (part of) the summary, not the tar data. |
| 1221 | (when (tar-data-swapped-p) (tar-swap-data)) | 1224 | (unless (or start (not (tar-data-swapped-p))) |
| 1222 | (write-region nil nil buffer-file-name nil t)) | ||
| 1223 | (unless (tar-data-swapped-p) (tar-swap-data)))) | ||
| 1224 | (tar-clear-modification-flags) | 1225 | (tar-clear-modification-flags) |
| 1225 | (set-buffer-modified-p nil) | 1226 | (set-buffer tar-data-buffer) |
| 1226 | ;; Return t because we've written the file. | 1227 | nil)) |
| 1227 | t) | ||
| 1228 | 1228 | ||
| 1229 | (provide 'tar-mode) | 1229 | (provide 'tar-mode) |
| 1230 | 1230 | ||