Mercurial > emacs
comparison lisp/tar-mode.el @ 3365:0865c1679cd8
Don't initialize write-file-hooks.
Don't change auto-mode-alist.
(tar-regexp): Deleted.
(tar-normal-mode): Deleted.
(tar-mode): Add autoload.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 31 May 1993 21:51:15 +0000 |
parents | b65cf676a09b |
children | 97205883b02d |
comparison
equal
deleted
inserted
replaced
3364:3dd9b89c6a17 | 3365:0865c1679cd8 |
---|---|
468 | 468 |
469 ;; tar mode is suitable only for specially formatted data. | 469 ;; tar mode is suitable only for specially formatted data. |
470 (put 'tar-mode 'mode-class 'special) | 470 (put 'tar-mode 'mode-class 'special) |
471 (put 'tar-subfile-mode 'mode-class 'special) | 471 (put 'tar-subfile-mode 'mode-class 'special) |
472 | 472 |
473 ;;;##autoload | |
473 (defun tar-mode () | 474 (defun tar-mode () |
474 "Major mode for viewing a tar file as a dired-like listing of its contents. | 475 "Major mode for viewing a tar file as a dired-like listing of its contents. |
475 You can move around using the usual cursor motion commands. | 476 You can move around using the usual cursor motion commands. |
476 Letters no longer insert themselves. | 477 Letters no longer insert themselves. |
477 Type 'e' to pull a file out of the tar file and into its own buffer. | 478 Type 'e' to pull a file out of the tar file and into its own buffer. |
1076 nil)) | 1077 nil)) |
1077 | 1078 |
1078 | 1079 |
1079 ;;; Patch it in. | 1080 ;;; Patch it in. |
1080 | 1081 |
1081 (defvar tar-regexp "\\.tar$" | |
1082 "The regular expression used to identify tar file names.") | |
1083 | |
1084 (setq auto-mode-alist | |
1085 (cons (cons tar-regexp 'tar-mode) auto-mode-alist)) | |
1086 | |
1087 (or (boundp 'write-file-hooks) (setq write-file-hooks nil)) | |
1088 (or (listp write-file-hooks) | |
1089 (setq write-file-hooks (list write-file-hooks))) | |
1090 (or (memq 'maybe-write-tar-file write-file-hooks) | 1082 (or (memq 'maybe-write-tar-file write-file-hooks) |
1091 (setq write-file-hooks | 1083 (setq write-file-hooks |
1092 (cons 'maybe-write-tar-file write-file-hooks))) | 1084 (cons 'maybe-write-tar-file write-file-hooks))) |
1093 | 1085 |
1094 | |
1095 ;;; This is a hack. For files ending in .tar, we want -*- lines to be | |
1096 ;;; completely ignored - if there is one, it applies to the first file | |
1097 ;;; in the archive, and not the archive itself! | |
1098 | |
1099 (defun tar-normal-mode (&optional find-file) | |
1100 "Choose the major mode for this buffer automatically. | |
1101 Also sets up any specified local variables of the file. | |
1102 Uses the visited file name, the -*- line, and the local variables spec. | |
1103 | |
1104 This function is called automatically from `find-file'. In that case, | |
1105 if `inhibit-local-variables' is non-`nil' we require confirmation before | |
1106 processing a local variables spec. If you run `normal-mode' explicitly, | |
1107 confirmation is never required. | |
1108 | |
1109 Note that this version of this function has been hacked to interact | |
1110 correctly with tar files - when visiting a file which matches | |
1111 'tar-regexp', the -*- line and local-variables are not examined, | |
1112 as they would apply to a file within the archive rather than the archive | |
1113 itself." | |
1114 (interactive) | |
1115 (if (and buffer-file-name | |
1116 (string-match tar-regexp buffer-file-name)) | |
1117 (tar-mode) | |
1118 (tar-real-normal-mode find-file))) | |
1119 | |
1120 | |
1121 (if (not (fboundp 'tar-real-normal-mode)) | |
1122 (defalias 'tar-real-normal-mode (symbol-function 'normal-mode))) | |
1123 (defalias 'normal-mode 'tar-normal-mode) | |
1124 | |
1125 (provide 'tar-mode) | 1086 (provide 'tar-mode) |
1126 | 1087 |
1127 ;;; tar-mode.el ends here | 1088 ;;; tar-mode.el ends here |