[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26599: patch for mwheel.el
From: |
Tak Kunihiro |
Subject: |
bug#26599: patch for mwheel.el |
Date: |
Sat, 22 Apr 2017 10:27:52 +0900 (JST) |
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
- bug#26599: patch for mwheel.el,
Tak Kunihiro <=
- bug#26599: patch for mwheel.el, Eli Zaretskii, 2017/04/22
- bug#26599: patch for mwheel.el, Tak Kunihiro, 2017/04/23
- bug#26599: patch for mwheel.el, Eli Zaretskii, 2017/04/26
- bug#26599: patch for mwheel.el, Tak Kunihiro, 2017/04/26
- bug#26599: patch for mwheel.el, Eli Zaretskii, 2017/04/26
- bug#26599: patch for mwheel.el, Tak Kunihiro, 2017/04/26
- bug#26599: patch for mwheel.el, Eli Zaretskii, 2017/04/26
- bug#26599: patch for mwheel.el, Tak Kunihiro, 2017/04/26
- bug#26599: patch for mwheel.el, Eli Zaretskii, 2017/04/26
- bug#26599: patch for mwheel.el, Tak Kunihiro, 2017/04/27