From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#16196: 24.3.50; Disable ding when scrolling Date: Fri, 09 Aug 2019 11:57:58 +0300 Message-ID: <87r25ulnqh.fsf@tcd.ie> References: <25C13650-058F-45CC-A961-D789709B1179@swipnet.se> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="121778"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: "16196@debbugs.gnu.org" <16196@debbugs.gnu.org>, Jan =?UTF-8?Q?Dj=C3=A4rv?= , Stefan Monnier To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 09 10:59:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hw0jt-000VXb-8Q for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Aug 2019 10:59:09 +0200 Original-Received: from localhost ([::1]:57412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hw0jr-0000RH-QY for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Aug 2019 04:59:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43220) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hw0jn-0000Qv-Ok for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 04:59:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hw0jm-0000m3-Nm for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 04:59:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33221) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hw0jm-0000lV-EF for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 04:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hw0jm-0006TX-4i for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 04:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Aug 2019 08:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16196 X-GNU-PR-Package: emacs Original-Received: via spool by 16196-submit@debbugs.gnu.org id=B16196.156534109124834 (code B ref 16196); Fri, 09 Aug 2019 08:59:02 +0000 Original-Received: (at 16196) by debbugs.gnu.org; 9 Aug 2019 08:58:11 +0000 Original-Received: from localhost ([127.0.0.1]:42042 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hw0iw-0006ST-Pc for submit@debbugs.gnu.org; Fri, 09 Aug 2019 04:58:11 -0400 Original-Received: from mail-wm1-f45.google.com ([209.85.128.45]:53360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hw0iu-0006SA-LH for 16196@debbugs.gnu.org; Fri, 09 Aug 2019 04:58:09 -0400 Original-Received: by mail-wm1-f45.google.com with SMTP id 10so4912024wmp.3 for <16196@debbugs.gnu.org>; Fri, 09 Aug 2019 01:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=cHITIisRSjk+p3qRYXWlaHFx9dPa5xVFDpoaPRKHd90=; b=MDmKMahuKAIhS/OspEk8QXs3gnBtJnIxvJ1wGWXkG1vK5YLbeSvY5KZ5oA+W3oq+Q+ fmgSORSyfVdZu5N6GqOHdHZoGmOLRztiXYQxKsFZ/UEsrAvKIpyJmlRDAACligBcucMD qwAMWRDO64PFPggjBAisxaKYRHFb2btWkW9J2rtM6UeJQjtFumijWisv0/EtQOSsDj1N 4+TKgwYdaPatltiabrXZengt6/qkwOu4tXwwTqIeoVPqp/T3pD1MmVb/ejXIcf9vJF78 IZgD1FFgwKUCRn0K1md2g0aL8S/LQ1C4VNdsFHlbWS0ZjrrWXXZC9v3fga36t0yjdlR2 IEgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=cHITIisRSjk+p3qRYXWlaHFx9dPa5xVFDpoaPRKHd90=; b=nU7sgTgI9I3trJ32brt6hqhVVpqNEHVhEdEfXQnGjtpI8IYhwxWPMw2hy88aWCnqDm c4U5AwP3DRBHO3BV5H3LIL/VutQE3Gf3Q9kfZCQewgCvURzKBrDNanTeD7njLCmreEQV L+SAVv8dkwVoUM+2xEOYShs0KjZonhQ7RZyBBXD+wTYtfspCjE4VQuRkBOQQ3hmUH2Dd 4dJQ36x38p/k+MeKT5Q0o4QPNFRd5eL76Pd7j+WRwfZcPW6Yx78YYxNbByoaBwmLW4FB OqnQL0Qf/BGA9H9/WOLsmA+fVhF53HEZ1ffTvdfLm3u9dz/YrPV4sV3U5JZrfKY1eOIy W6TQ== X-Gm-Message-State: APjAAAWl2nXHaBMUtuVPTlL4kq6JjZzJqXA7QzNilfg60+KyD237BjHt 74yuIMWjRfpsxlKd2c78QzwHMA== X-Google-Smtp-Source: APXvYqyf5p2TkgjT42Oi/i0vT4Jhd0SEo9brMSi64DyG+mKFxMWkOhep6v65aYNpeLytkgKjnXjrAg== X-Received: by 2002:a1c:3587:: with SMTP id c129mr9944434wma.90.1565341082621; Fri, 09 Aug 2019 01:58:02 -0700 (PDT) Original-Received: from localhost ([79.107.154.184]) by smtp.gmail.com with ESMTPSA id a64sm9249612wmf.1.2019.08.09.01.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2019 01:58:01 -0700 (PDT) In-Reply-To: (Stefan Kangas's message of "Fri, 9 Aug 2019 09:55:03 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164794 Archived-At: --=-=-= Content-Type: text/plain Stefan Kangas 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=mwheel.diff 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) --=-=-= Content-Type: text/plain Thanks, -- Basil --=-=-=--