Unfortuantely, it is not as simple because the user could have Emacs running as a daemon, connecting with both GUI and terminal clients in which case one of them won't work. In fact, using the above command to start a daemon and then connecting with a GUI client will cause Bad binding in mwheel-scroll upon scrolling.
I tried fixing this by changing mouse-wheel-(down|up)-event in focus-in-hook depending on the (window-system (selected-frame)) but this crashes Emacs with segmentation fault upon switching between frames.
The easiest reproducer is to launch Emacs like this and then scroll using the mouse wheel
It works fine in GUI Emacs but terminal Emacs will report
This is due to https://github.com/masm11/emacs/blob/3df4ca451d41a5f1036713277ef55ca9734c6fa7/lisp/mwheel.el#L54-L70 which unconditionally maps the scroll events to
'wheel-up
and'wheel-down
whenpgtk
is active.A quick fix would be something like
Unfortuantely, it is not as simple because the user could have Emacs running as a daemon, connecting with both GUI and terminal clients in which case one of them won't work. In fact, using the above command to start a daemon and then connecting with a GUI client will cause
Bad binding in mwheel-scroll
upon scrolling.I tried fixing this by changing
mouse-wheel-(down|up)-event
infocus-in-hook
depending on the(window-system (selected-frame))
but this crashes Emacs with segmentation fault upon switching between frames.Related thread on Emacs Stack Exchange: https://emacs.stackexchange.com/questions/64935/mwheel-scroll-bindings-between-gui-and-terminal
I'm running this version of Emacs: https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=feature/pgtk&id=13a9a5e836cbe6e64aadaba40fe1f7eb83320d08