aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-07-27 00:06:20 +0000
committerRichard M. Stallman1997-07-27 00:06:20 +0000
commit4eec33ae223a70c70369c74ca0b0d3c45b800689 (patch)
treea72f201518c891c16920fbe5c976f457b0961758
parent6c8499b941f044f78163f6f62f5782b75cc2ffc3 (diff)
downloademacs-4eec33ae223a70c70369c74ca0b0d3c45b800689.tar.gz
emacs-4eec33ae223a70c70369c74ca0b0d3c45b800689.zip
(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.
-rw-r--r--lisp/jka-compr.el43
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."
189 189
190(defvar jka-compr-mode-alist-additions 190(defvar jka-compr-mode-alist-additions
191 (list (cons "\\.tgz\\'" 'tar-mode)) 191 (list (cons "\\.tgz\\'" 'tar-mode))
192 "A list of pairs to add to auto-mode-alist when jka-compr is installed.") 192 "A list of pairs to add to `auto-mode-alist' when jka-compr is installed.")
193
194;; List of all the elements we actually added to file-coding-system-alist.
195(defvar jka-compr-added-to-file-coding-system-alist nil)
193 196
194(defvar jka-compr-file-name-handler-entry 197(defvar jka-compr-file-name-handler-entry
195 nil 198 nil
@@ -499,7 +502,19 @@ There should be no more than seven characters after the final `/'."
499 (jka-compr-run-real-handler 'file-local-copy (list filename))) 502 (jka-compr-run-real-handler 'file-local-copy (list filename)))
500 local-file 503 local-file
501 size start 504 size start
502 (coding-system-for-read (or coding-system-for-read 'undecided)) ) 505 (coding-system-for-read
506 (or coding-system-for-read
507 (let ((tail file-coding-system-alist)
508 (newfile
509 (jka-compr-byte-compiler-base-file-name file))
510 result)
511 (while tail
512 (if (string-match (car (car tail)) newfile)
513 (setq result (car (cdr (car tail)))
514 tail nil))
515 (setq tail (cdr tail)))
516 result)
517 'undecided)) )
503 518
504 (setq local-file (or local-copy filename)) 519 (setq local-file (or local-copy filename))
505 520
@@ -785,8 +800,18 @@ and `inhibit-first-line-modes-suffixes'."
785 (setq file-name-handler-alist (cons jka-compr-file-name-handler-entry 800 (setq file-name-handler-alist (cons jka-compr-file-name-handler-entry
786 file-name-handler-alist)) 801 file-name-handler-alist))
787 802
803 (setq jka-compr-added-to-file-coding-system-alist nil)
804
788 (mapcar 805 (mapcar
789 (function (lambda (x) 806 (function (lambda (x)
807 ;; Don't do multibyte encoding on the compressed files.
808 (let ((elt (cons (jka-compr-info-regexp x)
809 '(no-conversion . no-conversion))))
810 (setq file-coding-system-alist
811 (cons elt file-coding-system-alist))
812 (setq jka-compr-added-to-file-coding-system-alist
813 (cons elt jka-compr-added-to-file-coding-system-alist)))
814
790 (and (jka-compr-info-strip-extension x) 815 (and (jka-compr-info-strip-extension x)
791 ;; Make entries in auto-mode-alist so that modes 816 ;; Make entries in auto-mode-alist so that modes
792 ;; are chosen right according to the file names 817 ;; are chosen right according to the file names
@@ -844,7 +869,19 @@ by `jka-compr-installed'."
844 (setcdr last (cdr (cdr last))) 869 (setcdr last (cdr (cdr last)))
845 (setq last (cdr last)))) 870 (setq last (cdr last))))
846 871
847 (setq auto-mode-alist (cdr ama)))) 872 (setq auto-mode-alist (cdr ama)))
873
874 (let* ((ama (cons nil file-coding-system-alist))
875 (last ama)
876 entry)
877
878 (while (cdr last)
879 (setq entry (car (cdr last)))
880 (if (member entry jka-compr-added-to-file-coding-system-alist)
881 (setcdr last (cdr (cdr last)))
882 (setq last (cdr last))))
883
884 (setq file-coding-system-alist (cdr ama))))
848 885
849 886
850(defun jka-compr-installed-p () 887(defun jka-compr-installed-p ()