diff options
author | Richard M. Stallman <rms@gnu.org> | 1997-07-27 00:06:20 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1997-07-27 00:06:20 +0000 |
commit | 4eec33ae223a70c70369c74ca0b0d3c45b800689 (patch) | |
tree | a72f201518c891c16920fbe5c976f457b0961758 /lisp/jka-compr.el | |
parent | 6c8499b941f044f78163f6f62f5782b75cc2ffc3 (diff) | |
download | emacs-4eec33ae223a70c70369c74ca0b0d3c45b800689.tar.gz |
(jka-compr-added-to-file-coding-system-alist): New var.
(jka-compr-insert-file-contents): Set coding-system-for-read
according to file name after removing compression suffix.
(jka-compr-install): Add elemets to file-coding-system-alist.
(jka-compr-uninstall): Remove elements from file-coding-system-alist.
Diffstat (limited to 'lisp/jka-compr.el')
-rw-r--r-- | lisp/jka-compr.el | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index 1bac9a7469d..11aaecc04c8 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el @@ -189,7 +189,10 @@ invoked." (defvar jka-compr-mode-alist-additions (list (cons "\\.tgz\\'" 'tar-mode)) - "A list of pairs to add to auto-mode-alist when jka-compr is installed.") + "A list of pairs to add to `auto-mode-alist' when jka-compr is installed.") + +;; List of all the elements we actually added to file-coding-system-alist. +(defvar jka-compr-added-to-file-coding-system-alist nil) (defvar jka-compr-file-name-handler-entry nil @@ -499,7 +502,19 @@ There should be no more than seven characters after the final `/'." (jka-compr-run-real-handler 'file-local-copy (list filename))) local-file size start - (coding-system-for-read (or coding-system-for-read 'undecided)) ) + (coding-system-for-read + (or coding-system-for-read + (let ((tail file-coding-system-alist) + (newfile + (jka-compr-byte-compiler-base-file-name file)) + result) + (while tail + (if (string-match (car (car tail)) newfile) + (setq result (car (cdr (car tail))) + tail nil)) + (setq tail (cdr tail))) + result) + 'undecided)) ) (setq local-file (or local-copy filename)) @@ -785,8 +800,18 @@ and `inhibit-first-line-modes-suffixes'." (setq file-name-handler-alist (cons jka-compr-file-name-handler-entry file-name-handler-alist)) + (setq jka-compr-added-to-file-coding-system-alist nil) + (mapcar (function (lambda (x) + ;; Don't do multibyte encoding on the compressed files. + (let ((elt (cons (jka-compr-info-regexp x) + '(no-conversion . no-conversion)))) + (setq file-coding-system-alist + (cons elt file-coding-system-alist)) + (setq jka-compr-added-to-file-coding-system-alist + (cons elt jka-compr-added-to-file-coding-system-alist))) + (and (jka-compr-info-strip-extension x) ;; Make entries in auto-mode-alist so that modes ;; are chosen right according to the file names @@ -844,7 +869,19 @@ by `jka-compr-installed'." (setcdr last (cdr (cdr last))) (setq last (cdr last)))) - (setq auto-mode-alist (cdr ama)))) + (setq auto-mode-alist (cdr ama))) + + (let* ((ama (cons nil file-coding-system-alist)) + (last ama) + entry) + + (while (cdr last) + (setq entry (car (cdr last))) + (if (member entry jka-compr-added-to-file-coding-system-alist) + (setcdr last (cdr (cdr last))) + (setq last (cdr last)))) + + (setq file-coding-system-alist (cdr ama)))) (defun jka-compr-installed-p () |