aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-11-11 02:54:08 +0000
committerStefan Monnier2005-11-11 02:54:08 +0000
commitf6cb7e0afb7e93455b207c12ec05f8239aea6773 (patch)
tree58a288bb3693adc2ba52b70125ddabbb66cf70ba
parentd11e5f6cd3ecb41385bf06555584c8a2d27a4abc (diff)
downloademacs-f6cb7e0afb7e93455b207c12ec05f8239aea6773.tar.gz
emacs-f6cb7e0afb7e93455b207c12ec05f8239aea6773.zip
Require 'jka-cmpr-hook.
(jka-compr-info-compress-message, jka-compr-info-compress-program) (jka-compr-info-compress-args, jka-compr-info-uncompress-message) (jka-compr-info-uncompress-program, jka-compr-info-uncompress-args) (jka-compr-info-can-append, jka-compr-info-strip-extension) (jka-compr-info-file-magic-bytes, jka-compr-get-compression-info) (jka-compr-info-regexp): Remove. Provided by jka-cmpr-hook. (jka-compr-uninstall): Remove entries from jka-compr-added-to-file-coding-system-alist after they are used. (jka-compr-error): Remove unused var `curbuf'. (jka-compr-file-local-copy): Remove unused var `notfound'.
-rw-r--r--lisp/jka-compr.el56
1 files changed, 12 insertions, 44 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index b25d3865668..c15cfbdea30 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -101,6 +101,8 @@
101 101
102;;; Code: 102;;; Code:
103 103
104(require 'jka-cmpr-hook)
105
104(defcustom jka-compr-shell "sh" 106(defcustom jka-compr-shell "sh"
105 "*Shell to be used for calling compression programs. 107 "*Shell to be used for calling compression programs.
106The value of this variable only matters if you want to discard the 108The value of this variable only matters if you want to discard the
@@ -119,32 +121,6 @@ data appears to be compressed already.")
119(make-variable-buffer-local 'jka-compr-really-do-compress) 121(make-variable-buffer-local 'jka-compr-really-do-compress)
120(put 'jka-compr-really-do-compress 'permanent-local t) 122(put 'jka-compr-really-do-compress 'permanent-local t)
121 123
122;;; Functions for accessing the return value of jka-compr-get-compression-info
123(defun jka-compr-info-regexp (info) (aref info 0))
124(defun jka-compr-info-compress-message (info) (aref info 1))
125(defun jka-compr-info-compress-program (info) (aref info 2))
126(defun jka-compr-info-compress-args (info) (aref info 3))
127(defun jka-compr-info-uncompress-message (info) (aref info 4))
128(defun jka-compr-info-uncompress-program (info) (aref info 5))
129(defun jka-compr-info-uncompress-args (info) (aref info 6))
130(defun jka-compr-info-can-append (info) (aref info 7))
131(defun jka-compr-info-strip-extension (info) (aref info 8))
132(defun jka-compr-info-file-magic-bytes (info) (aref info 9))
133
134
135(defun jka-compr-get-compression-info (filename)
136 "Return information about the compression scheme of FILENAME.
137The determination as to which compression scheme, if any, to use is
138based on the filename itself and `jka-compr-compression-info-list'."
139 (catch 'compression-info
140 (let ((case-fold-search nil))
141 (mapcar
142 (function (lambda (x)
143 (and (string-match (jka-compr-info-regexp x) filename)
144 (throw 'compression-info x))))
145 jka-compr-compression-info-list)
146 nil)))
147
148 124
149(put 'compression-error 'error-conditions '(compression-error file-error error)) 125(put 'compression-error 'error-conditions '(compression-error file-error error))
150 126
@@ -154,8 +130,7 @@ based on the filename itself and `jka-compr-compression-info-list'."
154 130
155(defun jka-compr-error (prog args infile message &optional errfile) 131(defun jka-compr-error (prog args infile message &optional errfile)
156 132
157 (let ((errbuf (get-buffer-create " *jka-compr-error*")) 133 (let ((errbuf (get-buffer-create " *jka-compr-error*")))
158 (curbuf (current-buffer)))
159 (with-current-buffer errbuf 134 (with-current-buffer errbuf
160 (widen) (erase-buffer) 135 (widen) (erase-buffer)
161 (insert (format "Error while executing \"%s %s < %s\"\n\n" 136 (insert (format "Error while executing \"%s %s < %s\"\n\n"
@@ -270,8 +245,8 @@ to keep: LEN chars starting BEG chars from the beginning."
270 (erase-buffer))))) 245 (erase-buffer)))))
271 246
272 247
273;;; Support for temp files. Much of this was inspired if not lifted 248;; Support for temp files. Much of this was inspired if not lifted
274;;; from ange-ftp. 249;; from ange-ftp.
275 250
276(defcustom jka-compr-temp-name-template 251(defcustom jka-compr-temp-name-template
277 (expand-file-name "jka-com" temporary-file-directory) 252 (expand-file-name "jka-com" temporary-file-directory)
@@ -563,7 +538,6 @@ There should be no more than seven characters after the final `/'."
563 (jka-compr-run-real-handler 'file-local-copy (list filename))) 538 (jka-compr-run-real-handler 'file-local-copy (list filename)))
564 (temp-file (jka-compr-make-temp-name t)) 539 (temp-file (jka-compr-make-temp-name t))
565 (temp-buffer (get-buffer-create " *jka-compr-flc-temp*")) 540 (temp-buffer (get-buffer-create " *jka-compr-flc-temp*"))
566 (notfound nil)
567 local-file) 541 local-file)
568 542
569 (setq local-file (or local-copy filename)) 543 (setq local-file (or local-copy filename))
@@ -611,7 +585,7 @@ There should be no more than seven characters after the final `/'."
611 (jka-compr-run-real-handler 'file-local-copy (list filename))))) 585 (jka-compr-run-real-handler 'file-local-copy (list filename)))))
612 586
613 587
614;;; Support for loading compressed files. 588;; Support for loading compressed files.
615(defun jka-compr-load (file &optional noerror nomessage nosuffix) 589(defun jka-compr-load (file &optional noerror nomessage nosuffix)
616 "Documented as original." 590 "Documented as original."
617 591
@@ -720,17 +694,11 @@ by `jka-compr-installed'."
720 694
721 (setq auto-mode-alist (cdr ama))) 695 (setq auto-mode-alist (cdr ama)))
722 696
723 (let* ((ama (cons nil file-coding-system-alist)) 697 (while jka-compr-added-to-file-coding-system-alist
724 (last ama) 698 (setq file-coding-system-alist
725 entry) 699 (delq (car (member (pop jka-compr-added-to-file-coding-system-alist)
726 700 file-coding-system-alist))
727 (while (cdr last) 701 file-coding-system-alist)))
728 (setq entry (car (cdr last)))
729 (if (member entry jka-compr-added-to-file-coding-system-alist)
730 (setcdr last (cdr (cdr last)))
731 (setq last (cdr last))))
732
733 (setq file-coding-system-alist (cdr ama)))
734 702
735 ;; Remove the suffixes that were added by jka-compr. 703 ;; Remove the suffixes that were added by jka-compr.
736 (let ((suffixes nil) 704 (let ((suffixes nil)
@@ -742,5 +710,5 @@ by `jka-compr-installed'."
742 710
743(provide 'jka-compr) 711(provide 'jka-compr)
744 712
745;;; arch-tag: 3f15b630-e9a7-46c4-a22a-94afdde86ebc 713;; arch-tag: 3f15b630-e9a7-46c4-a22a-94afdde86ebc
746;;; jka-compr.el ends here 714;;; jka-compr.el ends here