From: Po Lu Date: Tue, 30 Nov 2021 06:05:18 +0000 (+0800) Subject: Fix annoying bell rings when pixel scrolling to buffer limits X-Git-Tag: emacs-29.0.90~3638^2~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3cba56888656227280754595f4715258d6c29355;p=emacs.git Fix annoying bell rings when pixel scrolling to buffer limits * lisp/pixel-scroll.el (pixel-scroll-precision): Don't ding at buffer limits. --- diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index 888320cf1ae..1af292139ea 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -480,9 +480,15 @@ wheel." (if (> (abs delta) (window-text-height window t)) (mwheel-scroll event nil) (with-selected-window window - (if (< delta 0) - (pixel-scroll-precision-scroll-down (- delta)) - (pixel-scroll-precision-scroll-up delta))))) + (condition-case nil + (if (< delta 0) + (pixel-scroll-precision-scroll-down (- delta)) + (pixel-scroll-precision-scroll-up delta)) + ;; Do not ding at buffer limits. Show a message instead. + (beginning-of-buffer + (message (error-message-string '(beginning-of-buffer)))) + (end-of-buffer + (message (error-message-string '(end-of-buffer)))))))) (mwheel-scroll event nil)))) ;;;###autoload