changeset 21566:0641f568d88f

(hexlify-buffer, dehexlify-buffer): Don't bind binary-process-{in,out}put; setup coding-systems instead.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 15 Apr 1998 14:47:47 +0000
parents 2468c9227af0
children 33b1f010d589
files lisp/hexl.el
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/hexl.el	Wed Apr 15 14:40:43 1998 +0000
+++ b/lisp/hexl.el	Wed Apr 15 14:47:47 1998 +0000
@@ -590,8 +590,8 @@
        (or (y-or-n-p "Converting to hexl format discards undo info; ok? ")
 	   (error "Aborted")))
   (setq buffer-undo-list nil)
-  (let ((binary-process-output nil) ; for Ms-Dos
-	(binary-process-input buffer-file-type)
+  ;; Don't decode text in the ASCII part of `hexl' program output.
+  (let ((coding-system-for-read 'raw-text)
 	;; If the buffer was read with EOL conversions, be sure to use the
 	;; same conversions when passing the region to the `hexl' program.
 	(coding-system-for-write
@@ -614,9 +614,16 @@
        (or (y-or-n-p "Converting from hexl format discards undo info; ok? ")
 	   (error "Aborted")))
   (setq buffer-undo-list nil)
-  (let ((binary-process-output buffer-file-type) ; for Ms-Dos
-	(binary-process-input nil)
-	(coding-system-for-read 'raw-text)
+  (let ((coding-system-for-write 'raw-text)
+	(coding-system-for-read
+	 (let ((eol-type (coding-system-eol-type buffer-file-coding-system)))
+	   (cond ((eq eol-type 1)
+		  'raw-text-dos)
+		 ((eq eol-type 2)
+		  'raw-text-mac)
+		 ((eq eol-type 0)
+		  'raw-text-unix)
+		 (t 'no-conversion))))
 	(buffer-undo-list t))
     (shell-command-on-region (point-min) (point-max) dehexlify-command t)))