* bug#26347: patch for mwheel.el
@ 2017-04-03 11:11 Tak Kunihiro
2017-04-03 15:00 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: Tak Kunihiro @ 2017-04-03 11:11 UTC (permalink / raw)
To: 26347; +Cc: Kunihiro Tak
This patch tries to extend a global minor mode `mouse-wheel-mode' and
makes Emacs scroll both vertically and horizontally by swiping
`touchpad' or tilting `trackbar’.
To make the tilt scroll work, add a following line to init file.
(setq mwheel-tilt-scroll-p t)
How it is implemented is described below.
To scroll horizontally, a function `mwheel-scroll' is extended. An
event `wheel-right' or `wheel-left' calls `scroll-right' or
`scroll-right', respectively.
During not only horizontal scroll but also vertical scroll,
`auto-hscroll-mode' should be disabled by following three aspects.
(1) It should be off during horizontal scroll. If it is on, scope
jumps randomly when point is at the edge. Also, since
horizontal scroll does not move point, there will be
inconsistency between point and scope, and the inconsistency
will result in unexpected shift of the scope.
(2) It should be off during vertical scroll. When a buffer is with
short and long alternative lines, scope jumps from the end of
long line to the end of short line. Sudden shift of the scope
makes edition of a wide document hard.
(3) During horizontal scroll, you may scroll a little in vertical
direction without intention. The scrolling should be tolerance
against such perturbation. This is somewhat similar to (2).
After scroll, you want to set `auto-hscroll-mode' t back again
otherwise too inconvenient for edition. Approach of this patch is to
turn on another minor-mode `mwheel--scroll-mode' with
`auto-hscroll-mode' nil at the beginning of `mwheel-scroll'. The
minor mode is turned off upon any key inputs that move point.
This is my first to time to send a patch. I follow `(emacs) Sending
Patches’. I hope this is helpful.
--- /Applications/MacPorts/Emacs-25.1.app/Contents/Resources/lisp/mwheel.el 2017-04-03 16:28:52.000000000 +0900
+++ mwheel.el 2017-04-03 16:20:16.000000000 +0900
@@ -187,8 +187,8 @@
(defun mwheel-scroll (event)
"Scroll up or down according to the EVENT.
-This should be bound only to mouse buttons 4 and 5 on non-Windows
-systems."
+This should be bound only to mouse buttons 4, 5, 6, and 7 on
+non-Windows systems."
(interactive (list last-input-event))
(let* ((curwin (if mouse-wheel-follow-mouse
(prog1
@@ -210,6 +210,9 @@
;; 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))))
+ ;; Turn on minor-mode with auto-hscroll-mode nil for tilt scroll
+ (if mwheel-tilt-scroll-p
+ (with-current-buffer buffer (mwheel--scroll-mode 1)))
(unwind-protect
(let ((button (mwheel-event-button event)))
(cond ((eq button mouse-wheel-down-event)
@@ -231,6 +234,16 @@
(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 mwheel-tilt-scroll-p
+ (funcall (if mwheel-flip-direction
+ mwheel-scroll-right-function
+ mwheel-scroll-left-function) amt)))
+ ((eq button mouse-wheel-right-event) ; for tilt scroll
+ (when mwheel-tilt-scroll-p
+ (funcall (if mwheel-flip-direction
+ mwheel-scroll-left-function
+ mwheel-scroll-right-function) amt)))
(t (error "Bad binding in mwheel-scroll"))))
(if curwin (select-window curwin)))
;; If there is a temporarily active region, deactivate it if
@@ -276,7 +289,7 @@
(global-unset-key key))))
;; Setup bindings as needed.
(when mouse-wheel-mode
- (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event))
+ (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event mouse-wheel-right-event mouse-wheel-left-event))
(dolist (key (mapcar (lambda (amt) `[(,@(if (consp amt) (car amt)) ,event)])
mouse-wheel-scroll-amount))
(global-set-key key 'mwheel-scroll)
@@ -288,6 +301,92 @@
"Enable mouse wheel support."
(mouse-wheel-mode (if uninstall -1 1)))
+
+;;;
+;;; For tilt-scroll
+;;;
+(defcustom mwheel-tilt-scroll-p nil
+ "Enable tilt scroll and disable `auto-hscroll-mode' during scroll."
+ :group 'mouse
+ :type 'boolean)
+
+(defcustom mwheel-flip-direction nil
+ "Swap direction of 'wheel-right and 'wheel-left."
+ :group 'mouse
+ :type 'boolean)
+
+(defcustom mwheel-scroll-left-function 'scroll-left
+ "Function that does the job of scrolling left."
+ :group 'mouse
+ :type 'function)
+
+(defcustom mwheel-scroll-right-function 'scroll-right
+ "Function that does the job of scrolling right."
+ :group 'mouse
+ :type 'function)
+
+(defcustom mouse-wheel-left-event
+ (if (or (featurep 'w32-win) (featurep 'ns-win))
+ 'wheel-left
+ (intern "mouse-6"))
+ "Event used for scrolling left."
+ :group 'mouse
+ :type 'symbol)
+
+(defcustom mouse-wheel-right-event
+ (if (or (featurep 'w32-win) (featurep 'ns-win))
+ 'wheel-right
+ (intern "mouse-7"))
+ "Event used for scrolling right."
+ :group 'mouse
+ :type 'symbol)
+
+(defvar mouse--cursor-type cursor-type
+ "Cursor used by user. This variable is used internally to
+ restore original `cursor-type'.")
+
+(defun mwheel-disable--scroll-mode ()
+ "Disable minor mode `mwheel--scroll-mode' to enable
+`auto-hscroll-mode' back. Then invoke command that is bound to
+the original key."
+ (interactive)
+ (mwheel--scroll-mode 0) ; turn off minor-mode
+ (call-interactively (key-binding (this-command-keys))))
+
+(define-minor-mode mwheel--scroll-mode
+ "A minor-mode with `auto-hscroll-mode' off. This minor mode is
+used internally."
+ :init-value nil
+ :keymap (let ((map (make-sparse-keymap)))
+ (define-key map [remap keyboard-quit] 'mwheel-disable--scroll-mode)
+ (define-key map [remap mouse-drag-region] 'mwheel-disable--scroll-mode)
+ (define-key map [remap right-char] 'mwheel-disable--scroll-mode)
+ (define-key map [remap forward-char] 'mwheel-disable--scroll-mode)
+ (define-key map [remap forward-word] 'mwheel-disable--scroll-mode)
+ (define-key map [remap forward-sentence] 'mwheel-disable--scroll-mode)
+ (define-key map [remap left-char] 'mwheel-disable--scroll-mode)
+ (define-key map [remap backward-char] 'mwheel-disable--scroll-mode)
+ (define-key map [remap backward-word] 'mwheel-disable--scroll-mode)
+ (define-key map [remap backward-sentence] 'mwheel-disable--scroll-mode)
+ (define-key map [remap move-beginning-of-line] 'mwheel-disable--scroll-mode)
+ (define-key map [remap move-end-of-line] 'mwheel-disable--scroll-mode)
+ (define-key map [remap next-line] 'mwheel-disable--scroll-mode)
+ (define-key map [remap scroll-up-command] 'mwheel-disable--scroll-mode)
+ (define-key map [remap previous-line] 'mwheel-disable--scroll-mode)
+ (define-key map [remap scroll-down-command] 'mwheel-disable--scroll-mode)
+ (define-key map [remap beginning-of-buffer] 'mwheel-disable--scroll-mode)
+ (define-key map [remap end-of-buffer] 'mwheel-disable--scroll-mode)
+ ;; listed as much as I can ... map all but (where-is-internal 'mwheel-scroll)
+ map)
+ :group 'mouse
+
+ (if mwheel--scroll-mode
+ (progn
+ (setq-local cursor-type 'hollow)
+ (setq-local auto-hscroll-mode nil))
+ (setq-local cursor-type mouse--cursor-type)
+ (setq-local auto-hscroll-mode t)))
+
(provide 'mwheel)
;;; mwheel.el ends here
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-03 11:11 bug#26347: patch for mwheel.el Tak Kunihiro
@ 2017-04-03 15:00 ` Eli Zaretskii
2017-04-04 0:55 ` Tak Kunihiro
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-04-03 15:00 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26347
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Date: Mon, 3 Apr 2017 20:11:45 +0900
> Cc: Kunihiro Tak <tkk@misasa.okayama-u.ac.jp>
>
> This patch tries to extend a global minor mode `mouse-wheel-mode' and
> makes Emacs scroll both vertically and horizontally by swiping
> `touchpad' or tilting `trackbar’.
Thanks. This is a substantial contribution, so we will need legal
papers from you to accept it. Would you like me to send you the form
off-list so you could start your paperwork rolling?
> During not only horizontal scroll but also vertical scroll,
> `auto-hscroll-mode' should be disabled by following three aspects.
>
> (1) It should be off during horizontal scroll. If it is on, scope
> jumps randomly when point is at the edge. Also, since
> horizontal scroll does not move point, there will be
> inconsistency between point and scope, and the inconsistency
> will result in unexpected shift of the scope.
>
> (2) It should be off during vertical scroll. When a buffer is with
> short and long alternative lines, scope jumps from the end of
> long line to the end of short line. Sudden shift of the scope
> makes edition of a wide document hard.
We don't turn off auto-hscroll-mode when scrolling with the horizontal
or vertical scroll bars, and we don't have the problems you describe
in those cases. Why is this case different?
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-03 15:00 ` Eli Zaretskii
@ 2017-04-04 0:55 ` Tak Kunihiro
2017-04-04 2:52 ` Tak Kunihiro
0 siblings, 1 reply; 13+ messages in thread
From: Tak Kunihiro @ 2017-04-04 0:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Kunihiro Tak, 26347
>> During not only horizontal scroll but also vertical scroll,
>> `auto-hscroll-mode' should be disabled by following three aspects.
>>
>> (1) It should be off during horizontal scroll. If it is on, scope
>> jumps randomly when point is at the edge. Also, since
>> horizontal scroll does not move point, there will be
>> inconsistency between point and scope, and the inconsistency
>> will result in unexpected shift of the scope.
>>
>> (2) It should be off during vertical scroll. When a buffer is with
>> short and long alternative lines, scope jumps from the end of
>> long line to the end of short line. Sudden shift of the scope
>> makes edition of a wide document hard.
>
> We don't turn off auto-hscroll-mode when scrolling with the horizontal
> or vertical scroll bars, and we don't have the problems you describe
> in those cases. Why is this case different?
I see your point in regard to (1). Yes, if `mwheel-scroll’ can scroll right
or left like horizontal-scroll-bar does, turing off auto-hscroll-mode is not
necessary for case (1). Give me time to understand code of horizontal-scroll-bar.
In regard to (2), let’s say you have a very long line and your point is at the end
of line in a window. The next line is short and even the end of line is not shown
in the window. The third line is very long again.
> date & session & stone & remark & date & session & stone & remark\\
> \hline
> April 4, 2017 & a & b & c & April 4, 2017 & a & b & c\\
When you move vertical-scroll-bar down, eventually the long line disappears
above the top of window. The point moves to the end of the next short line.
As a consequence, you see scope shifted. The patch tries to keep the scope to
be the same. To do so, auto-hscroll-mode was set to off.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-04 0:55 ` Tak Kunihiro
@ 2017-04-04 2:52 ` Tak Kunihiro
2017-04-04 7:25 ` martin rudalics
2017-04-04 11:35 ` Tak Kunihiro
0 siblings, 2 replies; 13+ messages in thread
From: Tak Kunihiro @ 2017-04-04 2:52 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Kunihiro Tak, 26347
>>> During not only horizontal scroll but also vertical scroll,
>>> `auto-hscroll-mode' should be disabled by following three aspects.
>>>
>>> (1) It should be off during horizontal scroll. If it is on, scope
>>> jumps randomly when point is at the edge. Also, since
>>> horizontal scroll does not move point, there will be
>>> inconsistency between point and scope, and the inconsistency
>>> will result in unexpected shift of the scope.
>>>
>> We don't turn off auto-hscroll-mode when scrolling with the horizontal
>> or vertical scroll bars, and we don't have the problems you describe
>> in those cases. Why is this case different?
>
> I see your point in regard to (1). Yes, if `mwheel-scroll’ can scroll right
> or left like horizontal-scroll-bar does, turing off auto-hscroll-mode is not
> necessary for case (1). Give me time to understand code of horizontal-scroll-bar.
I see (1) is true for Emacs 25.1 on Mac and Emacs 24.5 on Windows
but Emacs 25.1 on Windows.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-04 2:52 ` Tak Kunihiro
@ 2017-04-04 7:25 ` martin rudalics
2017-04-04 11:35 ` Tak Kunihiro
1 sibling, 0 replies; 13+ messages in thread
From: martin rudalics @ 2017-04-04 7:25 UTC (permalink / raw)
To: Tak Kunihiro, Eli Zaretskii; +Cc: 26347
>> Give me time to understand code of horizontal-scroll-bar.
... and improve it, hopefully.
> I see (1) is true for Emacs 25.1 on Mac and Emacs 24.5 on Windows
> but Emacs 25.1 on Windows.
Did you mean Emacs 24.5 on Windows but _not_ Emacs 25.1 on Windows?
martin
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-04 2:52 ` Tak Kunihiro
2017-04-04 7:25 ` martin rudalics
@ 2017-04-04 11:35 ` Tak Kunihiro
2017-04-04 14:34 ` Eli Zaretskii
1 sibling, 1 reply; 13+ messages in thread
From: Tak Kunihiro @ 2017-04-04 11:35 UTC (permalink / raw)
To: martin rudalics; +Cc: tkk, 26347
>>>>> During not only horizontal scroll but also vertical scroll,
>>>>> `auto-hscroll-mode' should be disabled by following three aspects.
>>>>>
>>>>> (1) It should be off during horizontal scroll. If it is on, scope
>>>>> jumps randomly when point is at the edge. Also, since
>>>>> horizontal scroll does not move point, there will be
>>>>> inconsistency between point and scope, and the inconsistency
>>>>> will result in unexpected shift of the scope.
>>>>>
>>>> We don't turn off auto-hscroll-mode when scrolling with the horizontal
>>>> or vertical scroll bars, and we don't have the problems you describe
>>>> in those cases. Why is this case different?
>>>
>>> I see your point in regard to (1). Yes, if `mwheel-scroll’ can scroll right
>>> or left like horizontal-scroll-bar does, turing off auto-hscroll-mode is not
>>> necessary for case (1). Give me time to understand code of horizontal-scroll-bar.
>>
>> I see (1) is true for Emacs 25.1 on Mac and Emacs 24.5 on Windows
>> but Emacs 25.1 on Windows.
>
> Did you mean Emacs 24.5 on Windows but _not_ Emacs 25.1 on Windows?
Let me take it back and rephrase. I meant (1) is true for Emacs 24.5
on Windows but not for Emacs 25.1 on Windows. Emacs 25.1 on Windows
scrolls horizontally well with auto-hscroll-mode on.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-04 11:35 ` Tak Kunihiro
@ 2017-04-04 14:34 ` Eli Zaretskii
2017-04-04 23:18 ` Tak Kunihiro
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-04-04 14:34 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26347
> Date: Tue, 04 Apr 2017 20:35:05 +0900 (JST)
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Cc: tkk@misasa.okayama-u.ac.jp, 26347@debbugs.gnu.org
>
> Let me take it back and rephrase. I meant (1) is true for Emacs 24.5
> on Windows but not for Emacs 25.1 on Windows. Emacs 25.1 on Windows
> scrolls horizontally well with auto-hscroll-mode on.
So I guess this means there is hope your patch could be amended not to
disable auto-hscroll-mode?
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-04 14:34 ` Eli Zaretskii
@ 2017-04-04 23:18 ` Tak Kunihiro
2017-04-05 2:36 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: Tak Kunihiro @ 2017-04-04 23:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Kunihiro Tak, 26347
>> Let me take it back and rephrase. I meant (1) is true for Emacs 24.5
>> on Windows but not for Emacs 25.1 on Windows. Emacs 25.1 on Windows
>> scrolls horizontally well with auto-hscroll-mode on.
>
> So I guess this means there is hope your patch could be amended not to
> disable auto-hscroll-mode?
>> Let me take it back and rephrase. I meant (1) is true for Emacs 24.5
>> on Windows but not for Emacs 25.1 on Windows. Emacs 25.1 on Windows
>> scrolls horizontally well with auto-hscroll-mode on.
>
> So I guess this means there is hope your patch could be amended not to
> disable auto-hscroll-mode?
Now I leaned auto-hscroll-mode is irrelevant to horizontal scroll.
However, I still insist that it should be off on horizontal and
vertical scrolling.
(A) It should be off during vertical scroll. Let’s consider a buffer
is with short and long alternative lines and when point is at the
end of long line, at the top of current window. After `scroll-up
1', point jumps to the end of the next short line and you see scope
shifts suddenly leftward. This behavior is sometimes unexpected
one.
(B) It should be off during horizontal scroll. During horizontal
scroll, you may scroll a little in vertical direction without
intention. The horizontal scroll should be tolerance against such
perturbation. The source of concern is same as (A).
The concern (A) is shared with vertical scroll-bar. With this
respect, the concern should be solved by `scroll-up' not by
`mwheel-scroll'.
I think when point moves off the left edge of the window with cursor
frozen at the left edge of the window, `scroll-up' should scroll up
without horizontal shift.
Conclusion: Yes.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-04 23:18 ` Tak Kunihiro
@ 2017-04-05 2:36 ` Eli Zaretskii
2017-04-05 3:35 ` Tak Kunihiro
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-04-05 2:36 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26347
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Date: Wed, 5 Apr 2017 08:18:42 +0900
> Cc: Kunihiro Tak <tkk@misasa.okayama-u.ac.jp>,
> rudalics@gmx.at,
> 26347@debbugs.gnu.org
>
> Now I leaned auto-hscroll-mode is irrelevant to horizontal scroll.
> However, I still insist that it should be off on horizontal and
> vertical scrolling.
>
> (A) It should be off during vertical scroll. Let’s consider a buffer
> is with short and long alternative lines and when point is at the
> end of long line, at the top of current window. After `scroll-up
> 1', point jumps to the end of the next short line and you see scope
> shifts suddenly leftward. This behavior is sometimes unexpected
> one.
>
> (B) It should be off during horizontal scroll. During horizontal
> scroll, you may scroll a little in vertical direction without
> intention. The horizontal scroll should be tolerance against such
> perturbation. The source of concern is same as (A).
>
> The concern (A) is shared with vertical scroll-bar. With this
> respect, the concern should be solved by `scroll-up' not by
> `mwheel-scroll'.
>
> I think when point moves off the left edge of the window with cursor
> frozen at the left edge of the window, `scroll-up' should scroll up
> without horizontal shift.
>
> Conclusion: Yes.
The considerations you present are not special to the proposed
horizontal scrolling using a mouse wheel, they are valid for any
scrolling. IOW, this is how scrolling behaved in Emacs since about
forever. And I think it's not a good idea to have some methods of
scrolling behave differently from others. So I could agree to having
a user option to temporarily disable auto-hscroll-mode during
scrolling, but the default behavior should be what we have now, and
the option should affect all methods of scrolling alike.
Thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-05 2:36 ` Eli Zaretskii
@ 2017-04-05 3:35 ` Tak Kunihiro
2017-04-11 9:47 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: Tak Kunihiro @ 2017-04-05 3:35 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Kunihiro Tak, 26347
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
I agree.
Although it is inferred in (emacs) Sending Patches,
I tried to change two things at the same time.
I attach a patch that does not modify auto-hscroll-mode.
[-- Attachment #2: diff-mwheel-2.patch --]
[-- Type: application/octet-stream, Size: 3175 bytes --]
--- /Applications/MacPorts/Emacs-25.1.app/Contents/Resources/lisp/mwheel.el 2017-04-03 16:28:52.000000000 +0900
+++ mwheel.el 2017-04-05 09:53:35.000000000 +0900
@@ -187,8 +187,8 @@
(defun mwheel-scroll (event)
"Scroll up or down according to the EVENT.
-This should be bound only to mouse buttons 4 and 5 on non-Windows
-systems."
+This should be bound only to mouse buttons 4, 5, 6, and 7 on
+non-Windows systems."
(interactive (list last-input-event))
(let* ((curwin (if mouse-wheel-follow-mouse
(prog1
@@ -231,6 +231,16 @@
(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 mwheel-tilt-scroll-p
+ (funcall (if mwheel-flip-direction
+ mwheel-scroll-right-function
+ mwheel-scroll-left-function) amt)))
+ ((eq button mouse-wheel-right-event) ; for tilt scroll
+ (when mwheel-tilt-scroll-p
+ (funcall (if mwheel-flip-direction
+ mwheel-scroll-left-function
+ mwheel-scroll-right-function) amt)))
(t (error "Bad binding in mwheel-scroll"))))
(if curwin (select-window curwin)))
;; If there is a temporarily active region, deactivate it if
@@ -276,7 +286,7 @@
(global-unset-key key))))
;; Setup bindings as needed.
(when mouse-wheel-mode
- (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event))
+ (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event mouse-wheel-right-event mouse-wheel-left-event))
(dolist (key (mapcar (lambda (amt) `[(,@(if (consp amt) (car amt)) ,event)])
mouse-wheel-scroll-amount))
(global-set-key key 'mwheel-scroll)
@@ -288,6 +298,46 @@
"Enable mouse wheel support."
(mouse-wheel-mode (if uninstall -1 1)))
+
+;;;
+;;; For tilt-scroll
+;;;
+(defcustom mwheel-tilt-scroll-p nil
+ "Enable scroll using tilting mouse wheel."
+ :group 'mouse
+ :type 'boolean)
+
+(defcustom mwheel-flip-direction nil
+ "Swap direction of 'wheel-right and 'wheel-left."
+ :group 'mouse
+ :type 'boolean)
+
+(defcustom mwheel-scroll-left-function 'scroll-left
+ "Function that does the job of scrolling left."
+ :group 'mouse
+ :type 'function)
+
+(defcustom mwheel-scroll-right-function 'scroll-right
+ "Function that does the job of scrolling right."
+ :group 'mouse
+ :type 'function)
+
+(defcustom mouse-wheel-left-event
+ (if (or (featurep 'w32-win) (featurep 'ns-win))
+ 'wheel-left
+ (intern "mouse-6"))
+ "Event used for scrolling left."
+ :group 'mouse
+ :type 'symbol)
+
+(defcustom mouse-wheel-right-event
+ (if (or (featurep 'w32-win) (featurep 'ns-win))
+ 'wheel-right
+ (intern "mouse-7"))
+ "Event used for scrolling right."
+ :group 'mouse
+ :type 'symbol)
+
(provide 'mwheel)
;;; mwheel.el ends here
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-05 3:35 ` Tak Kunihiro
@ 2017-04-11 9:47 ` Eli Zaretskii
2017-04-11 23:56 ` Tak Kunihiro
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-04-11 9:47 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26347
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Date: Wed, 5 Apr 2017 12:35:24 +0900
> Cc: Kunihiro Tak <tkk@misasa.okayama-u.ac.jp>,
> 26347@debbugs.gnu.org
>
> I attach a patch that does not modify auto-hscroll-mode.
Thanks. Please add:
. ChangeLog-style commit log message (see CONTRIBUTE for some guidance)
. a NEWS entry about the new feature and its user-visible aspects
. optionally, addition to the user manual describing this
With those additions, I will push this to the master branch.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-11 9:47 ` Eli Zaretskii
@ 2017-04-11 23:56 ` Tak Kunihiro
2017-04-12 13:35 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: Tak Kunihiro @ 2017-04-11 23:56 UTC (permalink / raw)
To: eliz; +Cc: tkk, 26347
Please revise words and phrases as you wish. On info revision, I also
put a recipe to scroll less. Please discard the part if that should
be done by different process.
# ChangeLog
Support scrolling by tiling wheel
Scroll right and left using wheel-right and wheel-left; This revision
also makes use of touchpad and trackpad (Bug#26347).
* doc/emacs/frames.texi (Mouse Commands): Document the change and recipe of scroll less
* lisp/mwheel.el (mwheel-scroll): Respond to wheel-right and wheel-left
* lisp/mwheel.el (mwheel-tilt-scroll-p): Enable tilt scrolling
* lisp/mwheel.el (mwheel-flip-direction): Flip scrolling direction
* lisp/mwheel.el (mwheel-scroll-left-function): Function to be called by wheel-left
* lisp/mwheel.el (mwheel-scroll-right-function): Function to be called by wheel-right
* lisp/mwheel.el (mouse-wheel-left-event): Event that calls wheel-left
* lisp/mwheel.el (mouse-wheel-right-event): Event that calls wheel-right
# NEWS
** Emacs can scroll horizontally using mouse, touchpad, and trackbar.
You can start scrolling by customizing `mwheel-tilt-scroll-p'. When
direction of scroll is opposite, customize `mwheel-flip-direction'.
# Info
--- doc/emacs/frames.texi 2017-04-12 08:09:52.565691400 +0900
+++ doc/emacs/frames-b.texi 2017-04-12 08:16:45.075204400 +0900
@@ -206,6 +206,22 @@
@code{mouse-wheel-progressive-speed} determines whether the scroll
speed is linked to how fast you move the wheel.
+Emacs also supports horizontal scrolling by tilting ``wheel''. The
+variables @code{mwheel-tilt-scroll-p} turns the feature on. When
+direction is opposite as you wish, turn the variable
+@code{mwheel-flip-direction} on.
+
+Occasionally scrolling by a ``wheel'' is accelerated by system. In
+such case, default configuration may scroll too fast. If so, for
+example, you can add the following lines to your init file
+(@pxref{Init File}) to scroll less.
+
+@example
+(setq mouse-wheel-scroll-amount '(1 ((shift) . 5) ((control))))
+(setq mouse-wheel-progressive-speed nil)
+@end example
+
@node Word and Line Mouse
@section Mouse Commands for Words and Lines
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26347: patch for mwheel.el
2017-04-11 23:56 ` Tak Kunihiro
@ 2017-04-12 13:35 ` Eli Zaretskii
0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2017-04-12 13:35 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26347-done
> Date: Wed, 12 Apr 2017 08:56:38 +0900 (JST)
> Cc: 26347@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>
> Please revise words and phrases as you wish.
Thanks, pushed, and I'm marking the bug done. See below for some
comments for your future contributions.
> On info revision, I also put a recipe to scroll less. Please
> discard the part if that should be done by different process.
Done. This is an unrelated change.
> # ChangeLog
>
> Support scrolling by tiling wheel
>
> Scroll right and left using wheel-right and wheel-left; This revision
> also makes use of touchpad and trackpad (Bug#26347).
This should be a single line no longer than 70 characters. Additional
lines can some after that, separated from the summary line by a blank
line.
> * doc/emacs/frames.texi (Mouse Commands): Document the change and recipe of scroll less
This should end in a period, and be at most 70 characters. Please use
"C-x 4 a" to format the message correctly.
> * lisp/mwheel.el (mwheel-scroll): Respond to wheel-right and wheel-left
> * lisp/mwheel.el (mwheel-tilt-scroll-p): Enable tilt scrolling
Log entries pertaining to the same source file should state the file
only once, like this:
* lisp/mwheel.el (mwheel-scroll): Respond to wheel-right and wheel-left.
(wheel-tilt-scroll-p): Enable tilt scrolling.
> # NEWS
>
> ** Emacs can scroll horizontally using mouse, touchpad, and trackbar.
> You can start scrolling by customizing `mwheel-tilt-scroll-p'. When
> direction of scroll is opposite, customize `mwheel-flip-direction'.
We use quoting 'like this' in NEWS.
> --- doc/emacs/frames.texi 2017-04-12 08:09:52.565691400 +0900
> +++ doc/emacs/frames-b.texi 2017-04-12 08:16:45.075204400 +0900
It is best to send patches by invoking "git diff" or "git format-patch".
> +Emacs also supports horizontal scrolling by tilting ``wheel''. The
There's no need to take ``wheel'' in quotes more than once, when it is
first mentioned. (It is quoted, because it's not a real wheel.) You
can see that the existing text only quotes it once.
> +variables @code{mwheel-tilt-scroll-p} turns the feature on. When
> +direction is opposite as you wish, turn the variable
> +@code{mwheel-flip-direction} on.
User variables should be indexed by using @vindex.
> +(defcustom mwheel-tilt-scroll-p nil
> + "Enable scroll using tilting mouse wheel."
> + :group 'mouse
> + :type 'boolean)
Defcustoms should have the :version tag stating the Emacs release
where they were first introduced, in this case 26.1.
I also made some of your defcustoms defvars, as I think there are too
many customizable variables in the patch.
Thanks again for working on this.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-04-12 13:35 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-03 11:11 bug#26347: patch for mwheel.el Tak Kunihiro
2017-04-03 15:00 ` Eli Zaretskii
2017-04-04 0:55 ` Tak Kunihiro
2017-04-04 2:52 ` Tak Kunihiro
2017-04-04 7:25 ` martin rudalics
2017-04-04 11:35 ` Tak Kunihiro
2017-04-04 14:34 ` Eli Zaretskii
2017-04-04 23:18 ` Tak Kunihiro
2017-04-05 2:36 ` Eli Zaretskii
2017-04-05 3:35 ` Tak Kunihiro
2017-04-11 9:47 ` Eli Zaretskii
2017-04-11 23:56 ` Tak Kunihiro
2017-04-12 13:35 ` Eli Zaretskii
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).