aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2020-01-16 10:49:29 -0800
committerPaul Eggert2020-01-16 10:50:02 -0800
commit3446c26c2f9378992eafc60e44d9b5715b3244f4 (patch)
tree052060e831583f16803ab2e6ad1ccbdd1274299b
parent25adbc4a5ecc3e16625c0171607e3153bbdf7ab1 (diff)
downloademacs-3446c26c2f9378992eafc60e44d9b5715b3244f4.tar.gz
emacs-3446c26c2f9378992eafc60e44d9b5715b3244f4.zip
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.
-rw-r--r--lisp/hexl.el11
1 files 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."
701(defun hexl-end-of-line () 701(defun hexl-end-of-line ()
702 "Goto end of line in Hexl mode." 702 "Goto end of line in Hexl mode."
703 (interactive) 703 (interactive)
704 (hexl-goto-address (let ((address (logior (hexl-current-address) 15))) 704 (hexl-goto-address (min hexl-max-address (logior (hexl-current-address) 15))))
705 (if (> address hexl-max-address)
706 (setq address hexl-max-address))
707 address)))
708 705
709(defun hexl-scroll-down (arg) 706(defun hexl-scroll-down (arg)
710 "Scroll hexl buffer window upward ARG lines; or near full window if no ARG." 707 "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."
749 "Go to end of 1KB boundary." 746 "Go to end of 1KB boundary."
750 (interactive) 747 (interactive)
751 (hexl-goto-address 748 (hexl-goto-address
752 (max hexl-max-address (logior (hexl-current-address) 1023)))) 749 (min hexl-max-address (logior (hexl-current-address) 1023))))
753 750
754(defun hexl-beginning-of-512b-page () 751(defun hexl-beginning-of-512b-page ()
755 "Go to beginning of 512 byte boundary." 752 "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."
760 "Go to end of 512 byte boundary." 757 "Go to end of 512 byte boundary."
761 (interactive) 758 (interactive)
762 (hexl-goto-address 759 (hexl-goto-address
763 (max hexl-max-address (logior (hexl-current-address) 511)))) 760 (min hexl-max-address (logior (hexl-current-address) 511))))
764 761
765(defun hexl-quoted-insert (arg) 762(defun hexl-quoted-insert (arg)
766 "Read next input character and insert it. 763 "Read next input character and insert it.
@@ -935,7 +932,7 @@ CH must be a unibyte character whose value is between 0 and 255."
935 (goto-char ascii-position) 932 (goto-char ascii-position)
936 (delete-char 1) 933 (delete-char 1)
937 (insert (hexl-printable-character ch)) 934 (insert (hexl-printable-character ch))
938 (or (eq address hexl-max-address) 935 (or (= address hexl-max-address)
939 (setq address (1+ address))) 936 (setq address (1+ address)))
940 (hexl-goto-address address) 937 (hexl-goto-address address)
941 (if at-ascii-position 938 (if at-ascii-position