From 3446c26c2f9378992eafc60e44d9b5715b3244f4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 16 Jan 2020 10:49:29 -0800 Subject: [PATCH] Fix hexl jumping to end of file Plus some other small fixes nearby. * lisp/hexl.el (hexl-end-of-line): Simplify to match next fix. (hexl-end-of-1k-page, hexl-end-of-512b-page): Use min instead of max. Tiny change by Vladimir Nikishkin (Bug#39131). (hexl-insert-char): Use = instead of eq to compare integers. --- lisp/hexl.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/hexl.el b/lisp/hexl.el index 2535d581db4..58518e74169 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -701,10 +701,7 @@ With prefix arg N, puts point N bytes of the way from the true beginning." (defun hexl-end-of-line () "Goto end of line in Hexl mode." (interactive) - (hexl-goto-address (let ((address (logior (hexl-current-address) 15))) - (if (> address hexl-max-address) - (setq address hexl-max-address)) - address))) + (hexl-goto-address (min hexl-max-address (logior (hexl-current-address) 15)))) (defun hexl-scroll-down (arg) "Scroll hexl buffer window upward ARG lines; or near full window if no ARG." @@ -749,7 +746,7 @@ If there's no byte at the target address, move to the first or last line." "Go to end of 1KB boundary." (interactive) (hexl-goto-address - (max hexl-max-address (logior (hexl-current-address) 1023)))) + (min hexl-max-address (logior (hexl-current-address) 1023)))) (defun hexl-beginning-of-512b-page () "Go to beginning of 512 byte boundary." @@ -760,7 +757,7 @@ If there's no byte at the target address, move to the first or last line." "Go to end of 512 byte boundary." (interactive) (hexl-goto-address - (max hexl-max-address (logior (hexl-current-address) 511)))) + (min hexl-max-address (logior (hexl-current-address) 511)))) (defun hexl-quoted-insert (arg) "Read next input character and insert it. @@ -935,7 +932,7 @@ CH must be a unibyte character whose value is between 0 and 255." (goto-char ascii-position) (delete-char 1) (insert (hexl-printable-character ch)) - (or (eq address hexl-max-address) + (or (= address hexl-max-address) (setq address (1+ address))) (hexl-goto-address address) (if at-ascii-position -- 2.39.2