]> git.eshelyaron.com Git - emacs.git/commitdiff
(tar-mode-revert): Cope if user cancels the revert.
authorRichard M. Stallman <rms@gnu.org>
Wed, 12 Jun 1996 21:50:08 +0000 (21:50 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 12 Jun 1996 21:50:08 +0000 (21:50 +0000)
lisp/tar-mode.el

index ce8ed3b6184ac743a41955f6a70137f43d1c88ef..9ac9eb90e08b7fe8758f33fa5a0c974dab421b11 100644 (file)
@@ -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)