aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-07-24 08:42:00 +0000
committerRichard M. Stallman1993-07-24 08:42:00 +0000
commit1c0b37434265fdd76f62b7c24ead76aaa2895149 (patch)
treebf99804fb41ed6afb33119b1d6f77cc974ba398f
parente5e548e338cae173b7a994390a5af5822ee23e6b (diff)
downloademacs-1c0b37434265fdd76f62b7c24ead76aaa2895149.tar.gz
emacs-1c0b37434265fdd76f62b7c24ead76aaa2895149.zip
(tar-parse-info, tar-header-offset, tar-superior-buffer)
(tar-superior-descriptor): Make them permanent locals. (tar-mode): Call kill-all-local-variables. Locally set enable-local-variables to nil.
-rw-r--r--lisp/tar-mode.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 31bbde0e004..4f22098980c 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -36,15 +36,6 @@
36;;; and re-insert the modified files into the archive. See the documentation 36;;; and re-insert the modified files into the archive. See the documentation
37;;; string of tar-mode for more info. 37;;; string of tar-mode for more info.
38 38
39;;; To autoload, add this to your .emacs file:
40;;;
41;;; (setq auto-mode-alist (cons '("\\.tar$" . tar-mode) auto-mode-alist))
42;;; (autoload 'tar-mode "tar-mode")
43;;;
44;;; But beware: for certain tar files - those whose very first file has
45;;; a -*- property line - autoloading won't work. See the function
46;;; "tar-normal-mode" to understand why.
47
48;;; This code now understands the extra fields that GNU tar adds to tar files. 39;;; This code now understands the extra fields that GNU tar adds to tar files.
49 40
50;;; This interacts correctly with "uncompress.el" in the Emacs library, 41;;; This interacts correctly with "uncompress.el" in the Emacs library,
@@ -115,6 +106,11 @@ the file never exists on disk.")
115(defvar tar-superior-buffer nil) 106(defvar tar-superior-buffer nil)
116(defvar tar-superior-descriptor nil) 107(defvar tar-superior-descriptor nil)
117(defvar tar-subfile-mode nil) 108(defvar tar-subfile-mode nil)
109
110(put 'tar-parse-info 'permanent-local t)
111(put 'tar-header-offset 'permanent-local t)
112(put 'tar-superior-buffer 'permanent-local t)
113(put 'tar-superior-descriptor 'permanent-local t)
118 114
119;;; First, duplicate some Common Lisp functions; I used to just (require 'cl) 115;;; First, duplicate some Common Lisp functions; I used to just (require 'cl)
120;;; but "cl.el" was messing some people up (also it's really big). 116;;; but "cl.el" was messing some people up (also it's really big).
@@ -487,12 +483,17 @@ See also: variables tar-update-datestamp and tar-anal-blocksize.
487\\{tar-mode-map}" 483\\{tar-mode-map}"
488 ;; this is not interactive because you shouldn't be turning this 484 ;; this is not interactive because you shouldn't be turning this
489 ;; mode on and off. You can corrupt things that way. 485 ;; mode on and off. You can corrupt things that way.
486 ;; rms: with permanent locals, it should now be possible to make this work
487 ;; interactively in some reasonable fashion.
488 (kill-all-local-variables)
490 (make-local-variable 'tar-header-offset) 489 (make-local-variable 'tar-header-offset)
491 (make-local-variable 'tar-parse-info) 490 (make-local-variable 'tar-parse-info)
492 (make-local-variable 'require-final-newline) 491 (make-local-variable 'require-final-newline)
493 (setq require-final-newline nil) ; binary data, dude... 492 (setq require-final-newline nil) ; binary data, dude...
494 (make-local-variable 'revert-buffer-function) 493 (make-local-variable 'revert-buffer-function)
495 (setq revert-buffer-function 'tar-mode-revert) 494 (setq revert-buffer-function 'tar-mode-revert)
495 (make-local-variable 'enable-local-variables)
496 (setq enable-local-variables nil)
496 (setq major-mode 'tar-mode) 497 (setq major-mode 'tar-mode)
497 (setq mode-name "Tar") 498 (setq mode-name "Tar")
498 (use-local-map tar-mode-map) 499 (use-local-map tar-mode-map)
@@ -505,9 +506,11 @@ See also: variables tar-update-datestamp and tar-anal-blocksize.
505 ) 506 )
506 507
507 508
509;; This should be converted to use a minor mode keymap.
510
508(defun tar-subfile-mode (p) 511(defun tar-subfile-mode (p)
509 "Minor mode for editing an element of a tar-file. 512 "Minor mode for editing an element of a tar-file.
510This mode redefines ^X^S to save the current buffer back into its 513This mode redefines C-x C-s to save the current buffer back into its
511associated tar-file buffer. You must save that buffer to actually 514associated tar-file buffer. You must save that buffer to actually
512save your changes to disk." 515save your changes to disk."
513 (interactive "P") 516 (interactive "P")
@@ -528,12 +531,12 @@ save your changes to disk."
528 ;; by all buffers in that mode. 531 ;; by all buffers in that mode.
529 (let ((m (current-local-map))) 532 (let ((m (current-local-map)))
530 (if m (use-local-map (copy-keymap m)))) 533 (if m (use-local-map (copy-keymap m))))
531 (local-set-key "\^X\^S" 'tar-subfile-save-buffer) 534 (local-set-key "\C-X\C-S" 'tar-subfile-save-buffer)
532 ;; turn off auto-save. 535 ;; turn off auto-save.
533 (auto-save-mode nil) 536 (auto-save-mode nil)
534 (setq buffer-auto-save-file-name nil) 537 (setq buffer-auto-save-file-name nil)
535 (run-hooks 'tar-subfile-mode-hook)) 538 (run-hooks 'tar-subfile-mode-hook))
536 (t (local-set-key "\^X\^S" 'save-buffer))) 539 (t (local-set-key "\C-X\C-S" 'save-buffer)))
537 ) 540 )
538 541
539 542