* bug#16196: 24.3.50; Disable ding when scrolling @ 2013-12-20 6:08 Jan Djärv 2013-12-20 8:56 ` Eli Zaretskii 2019-08-09 7:55 ` Stefan Kangas 0 siblings, 2 replies; 36+ messages in thread From: Jan Djärv @ 2013-12-20 6:08 UTC (permalink / raw) To: 16196 Hello. When using a laptop with a trackpad, or a separate trackpad, scrolling in Emacs is annoying. The reason is that with a trackpad you "fling" the scrollbar up or down, with low precision. Trackbar scrolling isn't designed to be done with the seame precision as with a scrollbar. That means when Emacs hits top or bottom, it beeps a lot. If you have visual bell on, it blinks a lot. That is because Emacs beeps when you try to scroll up/down and you already are at the top/bottom. The same applies for scrolling left/right. I think Emacs should by default not beep at all when scrolling and no movement can be done. It should just ignore it and do nothing, like most applications do. At the very least there should be an option to turn off scrollrelated beeping. Jan D. In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00) of 2013-11-20 on zeplin Bzr revision: 115162 jan.h.d@swipnet.se-20131120183312-4v1zvxtg5vf1ez60 Windowing system distributor `Apple', version 10.3.1265 Configured using: `configure --verbose --with-ns CFLAGS=-g3' Important settings: value of $LC_COLLATE: C value of $LANG: sv_SE.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: <escape> x r e p o r t - e m <tab> <return> Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process cocoa ns multi-tty emacs) ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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 2019-08-09 7:55 ` Stefan Kangas 1 sibling, 1 reply; 36+ messages in thread From: Eli Zaretskii @ 2013-12-20 8:56 UTC (permalink / raw) To: Jan Djärv; +Cc: 16196 > From: Jan Djärv <jan.h.d@swipnet.se> > Date: Fri, 20 Dec 2013 07:08:37 +0100 > > I think Emacs should by default not beep at all when scrolling and no movement can be done. This could be hard to implement. Most scrolling commands just examine the text around point, and set the window-start for the next redisplay, so they don't really know when no movement can be done. Thus, the exact conditions for bitching "End of buffer" are not at all what you could imagine, and not easily correlated with the situation you describe. For example, the next-line and previous-line commands signal these errors when they find they are unable to scroll text, something that might be utterly unrelated to hitting end of buffer. > It should just ignore it and do nothing, like most applications do. Well, "do nothing" is something Emacs cannot easily do in this case, since the part that "does nothing" is redisplay, which has no idea about the scrolling command that just ran. > At the very least there should be an option to turn off scrollrelated beeping. This should be much easier to implement, although you may be surprised to see in how many places we throw that particular error. (Hint: grep the Lisp sources for "'end-of-file".) Patches are welcome, as usual. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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:43 ` Eli Zaretskii 0 siblings, 2 replies; 36+ messages in thread From: Jan Djärv @ 2013-12-20 10:26 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 16196@debbugs.gnu.org Hello. 20 dec 2013 kl. 09:56 skrev Eli Zaretskii <eliz@gnu.org>: >> From: Jan Djärv <jan.h.d@swipnet.se> >> Date: Fri, 20 Dec 2013 07:08:37 +0100 >> >> I think Emacs should by default not beep at all when scrolling and no movement can be done. > > This could be hard to implement. Most scrolling commands just examine > the text around point, and set the window-start for the next > redisplay, so they don't really know when no movement can be done. > Thus, the exact conditions for bitching "End of buffer" are not at all > what you could imagine, and not easily correlated with the situation > you describe. For example, the next-line and previous-line commands > signal these errors when they find they are unable to scroll text, > something that might be utterly unrelated to hitting end of buffer. I have in my .emacs: (setq mwheel-scroll-up-function '(lambda (amt) (if (< (window-end) (point-max)) (scroll-up amt)))) (setq mwheel-scroll-down-function '(lambda (amt) (if (> (window-start) (point-min)) (scroll-down amt)))) This does what this bug report talks about, except in the horizontal direction. So it can't be that hard. Jan D. > >> It should just ignore it and do nothing, like most applications do. > > Well, "do nothing" is something Emacs cannot easily do in this case, > since the part that "does nothing" is redisplay, which has no idea > about the scrolling command that just ran. > >> At the very least there should be an option to turn off scrollrelated beeping. > > This should be much easier to implement, although you may be surprised > to see in how many places we throw that particular error. (Hint: grep > the Lisp sources for "'end-of-file".) > > Patches are welcome, as usual. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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 10:43 ` Eli Zaretskii 1 sibling, 1 reply; 36+ messages in thread From: Jan Djärv @ 2013-12-20 10:32 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 16196@debbugs.gnu.org Hello. > 20 dec 2013 kl. 11:26 skrev Jan Djärv <jan.h.d@swipnet.se>: > > Hello. > > 20 dec 2013 kl. 09:56 skrev Eli Zaretskii <eliz@gnu.org>: > >>> From: Jan Djärv <jan.h.d@swipnet.se> >>> Date: Fri, 20 Dec 2013 07:08:37 +0100 >>> >>> I think Emacs should by default not beep at all when scrolling and no movement can be done. >> >> This could be hard to implement. Most scrolling commands just examine >> the text around point, and set the window-start for the next >> redisplay, so they don't really know when no movement can be done. >> Thus, the exact conditions for bitching "End of buffer" are not at all >> what you could imagine, and not easily correlated with the situation >> you describe. For example, the next-line and previous-line commands >> signal these errors when they find they are unable to scroll text, >> something that might be utterly unrelated to hitting end of buffer. > > I have in my .emacs: > > (setq mwheel-scroll-up-function > '(lambda (amt) > (if (< (window-end) (point-max)) (scroll-up amt)))) > > (setq mwheel-scroll-down-function > '(lambda (amt) > (if (> (window-start) (point-min)) (scroll-down amt)))) > > This does what this bug report talks about, except in the horizontal direction. So it can't be that hard. On the C level I think it is a matter of not calling xsignal0 in window_scroll_(line|pixel)_based in window.c. Jan D. > >> >>> It should just ignore it and do nothing, like most applications do. >> >> Well, "do nothing" is something Emacs cannot easily do in this case, >> since the part that "does nothing" is redisplay, which has no idea >> about the scrolling command that just ran. >> >>> At the very least there should be an option to turn off scrollrelated beeping. >> >> This should be much easier to implement, although you may be surprised >> to see in how many places we throw that particular error. (Hint: grep >> the Lisp sources for "'end-of-file".) >> >> Patches are welcome, as usual. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-20 10:32 ` Jan Djärv @ 2013-12-20 10:48 ` Eli Zaretskii 2013-12-20 17:52 ` Jan Djärv 0 siblings, 1 reply; 36+ messages in thread From: Eli Zaretskii @ 2013-12-20 10:48 UTC (permalink / raw) To: Jan Djärv; +Cc: 16196 > Cc: "16196@debbugs.gnu.org" <16196@debbugs.gnu.org> > From: Jan Djärv <jan.h.d@swipnet.se> > Date: Fri, 20 Dec 2013 11:32:40 +0100 > > On the C level I think it is a matter of not calling xsignal0 in window_scroll_(line|pixel)_based in window.c. Depends on the scope of the proposed change, as I wrote earlier. Grep lisp/*.el for "(signal .* 'end-of-buffer" to see how many places throw this error. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-20 10:48 ` Eli Zaretskii @ 2013-12-20 17:52 ` Jan Djärv 2013-12-20 18:10 ` Eli Zaretskii 0 siblings, 1 reply; 36+ messages in thread From: Jan Djärv @ 2013-12-20 17:52 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 16196 Hello. 20 dec 2013 kl. 11:48 skrev Eli Zaretskii <eliz@gnu.org>: >> Cc: "16196@debbugs.gnu.org" <16196@debbugs.gnu.org> >> From: Jan Djärv <jan.h.d@swipnet.se> >> Date: Fri, 20 Dec 2013 11:32:40 +0100 >> >> On the C level I think it is a matter of not calling xsignal0 in window_scroll_(line|pixel)_based in window.c. > > Depends on the scope of the proposed change, as I wrote earlier. > Grep lisp/*.el for "(signal .* 'end-of-buffer" to see how many places > throw this error. 11 hits, 6 in simple.el. 17/10 if we include beginning-of-buffer. About half is kill-related and does not involve scrolling. Does not sound many to me. But I would settle for no beep for WHEEL events. I'd prefer no beep at all though. Jan D. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-20 17:52 ` Jan Djärv @ 2013-12-20 18:10 ` Eli Zaretskii 2013-12-20 18:48 ` Jan Djärv 0 siblings, 1 reply; 36+ messages in thread From: Eli Zaretskii @ 2013-12-20 18:10 UTC (permalink / raw) To: Jan Djärv; +Cc: 16196 > From: Jan Djärv <jan.h.d@swipnet.se> > Date: Fri, 20 Dec 2013 18:52:27 +0100 > Cc: 16196@debbugs.gnu.org > > 11 hits, 6 in simple.el. 17/10 if we include beginning-of-buffer. About half is kill-related and does not involve scrolling. Does not sound many to me. There are a couple in C as well. But the main problem would be to understand which ones belong to what use cases. > But I would settle for no beep for WHEEL events. I'd prefer no beep at all though. What, never? Not even if you hit the beginning or end by moving cursor or by C-v/M-v? That'd be a serious change of behavior, so it should be discussed and/or users polled before we do that, I think. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-20 18:10 ` Eli Zaretskii @ 2013-12-20 18:48 ` Jan Djärv 2013-12-20 20:35 ` Eli Zaretskii 0 siblings, 1 reply; 36+ messages in thread From: Jan Djärv @ 2013-12-20 18:48 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 16196 Hello. 20 dec 2013 kl. 19:10 skrev Eli Zaretskii <eliz@gnu.org>: >> From: Jan Djärv <jan.h.d@swipnet.se> >> Date: Fri, 20 Dec 2013 18:52:27 +0100 >> Cc: 16196@debbugs.gnu.org >> >> 11 hits, 6 in simple.el. 17/10 if we include beginning-of-buffer. About half is kill-related and does not involve scrolling. Does not sound many to me. > > There are a couple in C as well. But the main problem would be to > understand which ones belong to what use cases. > >> But I would settle for no beep for WHEEL events. I'd prefer no beep at all though. > > What, never? Not even if you hit the beginning or end by moving > cursor or by C-v/M-v? Yes never. I always though the beeping to be a bit out of this world: "Where do you want to be?" "At the end of the buffer." "You are at the end of the buffer." "Fine!" "Not at all, it is an error to be where you want to be." "??" > That'd be a serious change of behavior, so it > should be discussed and/or users polled before we do that, I think. Best make it an option then. Does not require polling. Jan D. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-20 18:48 ` Jan Djärv @ 2013-12-20 20:35 ` Eli Zaretskii 2013-12-23 2:46 ` Stefan Monnier 0 siblings, 1 reply; 36+ messages in thread From: Eli Zaretskii @ 2013-12-20 20:35 UTC (permalink / raw) To: Jan Djärv; +Cc: 16196 > From: Jan Djärv <jan.h.d@swipnet.se> > Date: Fri, 20 Dec 2013 19:48:57 +0100 > Cc: 16196@debbugs.gnu.org > > > That'd be a serious change of behavior, so it > > should be discussed and/or users polled before we do that, I think. > > Best make it an option then. Does not require polling. I don't think an option will raise any objections. Patches welcome. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-20 20:35 ` Eli Zaretskii @ 2013-12-23 2:46 ` Stefan Monnier 2013-12-23 10:44 ` Jan Djärv 0 siblings, 1 reply; 36+ messages in thread From: Stefan Monnier @ 2013-12-23 2:46 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 16196 >> > That'd be a serious change of behavior, so it >> > should be discussed and/or users polled before we do that, I think. >> Best make it an option then. Does not require polling. > I don't think an option will raise any objections. Patches welcome. Can be seen as a generalization of scroll-error-top-bottom. I'm not opposed to such an option, but I'm not convinced that changing the default behavior is a good idea: the general design of Emacs is that we strive to make every command perform *something*, so when the user's request ends up doing nothing, we signal an error to make it clear that Emacs did obey the request. Otherwise the lack of feedback can make the user feel like Emacs is unresponsive. Stefan ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-23 2:46 ` Stefan Monnier @ 2013-12-23 10:44 ` Jan Djärv 2014-01-03 22:57 ` Stefan Monnier 0 siblings, 1 reply; 36+ messages in thread From: Jan Djärv @ 2013-12-23 10:44 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16196 Hello. 23 dec 2013 kl. 03:46 skrev Stefan Monnier <monnier@iro.umontreal.ca>: >>>> That'd be a serious change of behavior, so it >>>> should be discussed and/or users polled before we do that, I think. >>> Best make it an option then. Does not require polling. >> I don't think an option will raise any objections. Patches welcome. > > Can be seen as a generalization of scroll-error-top-bottom. > > I'm not opposed to such an option, but I'm not convinced that changing > the default behavior is a good idea: the general design of Emacs is that > we strive to make every command perform *something*, so when the user's > request ends up doing nothing, we signal an error to make it clear that > Emacs did obey the request. Otherwise the lack of feedback can make the > user feel like Emacs is unresponsive. The main use case here is "flinging" with a trackpad. In that case, Emacs already responds by scrolling up/down to the top/bottom. It is after Emacs has hit top/bottom that the "extra" beeps occur. If already at the top/bottom, the normal thing for OSX apps is to "bounce" a bit to show that the display is already at the top/bottom. If at the top, the whole page is moved a bit downwards and then bounces back. This is not common in X, so not really appropriate for Emacs. Jan D. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-23 10:44 ` Jan Djärv @ 2014-01-03 22:57 ` Stefan Monnier 2014-01-03 23:46 ` Jan Djärv 0 siblings, 1 reply; 36+ messages in thread From: Stefan Monnier @ 2014-01-03 22:57 UTC (permalink / raw) To: Jan Djärv; +Cc: 16196 >> I'm not opposed to such an option, but I'm not convinced that changing >> the default behavior is a good idea: the general design of Emacs is that >> we strive to make every command perform *something*, so when the user's >> request ends up doing nothing, we signal an error to make it clear that >> Emacs did obey the request. Otherwise the lack of feedback can make the >> user feel like Emacs is unresponsive. > The main use case here is "flinging" with a trackpad. In that case, Emacs > already responds by scrolling up/down to the top/bottom. It is after Emacs > has hit top/bottom that the "extra" beeps occur. But if you're at EOB and you scroll with the wheel to try and go "even further", if Emacs doesn't (ding), then it does nothing: lack of feedback. > If already at the top/bottom, the normal thing for OSX apps is to > "bounce" a bit to show that the display is already at the top/bottom. If at > the top, the whole page is moved a bit downwards and then bounces back. > This is not common in X, so not really appropriate for Emacs. Right, instead we (ding). Stefan ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2014-01-03 22:57 ` Stefan Monnier @ 2014-01-03 23:46 ` Jan Djärv 2014-01-04 0:03 ` Drew Adams ` (2 more replies) 0 siblings, 3 replies; 36+ messages in thread From: Jan Djärv @ 2014-01-03 23:46 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16196@debbugs.gnu.org Hello. 3 jan 2014 kl. 23:57 skrev Stefan Monnier <monnier@iro.umontreal.ca>: >>> I'm not opposed to such an option, but I'm not convinced that changing >>> the default behavior is a good idea: the general design of Emacs is that >>> we strive to make every command perform *something*, so when the user's >>> request ends up doing nothing, we signal an error to make it clear that >>> Emacs did obey the request. Otherwise the lack of feedback can make the >>> user feel like Emacs is unresponsive. >> The main use case here is "flinging" with a trackpad. In that case, Emacs >> already responds by scrolling up/down to the top/bottom. It is after Emacs >> has hit top/bottom that the "extra" beeps occur. > > But if you're at EOB and you scroll with the wheel to try and go "even > further", if Emacs doesn't (ding), then it does nothing: lack of feedback. > Which is useless IMHO. Ding implies an error, this isn't one. I want to be at EOB and I am at EOB. >> If already at the top/bottom, the normal thing for OSX apps is to >> "bounce" a bit to show that the display is already at the top/bottom. If at >> the top, the whole page is moved a bit downwards and then bounces back. >> This is not common in X, so not really appropriate for Emacs. > > Right, instead we (ding). If it was only one ding, one might be able to stand it even if it is just annoying and gives no value whatsoever. But with flinging the beeping goes on for several seconds, depending on the force of the fling. I rather have a silent lack of feedback than a lot of beeping. Jan D. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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 7:25 ` Eli Zaretskii 2 siblings, 0 replies; 36+ messages in thread From: Drew Adams @ 2014-01-04 0:03 UTC (permalink / raw) To: Jan Djärv, Stefan Monnier; +Cc: 16196 > Ding implies an error No, it does not. Read its doc. And read about particular uses of it, in the Elisp manual. Each explicit mention of a use makes clear that it is NOT about signaling an error. Node `Key Lookup': "it rings the bell (by calling `ding') but does not signal an error." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Node `Functions for Key Lookup': "It calls `ding', but does not cause an error." ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Node `Beeping' tells you clearly what `ding' *is* for: "to attract the user's attention." It also makes clear that one does not want to overuse it: attracting the user's attention too much defeats the purpose and can be annoying. > I rather have a silent lack of feedback than a lot of beeping. Bind `ring-bell-function' wherever you like to whatever you like, including to `ignore'. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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 7:25 ` Eli Zaretskii 2 siblings, 2 replies; 36+ messages in thread From: Stefan Monnier @ 2014-01-04 5:07 UTC (permalink / raw) To: Jan Djärv; +Cc: 16196@debbugs.gnu.org >> But if you're at EOB and you scroll with the wheel to try and go "even >> further", if Emacs doesn't (ding), then it does nothing: lack of feedback. > Which is useless IMHO. Ding implies an error, this isn't one. I want > to be at EOB and I am at EOB. Useless or not, the point is: without (ding) this would make the command do absolutely nothing, which is contrary to the principle that Emacs should try to provide some feedback in response to each command. > I rather have a silent lack of feedback than a lot of beeping. If you use the audible bell, the beeping might indeed be a pain in the ear (tho I can't really judge: I find the audible bell itself to be unbearable so I've used the visual bell for as long as I can remember). So the question is: which kind of feedback should we use instead? I'd rather keep some kind of feedback. Maybe a `message'? Stefan ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2014-01-04 5:07 ` Stefan Monnier @ 2014-01-04 9:40 ` Jan Djärv 2014-01-04 13:43 ` martin rudalics 1 sibling, 0 replies; 36+ messages in thread From: Jan Djärv @ 2014-01-04 9:40 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16196@debbugs.gnu.org Hello. 4 jan 2014 kl. 06:07 skrev Stefan Monnier <monnier@iro.umontreal.ca>: > >> I rather have a silent lack of feedback than a lot of beeping. > > If you use the audible bell, the beeping might indeed be a pain in the > ear (tho I can't really judge: I find the audible bell itself to be > unbearable so I've used the visual bell for as long as I can remember). Visual bell is actually worse. A beep is fast, a visual blink lasts longer, so the time blinking is longer than the time beeping. > So the question is: which kind of feedback should we use instead? > I'd rather keep some kind of feedback. Maybe a `message'? That sounds like a good idea. Jan D. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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 1 sibling, 1 reply; 36+ messages in thread From: martin rudalics @ 2014-01-04 13:43 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16196@debbugs.gnu.org > So the question is: which kind of feedback should we use instead? > I'd rather keep some kind of feedback. Maybe a `message'? As we do already. Just suppress the additional beep. martin, sharing Jan's concerns ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2014-01-04 13:43 ` martin rudalics @ 2014-01-04 20:40 ` Stefan Monnier 0 siblings, 0 replies; 36+ messages in thread From: Stefan Monnier @ 2014-01-04 20:40 UTC (permalink / raw) To: martin rudalics; +Cc: 16196@debbugs.gnu.org >> So the question is: which kind of feedback should we use instead? >> I'd rather keep some kind of feedback. Maybe a `message'? > As we do already. Indeed! I didn't notice it because the (ding) drowns it out. > Just suppress the additional beep. Sounds OK. Can someone provide a patch to mwheel.el? Stefan ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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 7:25 ` Eli Zaretskii 2014-01-04 9:36 ` Jan Djärv 2 siblings, 1 reply; 36+ messages in thread From: Eli Zaretskii @ 2014-01-04 7:25 UTC (permalink / raw) To: Jan Djärv; +Cc: 16196 > Cc: Eli Zaretskii <eliz@gnu.org>, > "16196@debbugs.gnu.org" <16196@debbugs.gnu.org> > From: Jan Djärv <jan.h.d@swipnet.se> > Date: Sat, 4 Jan 2014 00:46:32 +0100 > > with flinging the beeping goes on for several seconds, depending on the force of the fling. Are you saying that ding is called several times in a row? Perhaps we could avoid this specific situation (we already have mechanism in place for changing behavior when certain commands are invoked several times in a row). ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2014-01-04 7:25 ` Eli Zaretskii @ 2014-01-04 9:36 ` Jan Djärv 0 siblings, 0 replies; 36+ messages in thread From: Jan Djärv @ 2014-01-04 9:36 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 16196 Hello. 4 jan 2014 kl. 08:25 skrev Eli Zaretskii <eliz@gnu.org>: >> Cc: Eli Zaretskii <eliz@gnu.org>, >> "16196@debbugs.gnu.org" <16196@debbugs.gnu.org> >> From: Jan Djärv <jan.h.d@swipnet.se> >> Date: Sat, 4 Jan 2014 00:46:32 +0100 >> >> with flinging the beeping goes on for several seconds, depending on the force of the fling. > > Are you saying that ding is called several times in a row? Perhaps we > could avoid this specific situation (we already have mechanism in > place for changing behavior when certain commands are invoked several > times in a row). Yes. Here is C-h l after a normal fling. Each wheel-down results in a beep: <wheel-down> <double-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> C-h l Maybe double and triple could be ignored? Visual bell is worse in this use case than the beep, as each blink takes longer time than a beep. Jan D. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-20 10:26 ` Jan Djärv 2013-12-20 10:32 ` Jan Djärv @ 2013-12-20 10:43 ` Eli Zaretskii 1 sibling, 0 replies; 36+ messages in thread From: Eli Zaretskii @ 2013-12-20 10:43 UTC (permalink / raw) To: Jan Djärv; +Cc: 16196 > Cc: "16196@debbugs.gnu.org" <16196@debbugs.gnu.org> > From: Jan Djärv <jan.h.d@swipnet.se> > Date: Fri, 20 Dec 2013 11:26:18 +0100 > > (setq mwheel-scroll-up-function > '(lambda (amt) > (if (< (window-end) (point-max)) (scroll-up amt)))) > > (setq mwheel-scroll-down-function > '(lambda (amt) > (if (> (window-start) (point-min)) (scroll-down amt)))) > > This does what this bug report talks about, except in the horizontal direction. So it can't be that hard. Did you try that when the beginning or the end of the buffer is a large image, or a line with a font so large it doesn't fit in the window? In any case, if the issue is limited to wheel scrolling, it might indeed be simpler. I thought you were suggesting to disable the error for any type of scrolling, not just by the mouse wheel. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2013-12-20 6:08 bug#16196: 24.3.50; Disable ding when scrolling Jan Djärv 2013-12-20 8:56 ` Eli Zaretskii @ 2019-08-09 7:55 ` Stefan Kangas 2019-08-09 8:57 ` Basil L. Contovounesios 2019-08-09 9:00 ` martin rudalics 1 sibling, 2 replies; 36+ messages in thread From: Stefan Kangas @ 2019-08-09 7:55 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16196@debbugs.gnu.org, Jan Djärv [-- Attachment #1: Type: text/plain, Size: 654 bytes --] Stefan Monnier <monnier@iro.umontreal.ca> writes: >>> So the question is: which kind of feedback should we use instead? >>> I'd rather keep some kind of feedback. Maybe a `message'? >> As we do already. > > Indeed! I didn't notice it because the (ding) drowns it out. > >> Just suppress the additional beep. > > Sounds OK. Can someone provide a patch to mwheel.el? I took a stab at this. The attached patch traps the beginning-of-buffer and end-of-buffer errors and shows a message instead as suggested above. To make it easier to review, I've also included a git diff ignoring whitespace changes. What do you think? Best regards, Stefan Kangas [-- Attachment #2: 0001-Make-mouse-scroll-show-a-message-instead-of-dinging-.patch --] [-- Type: application/octet-stream, Size: 11941 bytes --] From b96a34adce2c494f02656b2ee81942fc9216b294 Mon Sep 17 00:00:00 2001 From: Stefan Kangas <stefankangas@gmail.com> Date: Fri, 9 Aug 2019 09:39:16 +0200 Subject: [PATCH] Make mouse scroll show a message instead of dinging at buffer limits * lisp/mwheel.el (mwheel-scroll): Show a message instead of dinging at end of buffer and beginning of buffer. This should be less intrusive, especially when using a trackpad. (Bug#16196) --- lisp/mwheel.el | 196 +++++++++++++++++++++++++------------------------ 1 file changed, 102 insertions(+), 94 deletions(-) diff --git a/lisp/mwheel.el b/lisp/mwheel.el index dfea55374b..34e4668b5a 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -208,100 +208,108 @@ mwheel-scroll This should be bound only to mouse buttons 4, 5, 6, and 7 on non-Windows systems." (interactive (list last-input-event)) - (let* ((selected-window (selected-window)) - (scroll-window - (or (catch 'found - (let* ((window (if mouse-wheel-follow-mouse - (mwheel-event-window event) - (selected-window))) - (frame (when (window-live-p window) - (frame-parameter - (window-frame window) 'mouse-wheel-frame)))) - (when (frame-live-p frame) - (let* ((pos (mouse-absolute-pixel-position)) - (pos-x (car pos)) - (pos-y (cdr pos))) - (walk-window-tree - (lambda (window-1) - (let ((edges (window-edges window-1 nil t t))) - (when (and (<= (nth 0 edges) pos-x) - (<= pos-x (nth 2 edges)) - (<= (nth 1 edges) pos-y) - (<= pos-y (nth 3 edges))) - (throw 'found window-1)))) - frame nil t))))) - (mwheel-event-window event))) - (old-point - (and (eq scroll-window selected-window) - (eq (car-safe transient-mark-mode) 'only) - (window-point))) - (mods - (delq 'click (delq 'double (delq 'triple (event-modifiers event))))) - (amt (assoc mods mouse-wheel-scroll-amount))) - (unless (eq scroll-window selected-window) - ;; Mark window to be scrolled for redisplay. - (select-window scroll-window 'mark-for-redisplay)) - ;; Extract the actual amount or find the element that has no modifiers. - (if amt (setq amt (cdr amt)) - (let ((list-elt mouse-wheel-scroll-amount)) - (while (consp (setq amt (pop list-elt)))))) - (if (floatp amt) (setq amt (1+ (truncate (* amt (window-height)))))) - (when (and mouse-wheel-progressive-speed (numberp amt)) - ;; When the double-mouse-N comes in, a mouse-N has been executed already, - ;; 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)))) - (unwind-protect - (let ((button (mwheel-event-button event))) - (cond ((eq button mouse-wheel-down-event) - (condition-case nil (funcall mwheel-scroll-down-function amt) - ;; Make sure we do indeed scroll to the beginning of - ;; the buffer. - (beginning-of-buffer - (unwind-protect - (funcall mwheel-scroll-down-function) - ;; If the first scroll succeeded, then some scrolling - ;; is possible: keep scrolling til the beginning but - ;; do not signal an error. For some reason, we have - ;; to do it even if the first scroll signaled an - ;; error, because otherwise the window is recentered - ;; for a reason that escapes me. This problem seems - ;; to only affect scroll-down. --Stef - (set-window-start (selected-window) (point-min)))))) - ((eq button mouse-wheel-up-event) - (condition-case nil (funcall mwheel-scroll-up-function amt) - ;; Make sure we do indeed scroll to the end of the buffer. - (end-of-buffer (while t (funcall mwheel-scroll-up-function))))) - ((eq button mouse-wheel-left-event) ; for tilt scroll - (when mouse-wheel-tilt-scroll - (funcall (if mouse-wheel-flip-direction - mwheel-scroll-right-function - mwheel-scroll-left-function) amt))) - ((eq button mouse-wheel-right-event) ; for tilt scroll - (when mouse-wheel-tilt-scroll - (funcall (if mouse-wheel-flip-direction - mwheel-scroll-left-function - mwheel-scroll-right-function) amt))) - (t (error "Bad binding in mwheel-scroll")))) - (if (eq scroll-window selected-window) - ;; If there is a temporarily active region, deactivate it if - ;; scrolling moved point. - (when (and old-point (/= old-point (window-point))) - ;; Call `deactivate-mark' at the original position, so that - ;; the original region is saved to the X selection. - (let ((new-point (window-point))) - (goto-char old-point) - (deactivate-mark) - (goto-char new-point))) - (select-window selected-window t)))) - - (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time) - (if mwheel-inhibit-click-event-timer - (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)))) + (let (saw-error) + (let* ((selected-window (selected-window)) + (scroll-window + (or (catch 'found + (let* ((window (if mouse-wheel-follow-mouse + (mwheel-event-window event) + (selected-window))) + (frame (when (window-live-p window) + (frame-parameter + (window-frame window) 'mouse-wheel-frame)))) + (when (frame-live-p frame) + (let* ((pos (mouse-absolute-pixel-position)) + (pos-x (car pos)) + (pos-y (cdr pos))) + (walk-window-tree + (lambda (window-1) + (let ((edges (window-edges window-1 nil t t))) + (when (and (<= (nth 0 edges) pos-x) + (<= pos-x (nth 2 edges)) + (<= (nth 1 edges) pos-y) + (<= pos-y (nth 3 edges))) + (throw 'found window-1)))) + frame nil t))))) + (mwheel-event-window event))) + (old-point + (and (eq scroll-window selected-window) + (eq (car-safe transient-mark-mode) 'only) + (window-point))) + (mods + (delq 'click (delq 'double (delq 'triple (event-modifiers event))))) + (amt (assoc mods mouse-wheel-scroll-amount))) + (unless (eq scroll-window selected-window) + ;; Mark window to be scrolled for redisplay. + (select-window scroll-window 'mark-for-redisplay)) + ;; Extract the actual amount or find the element that has no modifiers. + (if amt (setq amt (cdr amt)) + (let ((list-elt mouse-wheel-scroll-amount)) + (while (consp (setq amt (pop list-elt)))))) + (if (floatp amt) (setq amt (1+ (truncate (* amt (window-height)))))) + (when (and mouse-wheel-progressive-speed (numberp amt)) + ;; When the double-mouse-N comes in, a mouse-N has been executed already, + ;; 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) + (condition-case nil (funcall mwheel-scroll-down-function amt) + ;; Make sure we do indeed scroll to the beginning of + ;; the buffer. + (beginning-of-buffer + (unwind-protect + (funcall mwheel-scroll-down-function) + ;; If the first scroll succeeded, then some scrolling + ;; is possible: keep scrolling til the beginning but + ;; do not signal an error. For some reason, we have + ;; to do it even if the first scroll signaled an + ;; error, because otherwise the window is recentered + ;; for a reason that escapes me. This problem seems + ;; to only affect scroll-down. --Stef + (set-window-start (selected-window) (point-min)))))) + ((eq button mouse-wheel-up-event) + (condition-case nil (funcall mwheel-scroll-up-function amt) + ;; Make sure we do indeed scroll to the end of the buffer. + (end-of-buffer (while t (funcall mwheel-scroll-up-function))))) + ((eq button mouse-wheel-left-event) ; for tilt scroll + (when mouse-wheel-tilt-scroll + (funcall (if mouse-wheel-flip-direction + mwheel-scroll-right-function + mwheel-scroll-left-function) amt))) + ((eq button mouse-wheel-right-event) ; for tilt scroll + (when mouse-wheel-tilt-scroll + (funcall (if mouse-wheel-flip-direction + mwheel-scroll-left-function + mwheel-scroll-right-function) amt))) + (t (error "Bad binding in mwheel-scroll")))) + (if (eq scroll-window selected-window) + ;; If there is a temporarily active region, deactivate it if + ;; scrolling moved point. + (when (and old-point (/= old-point (window-point))) + ;; Call `deactivate-mark' at the original position, so that + ;; the original region is saved to the X selection. + (let ((new-point (window-point))) + (goto-char old-point) + (deactivate-mark) + (goto-char new-point))) + (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 (not saw-error) + mouse-wheel-click-event mouse-wheel-inhibit-click-time) + (if mwheel-inhibit-click-event-timer + (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))))) (put 'mwheel-scroll 'scroll-command t) -- 2.22.0 [-- Attachment #3: bug-16196-no-ws.diff --] [-- Type: application/octet-stream, Size: 1914 bytes --] diff --git a/lisp/mwheel.el b/lisp/mwheel.el index dfea55374b..34e4668b5a 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -208,6 +208,7 @@ mwheel-scroll This should be bound only to mouse buttons 4, 5, 6, and 7 on non-Windows systems." (interactive (list last-input-event)) + (let (saw-error) (let* ((selected-window (selected-window)) (scroll-window (or (catch 'found @@ -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)))) - - (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time) + (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 (not saw-error) + mouse-wheel-click-event mouse-wheel-inhibit-click-time) (if mwheel-inhibit-click-event-timer (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) ^ permalink raw reply related [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-08-09 7:55 ` Stefan Kangas @ 2019-08-09 8:57 ` Basil L. Contovounesios 2019-08-10 18:07 ` Stefan Kangas 2019-08-09 9:00 ` martin rudalics 1 sibling, 1 reply; 36+ messages in thread From: Basil L. Contovounesios @ 2019-08-09 8:57 UTC (permalink / raw) To: Stefan Kangas; +Cc: 16196@debbugs.gnu.org, Jan Djärv, Stefan Monnier [-- 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 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-08-09 8:57 ` Basil L. Contovounesios @ 2019-08-10 18:07 ` Stefan Kangas 2019-08-11 14:28 ` Basil L. Contovounesios 0 siblings, 1 reply; 36+ messages in thread From: Stefan Kangas @ 2019-08-10 18:07 UTC (permalink / raw) To: Basil L. Contovounesios Cc: 16196@debbugs.gnu.org, Jan Djärv, Stefan Monnier Basil L. Contovounesios <contovob@tcd.ie> writes: > FWIW, you can slightly reduce the amount of code that needs reindenting > by binding saw-error in the existing let* form: Sure, I could've done that, but I was worried that moving the final sexp in that defun into the let* form would cause a regression. It might have been left outside for a purpose. (Or it could just be that it didn't need to be in the let* form before.) Are you saying that you know that it's safe to move it? Thanks, Stefan Kangas ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-08-10 18:07 ` Stefan Kangas @ 2019-08-11 14:28 ` Basil L. Contovounesios 2019-08-12 0:52 ` Stefan Kangas 0 siblings, 1 reply; 36+ messages in thread From: Basil L. Contovounesios @ 2019-08-11 14:28 UTC (permalink / raw) To: Stefan Kangas; +Cc: 16196@debbugs.gnu.org, Jan Djärv, Stefan Monnier Stefan Kangas <stefan@marxist.se> writes: > Basil L. Contovounesios <contovob@tcd.ie> writes: >> FWIW, you can slightly reduce the amount of code that needs reindenting >> by binding saw-error in the existing let* form: > > Sure, I could've done that, but I was worried that moving the final sexp in that > defun into the let* form would cause a regression. It might have been left > outside for a purpose. (Or it could just be that it didn't need to be in the > let* form before.) It looks like the latter: Avoid accidental yanking of text while scrolling with the mouse wheel. d09696f73f 2002-11-28 23:03:30 +0000 https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d09696f73f17c4ae0bf09e8c72ef7f427f07d31b > Are you saying that you know that it's safe to move it? Inasmuch as I can "know" something about a code fragment from just looking at it, yes. Note that this does not mean I am urging you to move it; I merely suggested it as a stylistic alternative or tip, "FWIW". Thanks, -- Basil ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-08-11 14:28 ` Basil L. Contovounesios @ 2019-08-12 0:52 ` Stefan Kangas 2019-09-30 13:26 ` Stefan Kangas 0 siblings, 1 reply; 36+ messages in thread From: Stefan Kangas @ 2019-08-12 0:52 UTC (permalink / raw) To: Basil L. Contovounesios Cc: 16196@debbugs.gnu.org, Jan Djärv, Stefan Monnier [-- Attachment #1: Type: text/plain, Size: 1036 bytes --] Basil L. Contovounesios <contovob@tcd.ie> writes: > > Sure, I could've done that, but I was worried that moving the final sexp in that > > defun into the let* form would cause a regression. It might have been left > > outside for a purpose. (Or it could just be that it didn't need to be in the > > let* form before.) > > It looks like the latter: > > Avoid accidental yanking of text while scrolling with the mouse wheel. > d09696f73f 2002-11-28 23:03:30 +0000 > https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d09696f73f17c4ae0bf09e8c72ef7f427f07d31b > > > Are you saying that you know that it's safe to move it? > > Inasmuch as I can "know" something about a code fragment from just > looking at it, yes. Note that this does not mean I am urging you to > move it; I merely suggested it as a stylistic alternative or tip, > "FWIW". Thanks, I appreciate the help. I agree that it's a good idea, and it seems to work fine here. Please find attached an updated patch with that change included. Best regards, Stefan Kangas [-- Attachment #2: 0001-Make-mouse-scroll-show-a-message-instead-of-dinging-.patch --] [-- Type: application/octet-stream, Size: 7647 bytes --] From 4374112182c25cfec09ccbd2e593adc0bea07aa8 Mon Sep 17 00:00:00 2001 From: Stefan Kangas <stefankangas@gmail.com> Date: Fri, 9 Aug 2019 09:39:16 +0200 Subject: [PATCH] Make mouse scroll show a message instead of dinging at buffer limits * lisp/mwheel.el (mwheel-scroll): Show a message instead of dinging at end of buffer and beginning of buffer. This should be less intrusive, especially when using a trackpad. (Bug#16196) --- lisp/mwheel.el | 112 ++++++++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 52 deletions(-) diff --git a/lisp/mwheel.el b/lisp/mwheel.el index dfea55374b..505d5fa3f5 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,57 +252,64 @@ 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)))) - (unwind-protect - (let ((button (mwheel-event-button event))) - (cond ((eq button mouse-wheel-down-event) - (condition-case nil (funcall mwheel-scroll-down-function amt) - ;; Make sure we do indeed scroll to the beginning of - ;; the buffer. - (beginning-of-buffer - (unwind-protect - (funcall mwheel-scroll-down-function) - ;; If the first scroll succeeded, then some scrolling - ;; is possible: keep scrolling til the beginning but - ;; do not signal an error. For some reason, we have - ;; to do it even if the first scroll signaled an - ;; error, because otherwise the window is recentered - ;; for a reason that escapes me. This problem seems - ;; to only affect scroll-down. --Stef - (set-window-start (selected-window) (point-min)))))) - ((eq button mouse-wheel-up-event) - (condition-case nil (funcall mwheel-scroll-up-function amt) - ;; Make sure we do indeed scroll to the end of the buffer. - (end-of-buffer (while t (funcall mwheel-scroll-up-function))))) - ((eq button mouse-wheel-left-event) ; for tilt scroll - (when mouse-wheel-tilt-scroll - (funcall (if mouse-wheel-flip-direction - mwheel-scroll-right-function - mwheel-scroll-left-function) amt))) - ((eq button mouse-wheel-right-event) ; for tilt scroll - (when mouse-wheel-tilt-scroll - (funcall (if mouse-wheel-flip-direction - mwheel-scroll-left-function - mwheel-scroll-right-function) amt))) - (t (error "Bad binding in mwheel-scroll")))) - (if (eq scroll-window selected-window) - ;; If there is a temporarily active region, deactivate it if - ;; scrolling moved point. - (when (and old-point (/= old-point (window-point))) - ;; Call `deactivate-mark' at the original position, so that - ;; the original region is saved to the X selection. - (let ((new-point (window-point))) - (goto-char old-point) - (deactivate-mark) - (goto-char new-point))) - (select-window selected-window t)))) - - (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time) - (if mwheel-inhibit-click-event-timer - (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)))) + (condition-case nil + (unwind-protect + (let ((button (mwheel-event-button event))) + (cond ((eq button mouse-wheel-down-event) + (condition-case nil (funcall mwheel-scroll-down-function amt) + ;; Make sure we do indeed scroll to the beginning of + ;; the buffer. + (beginning-of-buffer + (unwind-protect + (funcall mwheel-scroll-down-function) + ;; If the first scroll succeeded, then some scrolling + ;; is possible: keep scrolling til the beginning but + ;; do not signal an error. For some reason, we have + ;; to do it even if the first scroll signaled an + ;; error, because otherwise the window is recentered + ;; for a reason that escapes me. This problem seems + ;; to only affect scroll-down. --Stef + (set-window-start (selected-window) (point-min)))))) + ((eq button mouse-wheel-up-event) + (condition-case nil (funcall mwheel-scroll-up-function amt) + ;; Make sure we do indeed scroll to the end of the buffer. + (end-of-buffer (while t (funcall mwheel-scroll-up-function))))) + ((eq button mouse-wheel-left-event) ; for tilt scroll + (when mouse-wheel-tilt-scroll + (funcall (if mouse-wheel-flip-direction + mwheel-scroll-right-function + mwheel-scroll-left-function) amt))) + ((eq button mouse-wheel-right-event) ; for tilt scroll + (when mouse-wheel-tilt-scroll + (funcall (if mouse-wheel-flip-direction + mwheel-scroll-left-function + mwheel-scroll-right-function) amt))) + (t (error "Bad binding in mwheel-scroll")))) + (if (eq scroll-window selected-window) + ;; If there is a temporarily active region, deactivate it if + ;; scrolling moved point. + (when (and old-point (/= old-point (window-point))) + ;; Call `deactivate-mark' at the original position, so that + ;; the original region is saved to the X selection. + (let ((new-point (window-point))) + (goto-char old-point) + (deactivate-mark) + (goto-char new-point))) + (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 (not saw-error) + mouse-wheel-click-event mouse-wheel-inhibit-click-time) + (if mwheel-inhibit-click-event-timer + (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))))) (put 'mwheel-scroll 'scroll-command t) -- 2.22.0 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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 0 siblings, 2 replies; 36+ messages in thread From: Stefan Kangas @ 2019-09-30 13:26 UTC (permalink / raw) To: Basil L. Contovounesios; +Cc: 16196@debbugs.gnu.org, Stefan Monnier Stefan Kangas <stefan@marxist.se> writes: > Please find attached an updated patch No comments in over a month. Any objections to applying this patch? Besides indentation changes, this comes down to adding a new variable saw-error and: (condition-case nil ... ;; 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))) Best regards, Stefan Kangas ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-09-30 13:26 ` Stefan Kangas @ 2019-09-30 13:55 ` Eli Zaretskii 2019-09-30 14:03 ` Robert Pluim 1 sibling, 0 replies; 36+ messages in thread From: Eli Zaretskii @ 2019-09-30 13:55 UTC (permalink / raw) To: Stefan Kangas; +Cc: contovob, 16196, monnier > From: Stefan Kangas <stefan@marxist.se> > Date: Mon, 30 Sep 2019 15:26:20 +0200 > Cc: "16196@debbugs.gnu.org" <16196@debbugs.gnu.org>, > Stefan Monnier <monnier@iro.umontreal.ca> > > Stefan Kangas <stefan@marxist.se> writes: > > > Please find attached an updated patch > > No comments in over a month. Any objections to applying this patch? Not here. ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 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 1 sibling, 1 reply; 36+ messages in thread From: Robert Pluim @ 2019-09-30 14:03 UTC (permalink / raw) To: Stefan Kangas Cc: Basil L. Contovounesios, 16196@debbugs.gnu.org, Stefan Monnier >>>>> On Mon, 30 Sep 2019 15:26:20 +0200, Stefan Kangas <stefan@marxist.se> said: Stefan> Stefan Kangas <stefan@marxist.se> writes: >> Please find attached an updated patch Stefan> No comments in over a month. Any objections to applying this patch? Stefan> Besides indentation changes, this comes down to adding a new variable Stefan> saw-error and: Stefan> (condition-case nil Stefan> ... Stefan> ;; Do not ding at buffer limits. Show a message instead. Stefan> (beginning-of-buffer (message "Beginning of buffer") Stefan> (setq saw-error t)) Stefan> (end-of-buffer (message "End of buffer") Stefan> (setq saw-error t))) How about using (error-message-string '(beginning-of-buffer nil)) so that the error string remains in sync with src/data.c? Robert ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-09-30 14:03 ` Robert Pluim @ 2019-09-30 14:11 ` Robert Pluim 2019-09-30 14:19 ` Stefan Kangas 0 siblings, 1 reply; 36+ messages in thread From: Robert Pluim @ 2019-09-30 14:11 UTC (permalink / raw) To: Stefan Kangas Cc: Basil L. Contovounesios, 16196@debbugs.gnu.org, Stefan Monnier >>>>> On Mon, 30 Sep 2019 16:03:19 +0200, Robert Pluim <rpluim@gmail.com> said: >>>>> On Mon, 30 Sep 2019 15:26:20 +0200, Stefan Kangas <stefan@marxist.se> said: Stefan> Stefan Kangas <stefan@marxist.se> writes: >>> Please find attached an updated patch Stefan> No comments in over a month. Any objections to applying this patch? Stefan> Besides indentation changes, this comes down to adding a new variable Stefan> saw-error and: Stefan> (condition-case nil Stefan> ... Stefan> ;; Do not ding at buffer limits. Show a message instead. Stefan> (beginning-of-buffer (message "Beginning of buffer") Stefan> (setq saw-error t)) Stefan> (end-of-buffer (message "End of buffer") Stefan> (setq saw-error t))) Robert> How about using Robert> (error-message-string '(beginning-of-buffer nil)) Robert> so that the error string remains in sync with src/data.c? Make that: (error-message-string '(beginning-of-buffer)) Robert ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-09-30 14:11 ` Robert Pluim @ 2019-09-30 14:19 ` Stefan Kangas 2019-09-30 21:51 ` Stefan Kangas 0 siblings, 1 reply; 36+ messages in thread From: Stefan Kangas @ 2019-09-30 14:19 UTC (permalink / raw) To: Robert Pluim Cc: Basil L. Contovounesios, 16196@debbugs.gnu.org, Stefan Monnier Robert Pluim <rpluim@gmail.com> writes: > Robert> How about using > Robert> (error-message-string '(beginning-of-buffer nil)) > Robert> so that the error string remains in sync with src/data.c? > > Make that: > > (error-message-string '(beginning-of-buffer)) Yup, sounds good to me. Best regards, Stefan Kangas ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-09-30 14:19 ` Stefan Kangas @ 2019-09-30 21:51 ` Stefan Kangas 2019-10-04 16:11 ` Stefan Kangas 0 siblings, 1 reply; 36+ messages in thread From: Stefan Kangas @ 2019-09-30 21:51 UTC (permalink / raw) To: Robert Pluim Cc: Basil L. Contovounesios, 16196@debbugs.gnu.org, Stefan Monnier [-- Attachment #1: Type: text/plain, Size: 449 bytes --] Stefan Kangas <stefan@marxist.se> writes: > > Robert> How about using > > Robert> (error-message-string '(beginning-of-buffer nil)) > > Robert> so that the error string remains in sync with src/data.c? > > > > Make that: > > > > (error-message-string '(beginning-of-buffer)) > > Yup, sounds good to me. Fixed in the attached patch. If there are no objections, I intend to commit this in a couple of days. Best regards, Stefan Kangas [-- Attachment #2: 0001-Make-mouse-scroll-show-a-message-instead-of-dinging-.patch --] [-- Type: application/x-patch, Size: 7677 bytes --] ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-09-30 21:51 ` Stefan Kangas @ 2019-10-04 16:11 ` Stefan Kangas 0 siblings, 0 replies; 36+ messages in thread From: Stefan Kangas @ 2019-10-04 16:11 UTC (permalink / raw) To: Robert Pluim Cc: Basil L. Contovounesios, 16196@debbugs.gnu.org, Stefan Monnier close 16196 27.1 quit Stefan Kangas <stefan@marxist.se> writes: > If there are no objections, I intend to commit this in a couple of days. Now pushed as commit be27f02bcf. Thanks to all for the reviews and comments. Best regards, Stefan Kangas ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-08-09 7:55 ` Stefan Kangas 2019-08-09 8:57 ` Basil L. Contovounesios @ 2019-08-09 9:00 ` martin rudalics 2019-08-10 18:23 ` Stefan Kangas 1 sibling, 1 reply; 36+ messages in thread From: martin rudalics @ 2019-08-09 9:00 UTC (permalink / raw) To: Stefan Kangas, Stefan Monnier; +Cc: 16196@debbugs.gnu.org, Jan Djärv > I took a stab at this. The attached patch traps the beginning-of-buffer > and end-of-buffer errors and shows a message instead as suggested above. Thanks. > To make it easier to review, I've also included a git diff > ignoring whitespace changes. This one doesn't apply here. > What do you think? AFAIAC it's an improvement. But personally, I'd drop the message as well. Does anyone really need it? martin ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-08-09 9:00 ` martin rudalics @ 2019-08-10 18:23 ` Stefan Kangas 2019-08-11 8:17 ` martin rudalics 0 siblings, 1 reply; 36+ messages in thread From: Stefan Kangas @ 2019-08-10 18:23 UTC (permalink / raw) To: martin rudalics; +Cc: 16196@debbugs.gnu.org, Stefan Monnier martin rudalics <rudalics@gmx.at> writes: > > To make it easier to review, I've also included a git diff > > ignoring whitespace changes. > > This one doesn't apply here. Sorry, I should've been more clear. This is the same as the patch but without the whitespace changes. Please try applying the patch instead. Thanks. > > What do you think? > > AFAIAC it's an improvement. But personally, I'd drop the message as > well. Does anyone really need it? I'm personally prone to agree with you, but the reasoning in the previous discussion in this thread seems to be that we do want it. Or at least something similar. Stefan Monnier <monnier@iro.umontreal.ca> writes: > the general design of Emacs is that > we strive to make every command perform *something*, so when the user's > request ends up doing nothing, we signal an error to make it clear that > Emacs did obey the request. Otherwise the lack of feedback can make the > user feel like Emacs is unresponsive. And later: > I'd rather keep some kind of feedback. Maybe a `message'? Personally, I think the scrolling itself is enough feedback. It either scrolls or it doesn't. That's what happens in many other programs, for example in Firefox. And scroll-bar-mode is enabled by default. But I think my opinion on this carries less weight than Stefan Monnier's. :-) Thanks, Stefan Kangas ^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#16196: 24.3.50; Disable ding when scrolling 2019-08-10 18:23 ` Stefan Kangas @ 2019-08-11 8:17 ` martin rudalics 0 siblings, 0 replies; 36+ messages in thread From: martin rudalics @ 2019-08-11 8:17 UTC (permalink / raw) To: Stefan Kangas; +Cc: 16196@debbugs.gnu.org, Stefan Monnier >> > To make it easier to review, I've also included a git diff >> > ignoring whitespace changes. >> >> This one doesn't apply here. > > Sorry, I should've been more clear. This is the same as the patch but > without the whitespace changes. Please try applying the patch > instead. Thanks. I obviously did that (otherwise I would have complained about the patch in the first place) ;-) >> AFAIAC it's an improvement. But personally, I'd drop the message as >> well. Does anyone really need it? > > I'm personally prone to agree with you, but the reasoning in the previous > discussion in this thread seems to be that we do want it. Or at least > something similar. > > Stefan Monnier <monnier@iro.umontreal.ca> writes: > >> the general design of Emacs is that >> we strive to make every command perform *something*, so when the user's >> request ends up doing nothing, we signal an error to make it clear that >> Emacs did obey the request. Otherwise the lack of feedback can make the >> user feel like Emacs is unresponsive. > > And later: > >> I'd rather keep some kind of feedback. Maybe a `message'? > > Personally, I think the scrolling itself is enough feedback. It > either scrolls or it doesn't. That's what happens in many other > programs, for example in Firefox. And scroll-bar-mode is enabled by > default. > > But I think my opinion on this carries less weight than Stefan > Monnier's. :-) My current *Messages* buffer is listed below. I never look at it because it just doesn't make sense. Thanks anyway for your efforts to remove the beeps, martin Loading paren...done Mark set [4 times] next-line: End of buffer [5 times] Mark set next-line: End of buffer Mark set [5 times] nil Mark set user-error: Beginning of history; no preceding item user-error: End of history; no default available [2 times] Quit [2 times] C-M-: is undefined nil Mark set [2 times] previous-line: Beginning of buffer [2 times] Mark set next-line: End of buffer [2 times] Auto-saving...done previous-line: Beginning of buffer [2 times] Mark set previous-line: Beginning of buffer [5 times] Mark set nil previous-line: Beginning of buffer [5 times] Mark set next-line: End of buffer No undo information Mark set next-line: End of buffer [4 times] Mark set [3 times] next-line: End of buffer [5 times] Mark set next-line: End of buffer Mark set [4 times] Auto-saving...done Mark set [6 times] Creating customization items... Creating customization items ...done Creating customization setup...done Mark set Undo user-error: No further undo information [15 times] Mark set [4 times] next-line: End of buffer [3 times] Mark set next-line: End of buffer Mark set next-line: End of buffer Mark set [3 times] next-line: End of buffer if: End of buffer [7 times] Mark set [11 times] next-line: End of buffer [4 times] Undo [4 times] Mark set [9 times] next-line: End of buffer [4 times] Mark set [9 times] next-line: End of buffer [3 times] Scanning for dabbrevs...done Expansion found in ‘ *sidebar*’ Mark set [4 times] ^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2019-10-04 16:11 UTC | newest] Thread overview: 36+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
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.