unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26599: patch for mwheel.el
@ 2017-04-22  1:27 Tak Kunihiro
  2017-04-22  7:52 ` Eli Zaretskii
  0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2017-04-22  1:27 UTC (permalink / raw)
  To: 26599; +Cc: tkk

To utilize both horizontal and vertical scrolling by touchpad, I
locally turn off auto-hscroll-mode during wheel scrolling using
advice-add.

  (advice-add 'mwheel-scroll :before 'touchpad-mode)

Is it possible to add a line that runs hook on `mwheel.el' to let me
do so without advice-add?

In `(emacs) Coding Standards', to avoid using ‘defadvice’ is
implicitly suggested.  Adding the line lets me implement
`touchpad-mode' which makes swiping touchpad scroll horizontally and
vertically, in cleaner fashion (without any side effects, I think).


diff -u "c:/Users/dream/.emacs.d/site-lisp/mwheel.20170410.el" "c:/Users/dream/.emacs.d/site-lisp/mwheel.el"
--- c:/Users/dream/.emacs.d/site-lisp/mwheel.20170410.el	2017-04-21 09:28:22.949364100 +0900
+++ c:/Users/dream/.emacs.d/site-lisp/mwheel.el	2017-04-21 21:19:46.792800400 +0900
@@ -148,6 +148,12 @@
   :group 'mouse
   :type 'boolean)
 
+(defcustom mwheel-pre-scroll-hook nil
+  "A hook that gets run just before scrolling by wheel."
+  :group 'mouse
+  :type 'hook
+  :version "26.1")
+
 (eval-and-compile
   (if (fboundp 'event-button)
       (fset 'mwheel-event-button 'event-button)
@@ -232,6 +238,7 @@
       ;; 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))))
+    (run-hooks 'mwheel-pre-scroll-hook)
     (unwind-protect
 	(let ((button (mwheel-event-button event)))
 	  (cond ((eq button mouse-wheel-down-event)
@@ -320,7 +327,6 @@
   "Enable mouse wheel support."
   (mouse-wheel-mode (if uninstall -1 1)))
 
-
 ;;; For tilt-scroll
 ;;;
 (defcustom mwheel-tilt-scroll-p nil

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-03-13 23:52 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-22  1:27 bug#26599: patch for mwheel.el Tak Kunihiro
2017-04-22  7:52 ` Eli Zaretskii
2017-04-23  6:13   ` Tak Kunihiro
2017-04-26  5:01     ` Eli Zaretskii
2017-04-26  6:08       ` Tak Kunihiro
2017-04-26 10:50         ` Eli Zaretskii
2017-04-26 12:32           ` Tak Kunihiro
2017-04-26 15:31             ` Eli Zaretskii
2017-04-26 23:33               ` Tak Kunihiro
2017-04-27  2:36                 ` Eli Zaretskii
2017-04-27  5:27                   ` Tak Kunihiro
2017-04-27 14:25                     ` Eli Zaretskii
2017-04-27 23:16                       ` Tak Kunihiro
2017-04-28  6:47                         ` Eli Zaretskii
2017-04-28  9:12                           ` Tak Kunihiro
2017-05-19  8:55                             ` Eli Zaretskii
2019-06-24 16:38                               ` Lars Ingebrigtsen
2020-01-20 20:06                                 ` Stefan Kangas
2020-01-20 22:47                                   ` Juri Linkov
2020-01-21  7:17                                     ` Tak Kunihiro
2020-01-21  9:46                                       ` Stefan Kangas
2020-01-22  5:46                                         ` Tak Kunihiro
2020-03-13 23:43                                           ` Tak Kunihiro
2020-03-13 23:52                                         ` Tak Kunihiro

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).