:type 'string
:group 'jka-compr)
-(defvar jka-compr-use-shell t)
-
+(defvar jka-compr-use-shell
+ (not (memq system-type '(ms-dos windows-nt))))
;;; 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.
"uncompressing" "uncompress" ("-c")
nil t]
["\\.bz2\\'"
- "bzip2ing" "bzip2" ("")
- "bunzip2ing" "bzip2" ("-d")
- t t]
+ "bzip2ing" "bzip2" ("-c")
+ "bunzip2ing" "bzip2" ("-d" "-c")
+ nil t]
["\\.tgz\\'"
"zipping" "gzip" ("-c" "-q")
"unzipping" "gzip" ("-c" "-q" "-d")
(let ((err-file (jka-compr-make-temp-name))
(coding-system-for-read (or coding-system-for-read 'undecided))
- (coding-system-for-write 'no-conversion) )
+ (coding-system-for-write 'no-conversion))
(unwind-protect
;;; from ange-ftp.
(defcustom jka-compr-temp-name-template
- (expand-file-name "jka-com"
- (or (getenv "TMPDIR") "/tmp/"))
+ (expand-file-name "jka-com" temporary-file-directory)
"Prefix added to all temp files created by jka-compr.
There should be no more than seven characters after the final `/'."
:type 'string
(compress-args (jka-compr-info-compress-args info))
(uncompress-args (jka-compr-info-uncompress-args info))
(base-name (file-name-nondirectory visit-file))
- temp-file temp-buffer)
+ temp-file temp-buffer
+ ;; we need to leave `last-coding-system-used' set to its
+ ;; value after calling write-region the first time, so
+ ;; that `basic-save-buffer' sees the right value.
+ (coding-system-used last-coding-system-used))
(setq temp-buffer (get-buffer-create " *jka-compr-wr-temp*"))
(with-current-buffer temp-buffer
(jka-compr-run-real-handler 'write-region
(list start end temp-file t 'dont))
+ ;; save value used by the real write-region
+ (setq coding-system-used last-coding-system-used)
;; Here we must read the output of compress program as is
;; without any code conversion.
(stringp visit))
(message "Wrote %s" visit-file))
+ ;; ensure `last-coding-system-used' has an appropriate value
+ (setq last-coding-system-used coding-system-used)
+
nil)
(jka-compr-run-real-handler 'write-region
;; don't do that conversion.
(and (null enable-multibyte-characters)
'raw-text)
- (let ((tail file-coding-system-alist)
- (newfile
- (jka-compr-byte-compiler-base-file-name file))
- result)
- (while tail
- (if (string-match (car (car tail)) newfile)
- (setq result (car (cdr (car tail)))
- tail nil))
- (setq tail (cdr tail)))
- result)
+ (let ((coding (find-operation-coding-system
+ 'insert-file-contents
+ (jka-compr-byte-compiler-base-file-name file))))
+ (and (consp coding) (car coding)))
'undecided)) )
(setq local-file (or local-copy filename))
(signal 'file-error
(cons "Opening input file" (nth 2 notfound))))
- ;; Run the functions that insert-file-contents would.
- (let ((p after-insert-file-functions)
- (insval size))
- (while p
- (setq insval (funcall (car p) size))
- (if insval
- (progn
- (or (integerp insval)
- (signal 'wrong-type-argument
- (list 'integerp insval)))
- (setq size insval)))
- (setq p (cdr p))))
+ ;; This is done in insert-file-contents after we return.
+ ;; That is a little weird, but better to go along with it now
+ ;; than to change it now.
+
+;;; ;; Run the functions that insert-file-contents would.
+;;; (let ((p after-insert-file-functions)
+;;; (insval size))
+;;; (while p
+;;; (setq insval (funcall (car p) size))
+;;; (if insval
+;;; (progn
+;;; (or (integerp insval)
+;;; (signal 'wrong-type-argument
+;;; (list 'integerp insval)))
+;;; (setq size insval)))
+;;; (setq p (cdr p))))
(list filename size))