bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs 20.7 hexl gives surprising results


From: Eli Zaretskii
Subject: Re: emacs 20.7 hexl gives surprising results
Date: Wed, 11 Oct 2000 19:06:58 +0200

> From: John K Smith <address@hidden>
> Date: Wed, 11 Oct 2000 14:50:02 +0000
> 
> I look at a file containing just the two bytes:
>     0xFF  and 0x61
> with 
> 
>   C-X C-F name-of-file
> 
> and then change to hexl-mode
> 
>   M-x hexl-mode
> 
> I see
> -------------------------------------------------------
> 00000000: 81ff 61                                  ..a
> 
> which is reporting 3 bytes, the ff changing to 81ff.

Sorry, I thought you were using hexl-find-file, not C-x C-f.  My
apologies.

This is indeed a bug; please try the following patch:

--- lisp/hexl.el~       2000/04/19 19:10:46
+++ lisp/hexl.el        2000/10/11 17:03:58
@@ -600,17 +600,7 @@
   (setq buffer-undo-list nil)
   ;; 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
-        (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))))
+       (coding-system-for-write buffer-file-coding-system)
        (buffer-undo-list t))
     (shell-command-on-region (point-min) (point-max) hexlify-command t)
     (if (> (point) (hexl-address-to-marker hexl-max-address))
@@ -625,15 +615,7 @@
           (error "Aborted")))
   (setq buffer-undo-list nil)
   (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))))
+       (coding-system-for-read buffer-file-coding-system)
        (buffer-undo-list t))
     (shell-command-on-region (point-min) (point-max) dehexlify-command t)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]