diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2005-11-11 04:23:02 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2005-11-11 04:23:02 +0000 |
commit | be93a2c4484181639c468e79f015739129eaa90b (patch) | |
tree | 683c950eaabffd7419c745e77f41e3ad89e26382 /lisp/jka-cmpr-hook.el | |
parent | f6cb7e0afb7e93455b207c12ec05f8239aea6773 (diff) | |
download | emacs-be93a2c4484181639c468e79f015739129eaa90b.tar.gz |
(jka-compr-install): Use push and dolist.
Add jka-compr-load-suffixes to load-suffixes.
Diffstat (limited to 'lisp/jka-cmpr-hook.el')
-rw-r--r-- | lisp/jka-cmpr-hook.el | 74 |
1 files changed, 32 insertions, 42 deletions
diff --git a/lisp/jka-cmpr-hook.el b/lisp/jka-cmpr-hook.el index fb0a62d602d..65f624c110b 100644 --- a/lisp/jka-cmpr-hook.el +++ b/lisp/jka-cmpr-hook.el @@ -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 @@ invoked." 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 @@ and `inhibit-first-line-modes-suffixes'." (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) - - (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 - ;; 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) + (push jka-compr-file-name-handler-entry file-name-handler-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'. + (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 @@ Returns the new status of auto compression (non-nil means on)." (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) |