diff lisp/jka-compr.el @ 66805:8068044e970e

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'.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 11 Nov 2005 02:54:08 +0000
parents 41bb365f41c4
children 3bd95f4f2941 7beb78bc1f8e
line wrap: on
line diff
--- a/lisp/jka-compr.el	Thu Nov 10 22:23:48 2005 +0000
+++ b/lisp/jka-compr.el	Fri Nov 11 02:54:08 2005 +0000
@@ -101,6 +101,8 @@
 
 ;;; Code:
 
+(require 'jka-cmpr-hook)
+
 (defcustom jka-compr-shell "sh"
   "*Shell to be used for calling compression programs.
 The value of this variable only matters if you want to discard the
@@ -119,32 +121,6 @@
 (make-variable-buffer-local 'jka-compr-really-do-compress)
 (put 'jka-compr-really-do-compress 'permanent-local t)
 
-;;; 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))
-(defun jka-compr-info-compress-args        (info)  (aref info 3))
-(defun jka-compr-info-uncompress-message   (info)  (aref info 4))
-(defun jka-compr-info-uncompress-program   (info)  (aref info 5))
-(defun jka-compr-info-uncompress-args      (info)  (aref info 6))
-(defun jka-compr-info-can-append           (info)  (aref info 7))
-(defun jka-compr-info-strip-extension      (info)  (aref info 8))
-(defun jka-compr-info-file-magic-bytes     (info)  (aref info 9))
-
-
-(defun jka-compr-get-compression-info (filename)
-  "Return information about the compression scheme of FILENAME.
-The determination as to which compression scheme, if any, to use is
-based on the filename itself and `jka-compr-compression-info-list'."
-  (catch 'compression-info
-    (let ((case-fold-search nil))
-      (mapcar
-       (function (lambda (x)
-		   (and (string-match (jka-compr-info-regexp x) filename)
-			(throw 'compression-info x))))
-       jka-compr-compression-info-list)
-      nil)))
-
 
 (put 'compression-error 'error-conditions '(compression-error file-error error))
 
@@ -154,8 +130,7 @@
 
 (defun jka-compr-error (prog args infile message &optional errfile)
 
-  (let ((errbuf (get-buffer-create " *jka-compr-error*"))
-	(curbuf (current-buffer)))
+  (let ((errbuf (get-buffer-create " *jka-compr-error*")))
     (with-current-buffer errbuf
       (widen) (erase-buffer)
       (insert (format "Error while executing \"%s %s < %s\"\n\n"
@@ -270,8 +245,8 @@
 	   (erase-buffer)))))
 
 
-;;; Support for temp files.  Much of this was inspired if not lifted
-;;; from ange-ftp.
+;; Support for temp files.  Much of this was inspired if not lifted
+;; from ange-ftp.
 
 (defcustom jka-compr-temp-name-template
   (expand-file-name "jka-com" temporary-file-directory)
@@ -563,7 +538,6 @@
 	       (jka-compr-run-real-handler 'file-local-copy (list filename)))
 	      (temp-file (jka-compr-make-temp-name t))
 	      (temp-buffer (get-buffer-create " *jka-compr-flc-temp*"))
-	      (notfound nil)
 	      local-file)
 
 	  (setq local-file (or local-copy filename))
@@ -611,7 +585,7 @@
       (jka-compr-run-real-handler 'file-local-copy (list filename)))))
 
 
-;;; Support for loading compressed files.
+;; Support for loading compressed files.
 (defun jka-compr-load (file &optional noerror nomessage nosuffix)
   "Documented as original."
 
@@ -720,17 +694,11 @@
 
     (setq auto-mode-alist (cdr ama)))
 
-  (let* ((ama (cons nil file-coding-system-alist))
-	 (last ama)
-	 entry)
-
-    (while (cdr last)
-      (setq entry (car (cdr last)))
-      (if (member entry jka-compr-added-to-file-coding-system-alist)
-	  (setcdr last (cdr (cdr last)))
-	(setq last (cdr last))))
-
-    (setq file-coding-system-alist (cdr ama)))
+  (while jka-compr-added-to-file-coding-system-alist
+    (setq file-coding-system-alist
+          (delq (car (member (pop jka-compr-added-to-file-coding-system-alist)
+                             file-coding-system-alist))
+                file-coding-system-alist)))
 
   ;; Remove the suffixes that were added by jka-compr.
   (let ((suffixes nil)
@@ -742,5 +710,5 @@
 
 (provide 'jka-compr)
 
-;;; arch-tag: 3f15b630-e9a7-46c4-a22a-94afdde86ebc
+;; arch-tag: 3f15b630-e9a7-46c4-a22a-94afdde86ebc
 ;;; jka-compr.el ends here