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)
This commit is contained in:
Daniel Mendler
2023-05-05 15:31:58 +02:00
committed by Eli Zaretskii
parent 69a2b9fa17
commit e68239773c

View File

@@ -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