[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16196: 24.3.50; Disable ding when scrolling

From: Basil L. Contovounesios
Subject: bug#16196: 24.3.50; Disable ding when scrolling
Date: Fri, 09 Aug 2019 11:57:58 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Kangas <address@hidden> writes:

> To make it easier to review, I've also included a git diff
> ignoring whitespace changes.

FWIW, you can slightly reduce the amount of code that needs reindenting
by binding saw-error in the existing let* form:

diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index dfea55374b..6403c57236 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -237,7 +237,8 @@ mwheel-scroll
          (delq 'click (delq 'double (delq 'triple (event-modifiers event)))))
-         (amt (assoc mods mouse-wheel-scroll-amount)))
+         (amt (assoc mods mouse-wheel-scroll-amount))
+         saw-error)
     (unless (eq scroll-window selected-window)
       ;; Mark window to be scrolled for redisplay.
       (select-window scroll-window 'mark-for-redisplay))
@@ -251,6 +252,7 @@ mwheel-scroll
       ;; So by adding things up we get a squaring up (1, 3, 6, 10, 15, ...).
       (setq amt (* amt (event-click-count event))))
     (when (numberp amt) (setq amt (* amt (event-line-count event))))
+    (condition-case nil
            (let ((button (mwheel-event-button event)))
              (cond ((eq button mouse-wheel-down-event)
@@ -293,15 +295,21 @@ mwheel-scroll
                  (goto-char old-point)
                  (goto-char new-point)))
-       (select-window selected-window t))))
+            (select-window selected-window t)))
+      ;; Do not ding at buffer limits.  Show a message instead.
+      (beginning-of-buffer (message "Beginning of buffer")
+                           (setq saw-error t))
+      (end-of-buffer (message "End of buffer")
+                     (setq saw-error t)))
-  (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time)
-    (if mwheel-inhibit-click-event-timer
+    (when (and (not saw-error)
+               mouse-wheel-click-event mouse-wheel-inhibit-click-time)
+      (if mwheel-inhibit-click-event-timerp
          (cancel-timer mwheel-inhibit-click-event-timer)
         (add-hook 'pre-command-hook 'mwheel-filter-click-events))
       (setq mwheel-inhibit-click-event-timer
            (run-with-timer mouse-wheel-inhibit-click-time nil
-                         'mwheel-inhibit-click-timeout))))
+                            'mwheel-inhibit-click-timeout)))))
 (put 'mwheel-scroll 'scroll-command t)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]