all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Stefan Kangas <stefan@marxist.se>
Cc: "16196@debbugs.gnu.org" <16196@debbugs.gnu.org>,
	"Jan Djärv" <jan.h.d@swipnet.se>,
	"Stefan Monnier" <monnier@iro.umontreal.ca>
Subject: bug#16196: 24.3.50; Disable ding when scrolling
Date: Fri, 09 Aug 2019 11:57:58 +0300	[thread overview]
Message-ID: <87r25ulnqh.fsf@tcd.ie> (raw)
In-Reply-To: <CADwFkmm91nRMrmWV0GZavcHKt454g6mAFxv3KwHe4Jj7fxcZhg@mail.gmail.com> (Stefan Kangas's message of "Fri, 9 Aug 2019 09:55:03 +0200")

[-- Attachment #1: Type: text/plain, Size: 257 bytes --]

Stefan Kangas <stefan@marxist.se> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mwheel.diff --]
[-- Type: text/x-diff, Size: 2068 bytes --]

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
 	       (window-point)))
          (mods
 	  (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
         (unwind-protect
 	    (let ((button (mwheel-event-button event)))
 	      (cond ((eq button mouse-wheel-down-event)
@@ -293,15 +295,21 @@ mwheel-scroll
 	          (goto-char old-point)
 	          (deactivate-mark)
 	          (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)
 

[-- Attachment #3: Type: text/plain, Size: 20 bytes --]


Thanks,

-- 
Basil

  reply	other threads:[~2019-08-09  8:57 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20  6:08 bug#16196: 24.3.50; Disable ding when scrolling Jan Djärv
2013-12-20  8:56 ` Eli Zaretskii
2013-12-20 10:26   ` Jan Djärv
2013-12-20 10:32     ` Jan Djärv
2013-12-20 10:48       ` Eli Zaretskii
2013-12-20 17:52         ` Jan Djärv
2013-12-20 18:10           ` Eli Zaretskii
2013-12-20 18:48             ` Jan Djärv
2013-12-20 20:35               ` Eli Zaretskii
2013-12-23  2:46                 ` Stefan Monnier
2013-12-23 10:44                   ` Jan Djärv
2014-01-03 22:57                     ` Stefan Monnier
2014-01-03 23:46                       ` Jan Djärv
2014-01-04  0:03                         ` Drew Adams
2014-01-04  5:07                         ` Stefan Monnier
2014-01-04  9:40                           ` Jan Djärv
2014-01-04 13:43                           ` martin rudalics
2014-01-04 20:40                             ` Stefan Monnier
2014-01-04  7:25                         ` Eli Zaretskii
2014-01-04  9:36                           ` Jan Djärv
2013-12-20 10:43     ` Eli Zaretskii
2019-08-09  7:55 ` Stefan Kangas
2019-08-09  8:57   ` Basil L. Contovounesios [this message]
2019-08-10 18:07     ` Stefan Kangas
2019-08-11 14:28       ` Basil L. Contovounesios
2019-08-12  0:52         ` Stefan Kangas
2019-09-30 13:26           ` Stefan Kangas
2019-09-30 13:55             ` Eli Zaretskii
2019-09-30 14:03             ` Robert Pluim
2019-09-30 14:11               ` Robert Pluim
2019-09-30 14:19                 ` Stefan Kangas
2019-09-30 21:51                   ` Stefan Kangas
2019-10-04 16:11                     ` Stefan Kangas
2019-08-09  9:00   ` martin rudalics
2019-08-10 18:23     ` Stefan Kangas
2019-08-11  8:17       ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r25ulnqh.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=16196@debbugs.gnu.org \
    --cc=jan.h.d@swipnet.se \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.