diff options
| author | Stefan Monnier | 2001-10-12 16:28:16 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-10-12 16:28:16 +0000 |
| commit | aab8a6e351caa212567df338ed6ee5c5c51fd416 (patch) | |
| tree | 52d6d0d253d688694cc315a2c4a397961414d244 | |
| parent | eadd64444e9336b40f5e2ea70aeaa587f3e53431 (diff) | |
| download | emacs-aab8a6e351caa212567df338ed6ee5c5c51fd416.tar.gz emacs-aab8a6e351caa212567df338ed6ee5c5c51fd416.zip | |
(jka-compr-load-suffixes): New var.
(jka-compr-install): Add its content to load-suffixes.
(jka-compr-uninstall): Remove its content from load-suffixes.
| -rw-r--r-- | lisp/jka-compr.el | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index 1239fb39744..23e183b3548 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el | |||
| @@ -202,6 +202,9 @@ invoked." | |||
| 202 | (list (cons "\\.tgz\\'" 'tar-mode)) | 202 | (list (cons "\\.tgz\\'" 'tar-mode)) |
| 203 | "A list of pairs to add to `auto-mode-alist' when jka-compr is installed.") | 203 | "A list of pairs to add to `auto-mode-alist' when jka-compr is installed.") |
| 204 | 204 | ||
| 205 | (defvar jka-compr-load-suffixes '(".gz") | ||
| 206 | "List of suffixes to try when loading files.") | ||
| 207 | |||
| 205 | ;; List of all the elements we actually added to file-coding-system-alist. | 208 | ;; List of all the elements we actually added to file-coding-system-alist. |
| 206 | (defvar jka-compr-added-to-file-coding-system-alist nil) | 209 | (defvar jka-compr-added-to-file-coding-system-alist nil) |
| 207 | 210 | ||
| @@ -804,7 +807,16 @@ and `inhibit-first-line-modes-suffixes'." | |||
| 804 | inhibit-first-line-modes-suffixes))))) | 807 | inhibit-first-line-modes-suffixes))))) |
| 805 | jka-compr-compression-info-list) | 808 | jka-compr-compression-info-list) |
| 806 | (setq auto-mode-alist | 809 | (setq auto-mode-alist |
| 807 | (append auto-mode-alist jka-compr-mode-alist-additions))) | 810 | (append auto-mode-alist jka-compr-mode-alist-additions)) |
| 811 | |||
| 812 | ;; Make sure that (load "foo") will find /bla/foo.el.gz. | ||
| 813 | (setq load-suffixes | ||
| 814 | (apply 'append | ||
| 815 | (mapcar (lambda (suffix) | ||
| 816 | (cons suffix | ||
| 817 | (mapcar (lambda (ext) (concat suffix ext)) | ||
| 818 | jka-compr-load-suffixes))) | ||
| 819 | load-suffixes)))) | ||
| 808 | 820 | ||
| 809 | 821 | ||
| 810 | (defun jka-compr-uninstall () | 822 | (defun jka-compr-uninstall () |
| @@ -856,7 +868,15 @@ by `jka-compr-installed'." | |||
| 856 | (setcdr last (cdr (cdr last))) | 868 | (setcdr last (cdr (cdr last))) |
| 857 | (setq last (cdr last)))) | 869 | (setq last (cdr last)))) |
| 858 | 870 | ||
| 859 | (setq file-coding-system-alist (cdr ama)))) | 871 | (setq file-coding-system-alist (cdr ama))) |
| 872 | |||
| 873 | ;; Remove the suffixes that were added by jka-compr. | ||
| 874 | (let ((suffixes nil) | ||
| 875 | (re (jka-compr-build-file-regexp))) | ||
| 876 | (dolist (suffix load-suffixes) | ||
| 877 | (unless (string-match re suffix) | ||
| 878 | (push suffix suffixes))) | ||
| 879 | (setq load-suffixes (nreverse suffixes)))) | ||
| 860 | 880 | ||
| 861 | 881 | ||
| 862 | (defun jka-compr-installed-p () | 882 | (defun jka-compr-installed-p () |
| @@ -881,10 +901,6 @@ The return value is the entry in `file-name-handler-alist' for jka-compr." | |||
| 881 | (jka-compr-uninstall)) | 901 | (jka-compr-uninstall)) |
| 882 | 902 | ||
| 883 | 903 | ||
| 884 | ;;; Note this definition must be at the end of the file, because | ||
| 885 | ;;; `define-minor-mode' actually calls the mode-function if the | ||
| 886 | ;;; associated variable is non-nil, which requires that all needed | ||
| 887 | ;;; functions be already defined. [This is arguably a bug in d-m-m] | ||
| 888 | ;;;###autoload | 904 | ;;;###autoload |
| 889 | (define-minor-mode auto-compression-mode | 905 | (define-minor-mode auto-compression-mode |
| 890 | "Toggle automatic file compression and uncompression. | 906 | "Toggle automatic file compression and uncompression. |