528 |
(put 'tar-subfile-mode 'mode-class 'special) |
(put 'tar-subfile-mode 'mode-class 'special) |
529 |
|
|
530 |
;;;###autoload |
;;;###autoload |
531 |
(defun tar-mode () |
(define-derived-mode tar-mode nil "Tar" |
532 |
"Major mode for viewing a tar file as a dired-like listing of its contents. |
"Major mode for viewing a tar file as a dired-like listing of its contents. |
533 |
You can move around using the usual cursor motion commands. |
You can move around using the usual cursor motion commands. |
534 |
Letters no longer insert themselves. |
Letters no longer insert themselves. |
547 |
;; mode on and off. You can corrupt things that way. |
;; mode on and off. You can corrupt things that way. |
548 |
;; rms: with permanent locals, it should now be possible to make this work |
;; rms: with permanent locals, it should now be possible to make this work |
549 |
;; interactively in some reasonable fashion. |
;; interactively in some reasonable fashion. |
|
(kill-all-local-variables) |
|
550 |
(make-local-variable 'tar-header-offset) |
(make-local-variable 'tar-header-offset) |
551 |
(make-local-variable 'tar-parse-info) |
(make-local-variable 'tar-parse-info) |
552 |
(make-local-variable 'require-final-newline) |
(set (make-local-variable 'require-final-newline) nil) ; binary data, dude... |
553 |
(setq require-final-newline nil) ; binary data, dude... |
(set (make-local-variable 'revert-buffer-function) 'tar-mode-revert) |
554 |
(make-local-variable 'revert-buffer-function) |
(set (make-local-variable 'local-enable-local-variables) nil) |
555 |
(setq revert-buffer-function 'tar-mode-revert) |
(set (make-local-variable 'next-line-add-newlines) nil) |
|
(make-local-variable 'local-enable-local-variables) |
|
|
(setq local-enable-local-variables nil) |
|
|
(make-local-variable 'next-line-add-newlines) |
|
|
(setq next-line-add-newlines nil) |
|
556 |
;; Prevent loss of data when saving the file. |
;; Prevent loss of data when saving the file. |
557 |
(make-local-variable 'file-precious-flag) |
(set (make-local-variable 'file-precious-flag) t) |
|
(setq file-precious-flag t) |
|
|
(setq major-mode 'tar-mode) |
|
|
(setq mode-name "Tar") |
|
|
(use-local-map tar-mode-map) |
|
558 |
(auto-save-mode 0) |
(auto-save-mode 0) |
559 |
(make-local-variable 'write-contents-hooks) |
(set (make-local-variable 'write-contents-hooks) '(tar-mode-write-file)) |
|
(setq write-contents-hooks '(tar-mode-write-file)) |
|
560 |
(widen) |
(widen) |
561 |
(if (and (boundp 'tar-header-offset) tar-header-offset) |
(if (and (boundp 'tar-header-offset) tar-header-offset) |
562 |
(narrow-to-region 1 (byte-to-position tar-header-offset)) |
(narrow-to-region 1 (byte-to-position tar-header-offset)) |
563 |
(tar-summarize-buffer) |
(tar-summarize-buffer) |
564 |
(tar-next-line 0)) |
(tar-next-line 0))) |
|
(run-hooks 'tar-mode-hook) |
|
|
) |
|
565 |
|
|
566 |
|
|
567 |
(defun tar-subfile-mode (p) |
(defun tar-subfile-mode (p) |