# HG changeset patch
# User andreasj
# Date 943720270 0
#      Sat Nov 27 16:31:10 1999 +0000
# Node ID d68aca9254ba9acf7f9cc91e01d6ac9134d4154c
# Parent  d68a2fdf1f9349964e0c68012d1cfc37571f2550
Added Jan Vroonhof's patch from <bywvv6s3lk.fsf@bolzano.math.ethz.ch>
with subject " More Mule Screwage in packages: jka-compr and lookup".

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+1999-08-08  Jan Vroonhof  <vroonhof@math.ethz.ch>
+
+	* jka-compr.el (jka-compr-call-process): Guard against use of
+	file-coding-system-for-read.
+	(jka-compr-insert-file-contents): idem.
+	(jka-value-if-bound): New function.
+
 1999-07-20  Darryl Okahata  <darrylo@sr.hp.com>
 
 	* tar-mode.el: `tar-regexp' must only match the names of
diff --git a/jka-compr.el b/jka-compr.el
--- a/jka-compr.el
+++ b/jka-compr.el
@@ -232,6 +232,10 @@
 
 
 ;; XEmacs change
+(defmacro jka-value-if-bound (symbol)
+  `(if (boundp (quote ,symbol)) ,symbol))
+
+;; XEmacs change
 (define-error 'compression-error "Compression error" 'file-error)
 
 (defvar jka-compr-acceptable-retval-list '(0 2 141))
@@ -311,7 +315,11 @@
   (if jka-compr-use-shell
 
       (let ((err-file (jka-compr-make-temp-name))
-	    (coding-system-for-read (or coding-system-for-read 'undecided))
+	    (coding-system-for-read (or
+				     ;; XEmacs Change
+				     (jka-value-if-bound
+				           coding-system-for-read) 
+				     'undecided))
 	    (coding-system-for-write 'no-conversion))
 	    
 	(unwind-protect
@@ -530,9 +538,11 @@
 	       (jka-compr-run-real-handler 'file-local-copy (list filename)))
 	      local-file
 	      size start
-	      (coding-system-for-read
-	       (or coding-system-for-read
-		   'undecided)))
+	      (coding-system-for-read	       
+	       (or
+		;; XEmacs change
+		(jka-value-if-bound coding-system-for-read)
+		'undecided)))
 		   ;; XEmacs change; skip multibyte-mode crap
 ;		   (and (null enable-multibyte-characters)
 ;			(or (auto-coding-alist-lookup