X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/db6c5b923d7f3d7899641b0b88294dbe417df00e..2c3d59853173258cd84dab5b12c239705dd8fc02:/lisp/hexl.el diff --git a/lisp/hexl.el b/lisp/hexl.el index ace1dfb08f..67b5ee9ae8 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -1,6 +1,6 @@ ;;; hexl.el --- edit a file in a hex dump format using the hexl filter. -;; Copyright (C) 1989, 1994 Free Software Foundation, Inc. +;; Copyright (C) 1989, 1994, 1998 Free Software Foundation, Inc. ;; Author: Keith Gabryelski ;; Maintainer: FSF @@ -91,7 +91,8 @@ and \"-de\" when dehexlifying a buffer." (defcustom hexl-follow-ascii t "If non-nil then highlight the ASCII character corresponding to point." :type 'boolean - :group 'hexl) + :group 'hexl + :version "20.3") (defvar hexl-max-address 0 "Maximum offset into hexl buffer.") @@ -302,6 +303,8 @@ With arg, don't unhexlify buffer." (remove-hook 'after-revert-hook 'hexl-after-revert-hook t) (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t) + (remove-hook 'post-command-hook 'hexl-follow-ascii-find t) + (setq hexl-ascii-overlay nil) (setq write-contents-hooks hexl-mode-old-write-contents-hooks) (setq require-final-newline hexl-mode-old-require-final-newline) @@ -588,8 +591,8 @@ This discards the buffer's undo information." (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 @@ -612,9 +615,16 @@ This discards the buffer's undo information." (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)))