Function: hexl-scroll-up

hexl-scroll-up is an interactive and byte-compiled function defined in hexl.el.gz.

Signature

(hexl-scroll-up ARG)

Documentation

Scroll hexl buffer window upward ARG lines; or near full window if no ARG.

If there's no byte at the target address, move to the first or last line.

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/hexl.el.gz
(defun hexl-scroll-up (arg)
  "Scroll hexl buffer window upward ARG lines; or near full window if no ARG.
If there's no byte at the target address, move to the first or last line."
  (interactive "P")
  (setq arg (if (null arg)
                (- (window-height)
                   1
                   (if ruler-mode 1 0)
                   next-screen-context-lines)
              (prefix-numeric-value arg)))
  (let* ((movement (* arg 16))
	 (address (hexl-current-address))
	 (dest (+ address movement)))
    (cond
     ;; If possible, try to stay at the same offset from the beginning
     ;; of the 16-byte group, even if we move to the first or last
     ;; group.
     ((and (> dest hexl-max-address)
	   (>= (% hexl-max-address 16) (% address 16)))
      (setq dest (+ (logand hexl-max-address -16) (% address 16))))
     ((> dest hexl-max-address)
      (setq dest hexl-max-address))
     ((< dest 0)
      (setq dest (% address 16))))
    (if (/= dest (+ address movement))
	(message "Out of hexl region."))
    (hexl-goto-address dest)
    (recenter 0)))