summaryrefslogtreecommitdiff
path: root/lisp/hexl.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-09-11 22:13:15 +0000
committerRichard M. Stallman <rms@gnu.org>1997-09-11 22:13:15 +0000
commitc3eb0da2b03e31fe5c7c8fab9ce99cad74cae16b (patch)
tree1e812eb38470298b3b7ee202e56e672aa60f26fb /lisp/hexl.el
parent5e9f598fb4b154f055b572ed182a2e56cd288e6e (diff)
downloademacs-c3eb0da2b03e31fe5c7c8fab9ce99cad74cae16b.tar.gz
(hexlify-buffer): Bind coding-system-for-write to
raw-text with eol-type derived from the buffer-file-coding-system.
Diffstat (limited to 'lisp/hexl.el')
-rw-r--r--lisp/hexl.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/hexl.el b/lisp/hexl.el
index 990d6f476fa..daa4dc79c9c 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -579,7 +579,17 @@ This discards the buffer's undo information."
(setq buffer-undo-list nil)
(let ((binary-process-output nil) ; for Ms-Dos
(binary-process-input buffer-file-type)
- (coding-system-for-write 'no-conversion)
+ ;; 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))))
(buffer-undo-list t))
(shell-command-on-region (point-min) (point-max) hexlify-command t)))
@@ -593,7 +603,7 @@ This discards the buffer's undo information."
(setq buffer-undo-list nil)
(let ((binary-process-output buffer-file-type) ; for Ms-Dos
(binary-process-input nil)
- (coding-system-for-read 'no-conversion)
+ (coding-system-for-read 'raw-text)
(buffer-undo-list t))
(shell-command-on-region (point-min) (point-max) dehexlify-command t)))