changeset 15424:85a85480fa3c

(tar-mode-revert): Cope if user cancels the revert.
author Richard M. Stallman <rms@gnu.org>
date Wed, 12 Jun 1996 21:50:08 +0000
parents 5b9fe08fa6eb
children 482b164fe732
files lisp/tar-mode.el
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/tar-mode.el	Wed Jun 12 21:49:19 1996 +0000
+++ b/lisp/tar-mode.el	Wed Jun 12 21:50:08 1996 +0000
@@ -630,11 +630,19 @@
 
 ;; 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)