(define-key tar-mode-map "h" 'describe-mode)
(define-key tar-mode-map "n" 'tar-next-line)
(define-key tar-mode-map "\^N" 'tar-next-line)
+ (define-key tar-mode-map [down] 'tar-next-line)
(define-key tar-mode-map "o" 'tar-extract-other-window)
(define-key tar-mode-map "p" 'tar-previous-line)
(define-key tar-mode-map "\^P" 'tar-previous-line)
+ (define-key tar-mode-map [up] 'tar-previous-line)
(define-key tar-mode-map "r" 'tar-rename-entry)
(define-key tar-mode-map "u" 'tar-unflag)
(define-key tar-mode-map "v" 'tar-view)
(defun tar-subfile-mode (p)
"Minor mode for editing an element of a tar-file.
-This mode redefines the save-buffer command to save the current buffer back
-into its associated tar-file buffer. You must save that buffer to actually
-save your changes to disk."
+This mode arranges for \"saving\" this buffer to write the data
+into the tar-file buffer that it came from. The changes will actually
+appear on disk when you save the tar-file's buffer."
(interactive "P")
(or (and (boundp 'tar-superior-buffer) tar-superior-buffer)
(error "This buffer is not an element of a tar file"))
;; 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)
(make-local-variable 'tar-superior-descriptor)
(setq tar-superior-buffer tar-buffer)
(setq tar-superior-descriptor descriptor)
- (tar-subfile-mode 1)
- (setq buffer-read-only read-only-p)
- (set-buffer-modified-p nil))
+ (setq buffer-read-only read-only-p)
+ (set-buffer-modified-p nil)
+ (tar-subfile-mode 1))
(set-buffer tar-buffer))
(narrow-to-region 1 tar-header-offset)))
(if view-p
;; I suppose this is run in a context where changing the buffer is bad.
;; (tar-pad-to-blocksize)
(write-region tar-header-offset (point-max) buffer-file-name nil t)
- (tar-clear-modification-flags))
+ (tar-clear-modification-flags)
+ (set-buffer-modified-p nil))
(narrow-to-region 1 tar-header-offset))
;; return T because we've written the file.
t)