summaryrefslogtreecommitdiff
path: root/lisp/tar-mode.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-06-12 21:50:08 +0000
committerRichard M. Stallman <rms@gnu.org>1996-06-12 21:50:08 +0000
commit08e0416d320da157e2f25ef930b51b44b6c795ac (patch)
tree18e5cb3e811a82425cc8bdd1c70a16305f0a14a2 /lisp/tar-mode.el
parent3950590123f5ed6bd4e93d908136f294f9446c47 (diff)
downloademacs-08e0416d320da157e2f25ef930b51b44b6c795ac.tar.gz
(tar-mode-revert): Cope if user cancels the revert.
Diffstat (limited to 'lisp/tar-mode.el')
-rw-r--r--lisp/tar-mode.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index ce8ed3b6184..9ac9eb90e08 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -630,11 +630,19 @@ appear on disk when you save the tar-file's buffer."
;; Revert the buffer and recompute the dired-like listing.
(defun tar-mode-revert (&optional no-autosave no-confirm)
- (setq tar-header-offset nil)
- (let ((revert-buffer-function nil))
- (revert-buffer t no-confirm)
- (widen))
- (tar-mode))
+ (let ((revert-buffer-function nil)
+ (old-offset tar-header-offset)
+ success)
+ (setq tar-header-offset nil)
+ (unwind-protect
+ (and (revert-buffer t no-confirm)
+ (progn (widen)
+ (setq success t)
+ (tar-mode)))
+ ;; If the revert was canceled,
+ ;; put back the old value of tar-header-offset.
+ (or success
+ (setq tar-header-offset old-offset)))))
(defun tar-next-line (p)