diff options
| author | Andreas Schwab | 2008-12-31 09:58:49 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2008-12-31 09:58:49 +0000 |
| commit | d00da9d7233a6915c7a126c062c025f7573ee6ba (patch) | |
| tree | f8571f02c9c172978fac26ae2a2fd0fc88657114 | |
| parent | aae1ecbbc8f532609e8cd334b234bc81dba5e6d8 (diff) | |
| download | emacs-d00da9d7233a6915c7a126c062c025f7573ee6ba.tar.gz emacs-d00da9d7233a6915c7a126c062c025f7573ee6ba.zip | |
(tar-mode): Set write-contents-functions instead of
write-region-annotate-functions.
(tar-mode-write-contents): New function.
(tar-write-region-annotate): Remove.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/tar-mode.el | 23 |
2 files changed, 20 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 42672fc55e7..afd073f1216 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2008-12-31 Andreas Schwab <schwab@suse.de> | ||
| 2 | |||
| 3 | * tar-mode.el (tar-mode): Set write-contents-functions instead of | ||
| 4 | write-region-annotate-functions. | ||
| 5 | (tar-mode-write-contents): New function. | ||
| 6 | (tar-write-region-annotate): Remove. | ||
| 7 | |||
| 1 | 2008-12-31 Chong Yidong <cyd@stupidchicken.com> | 8 | 2008-12-31 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 9 | ||
| 3 | * files.el (basic-save-buffer): Revert 2008-12-22 change. | 10 | * files.el (basic-save-buffer): Revert 2008-12-22 change. |
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index f743a80f2b1..2e99766918d 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el | |||
| @@ -637,7 +637,7 @@ 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-region-annotate-functions 'tar-write-region-annotate nil t) | 640 | (add-hook 'write-contents-functions 'tar-mode-write-contents nil t) |
| 641 | (add-hook 'kill-buffer-hook 'tar-mode-kill-buffer-hook nil t) | 641 | (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) | 642 | (add-hook 'change-major-mode-hook 'tar-change-major-mode-hook nil t) |
| 643 | ;; Tar data is made of bytes, not chars. | 643 | ;; Tar data is made of bytes, not chars. |
| @@ -1213,15 +1213,18 @@ Leaves the region wide." | |||
| 1213 | (insert (make-string (- goal-end (point-max)) ?\0)))))))) | 1213 | (insert (make-string (- goal-end (point-max)) ?\0)))))))) |
| 1214 | 1214 | ||
| 1215 | 1215 | ||
| 1216 | ;; Used in write-region-annotate-functions to write tar-files out correctly. | 1216 | ;; Used in write-contents-functions to write tar-files out correctly. |
| 1217 | (defun tar-write-region-annotate (start end) | 1217 | (defun tar-mode-write-contents () |
| 1218 | ;; When called from write-file (and auto-save), `start' is nil. | 1218 | (save-excursion |
| 1219 | ;; When called from M-x write-region, we assume the user wants to save | 1219 | (unwind-protect |
| 1220 | ;; (part of) the summary, not the tar data. | 1220 | (progn |
| 1221 | (unless (or start (not (tar-data-swapped-p))) | 1221 | (when (tar-data-swapped-p) (tar-swap-data)) |
| 1222 | (tar-clear-modification-flags) | 1222 | (write-region nil nil buffer-file-name nil t)) |
| 1223 | (set-buffer tar-data-buffer) | 1223 | (unless (tar-data-swapped-p) (tar-swap-data)))) |
| 1224 | nil)) | 1224 | (tar-clear-modification-flags) |
| 1225 | (set-buffer-modified-p nil) | ||
| 1226 | ;; Return t because we've written the file. | ||
| 1227 | t) | ||
| 1225 | 1228 | ||
| 1226 | (provide 'tar-mode) | 1229 | (provide 'tar-mode) |
| 1227 | 1230 | ||