* 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
* bug#26599: patch for mwheel.el
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
0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2017-04-22 7:52 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26599
> Date: Sat, 22 Apr 2017 10:27:52 +0900 (JST)
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Cc: tkk@misasa.okayama-u.ac.jp
>
> Is it possible to add a line that runs hook on `mwheel.el' to let me
> do so without advice-add?
Wouldn't it be better to have a user option which would turn off
auto-hscroll-mode without running any hooks?
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-22 7:52 ` Eli Zaretskii
@ 2017-04-23 6:13 ` Tak Kunihiro
2017-04-26 5:01 ` Eli Zaretskii
0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2017-04-23 6:13 UTC (permalink / raw)
To: eliz; +Cc: tkk, 26599
>> Is it possible to add a line that runs hook on `mwheel.el' to let me
>> do so without advice-add?
>
> Wouldn't it be better to have a user option which would turn off
> auto-hscroll-mode without running any hooks?
Yes. A concern is how to turn auto-hscroll-mode t back.
User decides when to set auto-scroll-mode t again by an event besides
wheel-up, -down, -left, or -down.
My picture is having a minor mode that detects the event and sets
auto-scroll-mode t again. The minor mode would be described in a file
paired with code that sets auto-scroll-mode nil.
In a case the minor mode is written in a file outside of mwheel.el,
code that sets auto-scroll-mode nil should be on the file too. In the
scenario hook to invokes the minor mode, is necessary.
In a case the minor mode is written in mwheel.el, hook is not
necessary.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-23 6:13 ` Tak Kunihiro
@ 2017-04-26 5:01 ` Eli Zaretskii
2017-04-26 6:08 ` Tak Kunihiro
0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2017-04-26 5:01 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26599
> Date: Sun, 23 Apr 2017 15:13:00 +0900 (JST)
> Cc: 26599@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>
> >> Is it possible to add a line that runs hook on `mwheel.el' to let me
> >> do so without advice-add?
> >
> > Wouldn't it be better to have a user option which would turn off
> > auto-hscroll-mode without running any hooks?
>
> Yes. A concern is how to turn auto-hscroll-mode t back.
maybe I misunderstand something: what I had in mind is turn off
auto-hscroll-mode as part of the mwheel commands, then turn it back on
when the mwheel command did its job.
> User decides when to set auto-scroll-mode t again by an event besides
> wheel-up, -down, -left, or -down.
No, I meant to have it off as long as the mwheel command runs, and
restore it right back immediately afterwards.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-26 5:01 ` Eli Zaretskii
@ 2017-04-26 6:08 ` Tak Kunihiro
2017-04-26 10:50 ` Eli Zaretskii
0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2017-04-26 6:08 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Kunihiro Tak, 26599
>>>> Is it possible to add a line that runs hook on `mwheel.el' to let me
>>>> do so without advice-add?
>>>
>>> Wouldn't it be better to have a user option which would turn off
>>> auto-hscroll-mode without running any hooks?
>>
>> Yes. A concern is how to turn auto-hscroll-mode t back.
>
> maybe I misunderstand something: what I had in mind is turn off
> auto-hscroll-mode as part of the mwheel commands, then turn it back on
> when the mwheel command did its job.
>
>> User decides when to set auto-hscroll-mode t again by an event besides
>> wheel-up, -down, -left, or -down.
>
> No, I meant to have it off as long as the mwheel command runs, and
> restore it right back immediately afterwards.
Let’s consider a buffer consists of very long lines and an empty line.
Point starts from A with auto-hscroll-mode t.
0000..0000 A
0000..0000 I
C B
D 00..0000 Z
Point reaches to B by scroll up and as soon as auto-hscroll-mode
is set to t, scope will be shifted to point C. Another scrolling
up moves point to D instead of Z.
To visit point Z, timer is required. A minor-mode serves as a long timer.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-26 6:08 ` Tak Kunihiro
@ 2017-04-26 10:50 ` Eli Zaretskii
2017-04-26 12:32 ` Tak Kunihiro
0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2017-04-26 10:50 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26599
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Date: Wed, 26 Apr 2017 15:08:42 +0900
> Cc: Kunihiro Tak <tkk@misasa.okayama-u.ac.jp>,
> 26599@debbugs.gnu.org
>
> Let’s consider a buffer consists of very long lines and an empty line.
> Point starts from A with auto-hscroll-mode t.
>
> 0000..0000 A
> 0000..0000 I
> C B
> D 00..0000 Z
>
> Point reaches to B by scroll up and as soon as auto-hscroll-mode
> is set to t, scope will be shifted to point C. Another scrolling
> up moves point to D instead of Z.
I think I'm still missing something, because in my testing, even if
window is hscrolled to show point at C, the next scroll "undoes" that
hscroll to show point at Z. That's because Emacs tries to keep point
in the same column while scrolling. So please present a full recipe
which exhibits the problem, including the file to visit and the
commands to invoke.
Thanks.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-26 10:50 ` Eli Zaretskii
@ 2017-04-26 12:32 ` Tak Kunihiro
2017-04-26 15:31 ` Eli Zaretskii
0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2017-04-26 12:32 UTC (permalink / raw)
To: eliz; +Cc: tkk, 26599
>> Let’s consider a buffer consists of very long lines and an empty line.
>> Point starts from A with auto-hscroll-mode t.
>>
>> 0000..0000 A
>> 0000..0000 I
>> C B
>> D 00..0000 Z
I did not describe my concern correctly. Let me rephrase.
Point reaches to B by scrolling up and as soon as auto-hscroll-mode is
set to t, scope will be shifted to point C.
I want to maintain scope with B instead of having scope with C before
another scrolling.
To keep having scope with B, timer is required. A minor-mode serves
as a long timer.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-26 12:32 ` Tak Kunihiro
@ 2017-04-26 15:31 ` Eli Zaretskii
2017-04-26 23:33 ` Tak Kunihiro
0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2017-04-26 15:31 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26599
> Date: Wed, 26 Apr 2017 21:32:48 +0900 (JST)
> Cc: 26599@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>
> >> Let’s consider a buffer consists of very long lines and an empty line.
> >> Point starts from A with auto-hscroll-mode t.
> >>
> >> 0000..0000 A
> >> 0000..0000 I
> >> C B
> >> D 00..0000 Z
>
> I did not describe my concern correctly. Let me rephrase.
>
> Point reaches to B by scrolling up and as soon as auto-hscroll-mode is
> set to t, scope will be shifted to point C.
>
> I want to maintain scope with B instead of having scope with C before
> another scrolling.
If that's what you want, why do you need to turn auto-hscroll-mode
back on? Just leave it off.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-26 15:31 ` Eli Zaretskii
@ 2017-04-26 23:33 ` Tak Kunihiro
2017-04-27 2:36 ` Eli Zaretskii
0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2017-04-26 23:33 UTC (permalink / raw)
To: eliz; +Cc: tkk, 26599
>> >> Let’s consider a buffer consists of very long lines and an empty line.
>> >> Point starts from A with auto-hscroll-mode t.
>> >>
>> >> 0000..0000 A
>> >> 0000..0000 I
>> >> C B
>> >> D 00..0000 Z
>>
>> Point reaches to B by scrolling up and as soon as auto-hscroll-mode is
>> set to t, scope will be shifted to point C.
>>
>> I want to maintain scope with B instead of having scope with C before
>> another scrolling.
>
> If that's what you want, why do you need to turn auto-hscroll-mode
> back on? Just leave it off.
Yes. However, after wheel cruise with auto-hscroll-mode nil, I want
to start editing.
Sooner or later I want to use C-a to go outside of current scope.
This is the timing when I want to set auto-hscroll-mode nil. An event
from me should do it. The event must be some events besides
<wheel-up>, <wheel-down>, <wheel-right>, or <wheel-left>, and can be
C-a or <down-mouse-1>.
My picture is having a minor mode with keymap <down-mouse-1>
configured to set auto-hscroll-mode t.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-26 23:33 ` Tak Kunihiro
@ 2017-04-27 2:36 ` Eli Zaretskii
2017-04-27 5:27 ` Tak Kunihiro
0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2017-04-27 2:36 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26599
> Date: Thu, 27 Apr 2017 08:33:56 +0900 (JST)
> Cc: 26599@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>
> >> I want to maintain scope with B instead of having scope with C before
> >> another scrolling.
> >
> > If that's what you want, why do you need to turn auto-hscroll-mode
> > back on? Just leave it off.
>
> Yes. However, after wheel cruise with auto-hscroll-mode nil, I want
> to start editing.
>
> Sooner or later I want to use C-a to go outside of current scope.
> This is the timing when I want to set auto-hscroll-mode nil.
You have the horizontal-scroll commands to do that, right?
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-27 2:36 ` Eli Zaretskii
@ 2017-04-27 5:27 ` Tak Kunihiro
2017-04-27 14:25 ` Eli Zaretskii
0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2017-04-27 5:27 UTC (permalink / raw)
To: eliz; +Cc: 26599
>> >> I want to maintain scope with B instead of having scope with C before
>> >> another scrolling.
>> >
>> > If that's what you want, why do you need to turn auto-hscroll-mode
>> > back on? Just leave it off.
>>
>> Yes. However, after wheel cruise with auto-hscroll-mode nil, I want
>> to start editing.
>>
>> Sooner or later I want to use C-a to go outside of current scope.
>> This is the timing when I want to set auto-hscroll-mode t.
>
> You have the horizontal-scroll commands to do that, right?
Yes.
I consider two devices to scroll, that are keyboard and mouse.
Keyboard is the primary scroll device. Thus I want to turn
auto-hscroll-mode t by default.
Occasionally I want to use mouse as scroll device. When I use mouse,
I want to set turn auto-hscroll-mode nil, especially after
implementation of <wheel-right> and <wheel-left>.
When I come back to keyboard, I want to set auto-hscroll-mode t again.
| device | auto-hscroll-mode |
|----------+-------------------|
| keyboard | t |
| mouse | nil |
| keyboard | t |
| mouse | nil |
| keyboard | t |
To do so, I want to call minor-mode on `mwheel-scroll'.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-27 5:27 ` Tak Kunihiro
@ 2017-04-27 14:25 ` Eli Zaretskii
2017-04-27 23:16 ` Tak Kunihiro
0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2017-04-27 14:25 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26599
> Date: Thu, 27 Apr 2017 14:27:31 +0900 (JST)
> Cc: 26599@debbugs.gnu.org
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>
> > You have the horizontal-scroll commands to do that, right?
>
> Yes.
>
> I consider two devices to scroll, that are keyboard and mouse.
>
> Keyboard is the primary scroll device. Thus I want to turn
> auto-hscroll-mode t by default.
>
> Occasionally I want to use mouse as scroll device. When I use mouse,
> I want to set turn auto-hscroll-mode nil, especially after
> implementation of <wheel-right> and <wheel-left>.
>
> When I come back to keyboard, I want to set auto-hscroll-mode t again.
This looks like a very specialized use case, so I'm not sure we need a
solution for it in Emacs.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-27 14:25 ` Eli Zaretskii
@ 2017-04-27 23:16 ` Tak Kunihiro
2017-04-28 6:47 ` Eli Zaretskii
0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2017-04-27 23:16 UTC (permalink / raw)
To: eliz; +Cc: tkk, 26599
>> > You have the horizontal-scroll commands to do that, right?
>>
>> Yes.
>>
>> I consider two devices to scroll, that are keyboard and mouse.
>>
>> Keyboard is the primary scroll device. Thus I want to turn
>> auto-hscroll-mode t by default.
>>
>> Occasionally I want to use mouse as scroll device. When I use mouse,
>> I want to set turn auto-hscroll-mode nil, especially after
>> implementation of <wheel-right> and <wheel-left>.
>>
>> When I come back to keyboard, I want to set auto-hscroll-mode t again.
>
> This looks like a very specialized use case, so I'm not sure we need a
> solution for it in Emacs.
I see how you see.
How I described, is similar to how spreadsheet program reacts. It
lets user scroll both by <wheel-left> and <left>.
I very often edit a buffer with long and short line (for example,
LaTeX table), using mouse and keyboard. However, as you infer, this
can be already very special.
Isn't my description convincing enough to install the line that
invokes the minor mode `touchpad-disable--auto-hscroll-mode'?
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-27 23:16 ` Tak Kunihiro
@ 2017-04-28 6:47 ` Eli Zaretskii
2017-04-28 9:12 ` Tak Kunihiro
0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2017-04-28 6:47 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26599
> Date: Fri, 28 Apr 2017 08:16:00 +0900 (JST)
> Cc: 26599@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>
> >> Keyboard is the primary scroll device. Thus I want to turn
> >> auto-hscroll-mode t by default.
> >>
> >> Occasionally I want to use mouse as scroll device. When I use mouse,
> >> I want to set turn auto-hscroll-mode nil, especially after
> >> implementation of <wheel-right> and <wheel-left>.
> >>
> >> When I come back to keyboard, I want to set auto-hscroll-mode t again.
> >
> > This looks like a very specialized use case, so I'm not sure we need a
> > solution for it in Emacs.
>
> I see how you see.
>
> How I described, is similar to how spreadsheet program reacts. It
> lets user scroll both by <wheel-left> and <left>.
>
> I very often edit a buffer with long and short line (for example,
> LaTeX table), using mouse and keyboard. However, as you infer, this
> can be already very special.
What makes this special is that you want Emacs to work differently
depending on the input device. Emacs normally makes a significant
effort in the other direction: to produce the same behavior no matter
where input came from.
I'm not sure we want to have such unusual behavior as part of Emacs.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-28 6:47 ` Eli Zaretskii
@ 2017-04-28 9:12 ` Tak Kunihiro
2017-05-19 8:55 ` Eli Zaretskii
0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2017-04-28 9:12 UTC (permalink / raw)
To: eliz; +Cc: tkk, 26599
[-- Attachment #1: Type: Text/Plain, Size: 1313 bytes --]
>> >> Keyboard is the primary scroll device. Thus I want to turn
>> >> auto-hscroll-mode t by default.
>> >>
>> >> Occasionally I want to use mouse as scroll device. When I use mouse,
>> >> I want to set turn auto-hscroll-mode nil, especially after
>> >> implementation of <wheel-right> and <wheel-left>.
>> >>
>> >> When I come back to keyboard, I want to set auto-hscroll-mode t again.
>> >
>> > This looks like a very specialized use case, so I'm not sure we need a
>> > solution for it in Emacs.
>>
>> I see how you see.
>>
>> How I described, is similar to how spreadsheet program reacts. It
>> lets user scroll both by <wheel-left> and <left>.
>>
>> I very often edit a buffer with long and short line (for example,
>> LaTeX table), using mouse and keyboard. However, as you infer, this
>> can be already very special.
>
> What makes this special is that you want Emacs to work differently
> depending on the input device. Emacs normally makes a significant
> effort in the other direction: to produce the same behavior no matter
> where input came from.
>
> I'm not sure we want to have such unusual behavior as part of Emacs.
Can you take a look minor-mode that I want to invoke by hook? I still
think this is potentially useful to mouse-loving cloud using
<wheel-left> and <wheel-right>.
[-- Attachment #2: touchpad.el --]
[-- Type: Text/Plain, Size: 7601 bytes --]
;;; touchpad.el --- Scroll two dimensionally by touchpad
;; Copyright (C) 2017 Tak Kunihiro
;; Author: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
;; Maintainer: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
;; URL: http://dream.misasa.okayama-u.ac.jp
;; Package-Requires: ((emacs "26.1"))
;; Version: 1.0.0
;; Package-Version: 20170427.1515
;; Keywords: mouse, scroll
;;; This file is NOT part of GNU Emacs
;;; License
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;; Commentary:
;; To interactively toggle the mode:
;;
;; M-x touchpad-mode
;;
;; To make the mode permanent, add the following lines to your init
;; file.
;;
;; (require 'touchpad)
;; (touchpad-mode 1)
;;
;; This package offers a global minor mode which makes swiping
;; touchpad scroll smoothly. This package disables
;; `auto-hscroll-mode' during scroll because of following two aspects.
;; (1) 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.
;; (2) 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 (1).
;; After scroll, you want to set `auto-hscroll-mode' back again
;; otherwise too inconvenient for further edition. Approach of this
;; package is to turn on another minor-mode `touchpad--2d-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.
;;; Change Log:
;; 20170409.1204
;; - (setq scroll-conservatively 100) on minor mode may work as backup
;;; Todo:
;; - Release as a package
(require 'mwheel)
;;; Code:
(defvar touchpad--cursor-type cursor-type
"Cursor used by user. This variable is used internally to
restore original `cursor-type'.")
(define-minor-mode touchpad-mode
"A minor mode to scroll text two dimensionally. With a prefix argument ARG,
enable Touchpad Mode if ARG is positive, and disable it
otherwise. If called from Lisp, enable Touchpad Mode if ARG is
omitted or nil."
:init-value nil
:group 'scrolling
:global t
(if touchpad-mode
(progn
(advice-add 'mwheel-scroll :before 'touchpad-enable--2d-mode)
;; (add-hook 'mwheel-pre-scroll-hook 'touchpad-enable--2d-mode)
(setq mwheel-tilt-scroll-p t))
(advice-remove 'mwheel-scroll #'touchpad-enable--2d-mode)
;; (remove-hook 'mwheel-pre-scroll-hook 'touchpad-enable--2d-mode)
(dolist (var '(mwheel-tilt-scroll-p))
(custom-reevaluate-setting var))))
;; (defun touchpad-enable--2d-mode ()
;; "Enable minor mode `touchpad--2d-mode' to disable
;; `auto-hscroll-mode'. This is supposed to be called before actual
;; scrolling."
;; (let ((buffer (window-buffer (mwheel-event-window last-input-event))))
;; (with-current-buffer buffer
;; (touchpad--2d-mode 1)))) ; turn on minor-mode
(defun touchpad-enable--2d-mode (func &rest args)
"Enable minor mode `touchpad--2d-mode' to disable
`auto-hscroll-mode'. This is supposed to be adviced before
`mwheel-scroll'."
(let ((buffer (window-buffer (mwheel-event-window last-input-event))))
(with-current-buffer buffer
(touchpad--2d-mode 1)))) ; turn on minor-mode
(defun touchpad-disable--2d-mode ()
"Disable minor mode `touchpad--2d-mode' to enable
`auto-hscroll-mode' back. Then invoke command that is bound to
the original key."
(interactive)
(touchpad--2d-mode 0) ; turn off minor-mode
(call-interactively (key-binding (this-command-keys))))
(define-minor-mode touchpad--2d-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] 'touchpad-disable--2d-mode)
(define-key map [remap mouse-set-point] 'touchpad-disable--2d-mode)
(define-key map [remap right-char] 'touchpad-disable--2d-mode)
(define-key map [remap forward-char] 'touchpad-disable--2d-mode)
(define-key map [remap forward-word] 'touchpad-disable--2d-mode)
(define-key map [remap forward-sentence] 'touchpad-disable--2d-mode)
(define-key map [remap forward-paragraph] 'touchpad-disable--2d-mode)
(define-key map [remap forward-page] 'touchpad-disable--2d-mode)
(define-key map [remap left-char] 'touchpad-disable--2d-mode)
(define-key map [remap backward-char] 'touchpad-disable--2d-mode)
(define-key map [remap backward-word] 'touchpad-disable--2d-mode)
(define-key map [remap backward-sentence] 'touchpad-disable--2d-mode)
(define-key map [remap backward-paragraph] 'touchpad-disable--2d-mode)
(define-key map [remap backward-page] 'touchpad-disable--2d-mode)
(define-key map [remap move-beginning-of-line] 'touchpad-disable--2d-mode)
(define-key map [remap move-end-of-line] 'touchpad-disable--2d-mode)
(define-key map [remap next-line] 'touchpad-disable--2d-mode)
(define-key map [remap next-error] 'touchpad-disable--2d-mode)
(define-key map [remap scroll-up-command] 'touchpad-disable--2d-mode)
(define-key map [remap previous-line] 'touchpad-disable--2d-mode)
(define-key map [remap previous-error] 'touchpad-disable--2d-mode)
(define-key map [remap scroll-down-command] 'touchpad-disable--2d-mode)
(define-key map [remap beginning-of-defun] 'touchpad-disable--2d-mode)
(define-key map [remap beginning-of-buffer] 'touchpad-disable--2d-mode)
(define-key map [remap end-of-defun] 'touchpad-disable--2d-mode)
(define-key map [remap end-of-buffer] 'touchpad-disable--2d-mode)
(define-key map [remap goto-char] 'touchpad-disable--2d-mode)
(define-key map [remap goto-line] 'touchpad-disable--2d-mode)
(define-key map [remap move-to-column] 'touchpad-disable--2d-mode)
;; list as much as think of ... or map all but
;; (where-is-internal 'mwheel-scroll)?
map)
:group 'scrolling
(if touchpad--2d-mode
(progn
(setq-local auto-hscroll-mode nil)
(setq-local cursor-type 'hollow))
(setq-local auto-hscroll-mode t)
(setq-local cursor-type touchpad--cursor-type)))
(provide 'touchpad)
;;; touchpad.el ends here
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-04-28 9:12 ` Tak Kunihiro
@ 2017-05-19 8:55 ` Eli Zaretskii
2019-06-24 16:38 ` Lars Ingebrigtsen
0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2017-05-19 8:55 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 26599
> Date: Fri, 28 Apr 2017 18:12:50 +0900 (JST)
> Cc: 26599@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>
> > What makes this special is that you want Emacs to work differently
> > depending on the input device. Emacs normally makes a significant
> > effort in the other direction: to produce the same behavior no matter
> > where input came from.
> >
> > I'm not sure we want to have such unusual behavior as part of Emacs.
>
> Can you take a look minor-mode that I want to invoke by hook? I still
> think this is potentially useful to mouse-loving cloud using
> <wheel-left> and <wheel-right>.
I'm okay with adding this to ELPA.
Thanks.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2017-05-19 8:55 ` Eli Zaretskii
@ 2019-06-24 16:38 ` Lars Ingebrigtsen
2020-01-20 20:06 ` Stefan Kangas
0 siblings, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-24 16:38 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Tak Kunihiro, 26599
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Fri, 28 Apr 2017 18:12:50 +0900 (JST)
>> Cc: 26599@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp
>> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>>
>> > What makes this special is that you want Emacs to work differently
>> > depending on the input device. Emacs normally makes a significant
>> > effort in the other direction: to produce the same behavior no matter
>> > where input came from.
>> >
>> > I'm not sure we want to have such unusual behavior as part of Emacs.
>>
>> Can you take a look minor-mode that I want to invoke by hook? I still
>> think this is potentially useful to mouse-loving cloud using
>> <wheel-left> and <wheel-right>.
>
> I'm okay with adding this to ELPA.
But for this minor mode to work, I think mwheel-pre-scroll-hook had to
be implemented, if I understood correctly?
This is two years old, though, so I'm not sure any of this is still an
issue...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2019-06-24 16:38 ` Lars Ingebrigtsen
@ 2020-01-20 20:06 ` Stefan Kangas
2020-01-20 22:47 ` Juri Linkov
0 siblings, 1 reply; 24+ messages in thread
From: Stefan Kangas @ 2020-01-20 20:06 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Tak Kunihiro, 26599
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> Date: Fri, 28 Apr 2017 18:12:50 +0900 (JST)
>>> Cc: 26599@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp
>>> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
>>>
>>> > What makes this special is that you want Emacs to work differently
>>> > depending on the input device. Emacs normally makes a significant
>>> > effort in the other direction: to produce the same behavior no matter
>>> > where input came from.
>>> >
>>> > I'm not sure we want to have such unusual behavior as part of Emacs.
>>>
>>> Can you take a look minor-mode that I want to invoke by hook? I still
>>> think this is potentially useful to mouse-loving cloud using
>>> <wheel-left> and <wheel-right>.
>>
>> I'm okay with adding this to ELPA.
>
> But for this minor mode to work, I think mwheel-pre-scroll-hook had to
> be implemented, if I understood correctly?
>
> This is two years old, though, so I'm not sure any of this is still an
> issue...
That was over 7 months ago. Is there still any interest in adding
this package to ELPA? Thanks.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2020-01-20 20:06 ` Stefan Kangas
@ 2020-01-20 22:47 ` Juri Linkov
2020-01-21 7:17 ` Tak Kunihiro
0 siblings, 1 reply; 24+ messages in thread
From: Juri Linkov @ 2020-01-20 22:47 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Lars Ingebrigtsen, Tak Kunihiro, 26599
> That was over 7 months ago. Is there still any interest in adding
> this package to ELPA? Thanks.
It seems this is about the built-in package mwheel.el where
mouse-wheel-scroll-amount could support the option 'hscroll'
like proposed in bug#28182.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2020-01-20 22:47 ` Juri Linkov
@ 2020-01-21 7:17 ` Tak Kunihiro
2020-01-21 9:46 ` Stefan Kangas
0 siblings, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2020-01-21 7:17 UTC (permalink / raw)
To: Stefan Kangas
Cc: Lars Ingebrigtsen, 国広卓也, 26599,
Juri Linkov
I wanted to set auto-hscroll-mode to nil, only during 2D scroll
(hscroll-and-vscroll mixed one) using mouse. Since 2D scroll is
unusable when auto-hscroll-mode is t, I thought what I wanted was
implicit voice of all mouse lovers...apparently was not.
I'm good without the hook nor ELPA.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
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:52 ` Tak Kunihiro
0 siblings, 2 replies; 24+ messages in thread
From: Stefan Kangas @ 2020-01-21 9:46 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: Lars Ingebrigtsen, 26599, Juri Linkov
Hi Tak,
Tak Kunihiro <tkk@misasa.okayama-u.ac.jp> writes:
> I wanted to set auto-hscroll-mode to nil, only during 2D scroll
> (hscroll-and-vscroll mixed one) using mouse. Since 2D scroll is
> unusable when auto-hscroll-mode is t, I thought what I wanted was
> implicit voice of all mouse lovers...apparently was not.
>
> I'm good without the hook nor ELPA.
Thank you for your reply.
Please don't interpret the long response times here as a sign that
your package is not welcome. I think we are all in favour of
improving mouse and/or trackpad support in Emacs, something which
would clearly benefit a significant subset of users. Unfortunately,
we often have the problem that we lack the necessary resources to
follow up on all bug reports in a timely manner.
I think we should try to make progress here, and get your package into
ELPA, in order that people can start using it.
To move this ahead, if I understand things correctly, there is only
one important question left to resolve, namely that of a hook in
mwheel.el. Reading your code, I see that you have two commented out
lines running the hook `mwheel-pre-scroll-hook'. Could you please
provide a patch or instructions for where to add this hook in
mwheel.el?
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
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
1 sibling, 1 reply; 24+ messages in thread
From: Tak Kunihiro @ 2020-01-22 5:46 UTC (permalink / raw)
To: 26599
Cc: Lars Ingebrigtsen, 国広卓也,
Stefan Kangas, Juri Linkov
Dear Stefan,
Before discussions about hook, I want to insist again that on 2D mouse
browsing and on keyboard editing, auto-hscroll-mode should be set to
nil and non-nil, respectively. Otherwise 2D scroll by mwheel is not
helpful.
Eli inferred Emacs does not prefer to respond differently to different
input devices. That makes sense too.
How do you think about user experience on 2D scrolling with (setq
mouse-wheel-tilt-scroll t) or typing with (setq
mouse-wheel-tilt-scroll nil)?
emacs -Q
M-x eww
www.gnu.org/gnu/gnu.html
M-: (set-window-hscroll (selected-window) 50)
M-: (setq mouse-wheel-tilt-scroll t)
2D scrolling by mwheel --> Soon scope moves to left.
M-: (setq auto-hscroll-mode nil)
2D scrolling by mwheel ... good
Move point using keyboard ... Scope never changes.
Tak
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2020-01-22 5:46 ` Tak Kunihiro
@ 2020-03-13 23:43 ` Tak Kunihiro
0 siblings, 0 replies; 24+ messages in thread
From: Tak Kunihiro @ 2020-03-13 23:43 UTC (permalink / raw)
To: 26599; +Cc: Lars Ingebrigtsen, tkk, Stefan Kangas, Juri Linkov
I cannot reproduce the problem with `emacs -Q`. I found that this is my
local problem; thus no one would be bothered with two dimensional
scrolling. Two dimensional scrolling is good. I apologize to sustain
such a long noise. No hook and no ELPA are necessary.
^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#26599: patch for mwheel.el
2020-01-21 9:46 ` Stefan Kangas
2020-01-22 5:46 ` Tak Kunihiro
@ 2020-03-13 23:52 ` Tak Kunihiro
1 sibling, 0 replies; 24+ messages in thread
From: Tak Kunihiro @ 2020-03-13 23:52 UTC (permalink / raw)
To: 26599; +Cc: tkk
tags 26599 unreproducible
close 26599
^ 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).