From e68239773ce6f6ff85795e37030f9b4f03f5942f Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Fri, 5 May 2023 15:31:58 +0200 Subject: [PATCH] pixel-scroll: Avoid loading `cua-base' CUA is not necessarily used together with `pixel-scroll-precision-mode'. Make `pixel-scroll-interpolate-down' and `pixel-scroll-interpolate-up' independent and avoid loading cua-base. * lisp/pixel-scroll.el (pixel-scroll-interpolate-up) (pixel-scroll-interpolate-down): Do not use `cua-scroll-down' and `cua-scroll-up'; replace them with inline code. (Bug#80245) --- lisp/pixel-scroll.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index dbb532f691b..23e63add994 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -90,7 +90,6 @@ (require 'mwheel) (require 'subr-x) (require 'ring) -(require 'cua-base) (defvar pixel-wait 0 "Idle time on each step of pixel scroll specified in second. @@ -831,7 +830,13 @@ It is a vector of the form [ VELOCITY TIME SIGN ]." ;; since we want exactly 1 ;; page to be scrolled. nil 1) - (cua-scroll-up))) + (cond + ((eobp) + (scroll-up)) ; signal error + (t + (condition-case nil + (scroll-up) + (end-of-buffer (goto-char (point-max)))))))) ;;;###autoload (defun pixel-scroll-interpolate-up () @@ -840,7 +845,13 @@ It is a vector of the form [ VELOCITY TIME SIGN ]." (if pixel-scroll-precision-interpolate-page (pixel-scroll-precision-interpolate (window-text-height nil t) nil 1) - (cua-scroll-down))) + (cond + ((bobp) + (scroll-down)) ; signal error + (t + (condition-case nil + (scroll-down) + (beginning-of-buffer (goto-char (point-min)))))))) ;;;###autoload (define-minor-mode pixel-scroll-precision-mode