X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/11757e2f52741e3aa81d2a2fa30ae0f5f6de8d34..66236b772af493888a34148662dca58561958a6f:/lisp/jka-compr.el diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index 9bc4286702..fc53a0b329 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el @@ -132,8 +132,8 @@ for `jka-compr-compression-info-list')." "uncompressing" "uncompress" ("-c") nil t] ["\\.bz2\\'" - "bzip2ing" "bzip2" ("") - "bunzip2ing" "bzip2" ("-d") + "bzip2ing" "bzip2" ("-c") + "bunzip2ing" "bzip2" ("-d" "-c") nil t] ["\\.tgz\\'" "zipping" "gzip" ("-c" "-q") @@ -306,7 +306,7 @@ to keep: LEN chars starting BEG chars from the beginning." (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 @@ -413,7 +413,11 @@ There should be no more than seven characters after the final `/'." (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 @@ -436,6 +440,8 @@ There should be no more than seven characters after the final `/'." (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. @@ -478,6 +484,9 @@ There should be no more than seven characters after the final `/'." (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 @@ -511,16 +520,10 @@ There should be no more than seven characters after the final `/'." ;; 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)) @@ -604,18 +607,22 @@ There should be no more than seven characters after the final `/'." (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))