From: Richard M. Stallman Date: Wed, 12 Jun 1996 21:50:08 +0000 (+0000) Subject: (tar-mode-revert): Cope if user cancels the revert. X-Git-Tag: emacs-19.34~438 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3742f39f26c7cc73c113bd3117059c8107647353;p=emacs.git (tar-mode-revert): Cope if user cancels the revert. --- 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)