From 85ef29a1632e2b280cd87135422aed3890b3f303 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 19 Oct 2001 07:23:53 +0000 Subject: [PATCH] (scroll-bar-toolkit-scroll): Don't ring the bell when we hit the beginning or the end of the buffer. Instead, just print a message and do nothing. --- lisp/scroll-bar.el | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el index 493a271cf23..29ad9a70dab 100644 --- a/lisp/scroll-bar.el +++ b/lisp/scroll-bar.el @@ -312,9 +312,23 @@ EVENT should be a scroll bar click." ((< (car portion-whole) 0) -1) (t 1))))) ((eq part 'up) - (scroll-up -1)) + ;; Avoid ringing the bell when at beginning of + ;; buffer, since that causes redisplay to bitch + ;; endlessly when visible-bell is in effect and + ;; the toolkit sends us many scroll-bar clicks one + ;; after the other. + (if (= 0 (save-excursion + (goto-char (window-start)) + (forward-line -1))) + (scroll-up -1) + (message "Beginning of buffer"))) ((eq part 'down) - (scroll-up 1)) + ;; Avoid ringing the bell if already at end of + ;; buffer; see the commentary above for the + ;; reasons. + (if (= 0 (save-excursion (forward-line 2))) + (scroll-up 1) + (message "End of buffer"))) ((eq part 'top) (set-window-start window (point-min))) ((eq part 'bottom) -- 2.39.2