Under linux, when coding-system-for-read is bound to 'no-conversion in
MULE-enabled XEmacs 21.2.b27, end-of-line conversion still occurs. I
notice that the EOL conversion differs from MULE-enabled FSFmacs 20.3.
From my zsh shell, I run the following which puts foo^Jbar in one
buffer and foo^Mbar in another, then use string-equal to compare the
buffers' contents. I expect the contents to be string-equal if EOL
conversion occurs.
$ xemacs -vanilla -batch -eval '
(let ((buf1 (get-buffer-create "*1*"))
(buf2 (get-buffer-create "*2*")))
(require (quote cl))
(dolist (coding-system-for-read (quote (nil no-conversion binary)))
(call-process "perl" nil buf1 nil "-e" "print
qq(foo\\cJbar)")
(call-process "perl" nil buf2 nil "-e" "print
qq(foo\\cMbar)")
(message "(coding-system-for-read %s) ==>\t%s"
coding-system-for-read
(string-equal (with-current-buffer buf1 (buffer-string))
(with-current-buffer buf2 (buffer-string))))))'
(coding-system-for-read nil) ==> t
(coding-system-for-read no-conversion) ==> t
(coding-system-for-read binary) ==> nil
Change "xemacs" to "emacs" and I get
(coding-system-for-read nil) ==> t
(coding-system-for-read no-conversion) ==> nil
(coding-system-for-read binary) ==> nil
This EOL conversion causes problems under jka-compr.el. Any ^M's in
the output of gzip get converted to ^J's, corrupting the file. No one
replied when I mentioned the auto-compression problems on this list
and on comp.emacs.xemacs.
The following patch to jka-compr.el changes coding-system-for-read
prior to call-process; I haven't looked at crypt.el to see what needs
to be done to correct its auto-compression functions. I have only
tested this patch on MULE-enabled XEmacs 21.2.b27 under linux (RedHat
5.2). I wanted to post the change here for feedback before submitting
to xemacs-patches.
--- jka-compr.el.ORIG Thu Jan 27 11:27:37 2000
+++ jka-compr.el Thu Feb 3 18:25:22 2000
@@ -464,7 +464,10 @@
;; save value used by the real write-region
;; without any code conversion.
- (let ((coding-system-for-read 'no-conversion))
+ (let ((;; XEmacs change: 'no-conversion still does EOL
+ ;; conversion which may corrupt the resulting
+ ;; compressed file
+ coding-system-for-read 'binary))
(jka-compr-call-process compress-program
(concat compress-message
" " base-name)