changeset 66806:97261130eb5b

(jka-compr-install): Use push and dolist. Add jka-compr-load-suffixes to load-suffixes.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 11 Nov 2005 04:22:44 +0000
parents 8068044e970e
children 2fc24a2b40a5
files lisp/jka-cmpr-hook.el
diffstat 1 files changed, 30 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/jka-cmpr-hook.el	Fri Nov 11 02:54:08 2005 +0000
+++ b/lisp/jka-cmpr-hook.el	Fri Nov 11 04:22:44 2005 +0000
@@ -40,8 +40,8 @@
   "jka-compr customization."
   :group 'compression)
 
-;;; I have this defined so that .Z files are assumed to be in unix
-;;; compress format; and .gz files, in gzip format, and .bz2 files in bzip fmt.
+;; I have this defined so that .Z files are assumed to be in unix
+;; compress format; and .gz files, in gzip format, and .bz2 files in bzip fmt.
 (defcustom jka-compr-compression-info-list
   ;;[regexp
   ;; compr-message  compr-prog  compr-args
@@ -158,7 +158,7 @@
    jka-compr-compression-info-list
    "\\|"))
 
-;;; Functions for accessing the return value of jka-compr-get-compression-info
+;; Functions for accessing the return value of jka-compr-get-compression-info
 (defun jka-compr-info-regexp               (info)  (aref info 0))
 (defun jka-compr-info-compress-message     (info)  (aref info 1))
 (defun jka-compr-info-compress-program     (info)  (aref info 2))
@@ -192,48 +192,38 @@
   (setq jka-compr-file-name-handler-entry
 	(cons (jka-compr-build-file-regexp) 'jka-compr-handler))
 
-  (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)
+  (push jka-compr-file-name-handler-entry file-name-handler-alist)
 
-  (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)))
+  (dolist (x jka-compr-compression-info-list)
+    ;; Don't do multibyte encoding on the compressed files.
+    (let ((elt (cons (jka-compr-info-regexp x)
+                     '(no-conversion . no-conversion))))
+      (push elt file-coding-system-alist)
+      (push 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
-		    ;; sans `.gz'.
-		    (setq auto-mode-alist
-			  (cons (list (jka-compr-info-regexp x)
-				      nil 'jka-compr)
-				auto-mode-alist))
-		    ;; Also add these regexps to
-		    ;; inhibit-first-line-modes-suffixes, so that a
-		    ;; -*- line in the first file of a compressed tar
-		    ;; file doesn't override tar-mode.
-		    (setq inhibit-first-line-modes-suffixes
-			  (cons (jka-compr-info-regexp x)
-				inhibit-first-line-modes-suffixes)))))
-   jka-compr-compression-info-list)
+    (and (jka-compr-info-strip-extension x)
+         ;; Make entries in auto-mode-alist so that modes
+         ;; are chosen right according to the file names
+         ;; sans `.gz'.
+         (push (list (jka-compr-info-regexp x) nil 'jka-compr) auto-mode-alist)
+         ;; Also add these regexps to
+         ;; inhibit-first-line-modes-suffixes, so that a
+         ;; -*- line in the first file of a compressed tar
+         ;; file doesn't override tar-mode.
+         (push (jka-compr-info-regexp x)
+               inhibit-first-line-modes-suffixes)))
   (setq auto-mode-alist
 	(append auto-mode-alist jka-compr-mode-alist-additions))
 
   ;; Make sure that (load "foo") will find /bla/foo.el.gz.
   (setq load-suffixes
 	(apply 'append
-	       (mapcar (lambda (suffix)
-			 (cons suffix
-			       (mapcar (lambda (ext) (concat suffix ext))
-				       jka-compr-load-suffixes)))
-		       load-suffixes))))
+	       (append (mapcar (lambda (suffix)
+                               (cons suffix
+                                     (mapcar (lambda (ext) (concat suffix ext))
+                                             jka-compr-load-suffixes)))
+                             load-suffixes)
+                       (list jka-compr-load-suffixes)))))
 
 
 (defun jka-compr-installed-p ()
@@ -277,15 +267,15 @@
 (put 'with-auto-compression-mode 'lisp-indent-function 0)
 
 
-;;; This is what we need to know about jka-compr-handler
-;;; in order to decide when to call it.
+;; This is what we need to know about jka-compr-handler
+;; in order to decide when to call it.
 
 (put 'jka-compr-handler 'safe-magic t)
 (put 'jka-compr-handler 'operations '(byte-compiler-base-file-name
 				      write-region insert-file-contents
 				      file-local-copy load))
 
-;;; Turn on the mode.
+;; Turn on the mode.
 (auto-compression-mode 1)
 
 (provide 'jka-cmpr-hook)