0

When I try to scroll with mouse I receive a message saying Wrong type argument: commandp, mouse-5 or Wrong type argument: commandp, mouse-4. This happens after I tried a lot of random fixes. Before the message was something like C-M-) and C-M-( is undefined.

But... If I press CTRL while mouse scrolling, it works fine as expected.

How can I fix that? Thank you.

Felipe
  • 241
  • 1
  • 13
  • Are you using Emacs in a terminal? –  Apr 22 '19 at 10:52
  • Emacs GUI. I tried to use on Emacs -nw and when I tried to scroll I got it: (((((((())))))
    ((((((((((((())))
    )))))))))))
    – Felipe Apr 22 '19 at 10:54
  • Have you tried running Emacs without your init file? (emacs -q) –  Apr 22 '19 at 10:58
  • Yes. But I get the message C-M-) (scroll down) and C-M-( (scroll up). I was trying solution in this post: https://emacs.stackexchange.com/questions/36024/mouse-wheel-not-working-with-new-mouse without success in my init file. Here: https://emacs.stackexchange.com/questions/36024/mouse-wheel-not-working-with-new-mouse#comment56803_36036 I discovered that if I press CTRL everything works fine. – Felipe Apr 22 '19 at 11:02
  • Can you show us the output of C-h l right after you used the wheel? – Stefan Apr 23 '19 at 15:29
  • If I use Emacs GUI I obtain: https://pastebin.com/yz3wYNYR and if I use emacs -nw (terminal) I get: https://pastebin.com/czyMLDCq – Felipe Apr 26 '19 at 22:57

1 Answers1

1

May not be helpful, but I have the following in my init file to fix a scroll-wheel issue on Lubuntu. I was using an older Logitech mouse at the time. You'll probably have to adjust <mouse-11>/<mouse-12>.

(when (and (string= system-name "foo"
           (window-system))
  (global-set-key (kbd "<mouse-11>") (kbd "<mouse-4>"))
  (global-set-key (kbd "<mouse-12>") (kbd "<mouse-5>")))

OP EDIT (the final code, in my case, that fits my original question):

;; Fix mouse wheel
(global-set-key (kbd "C-M-(") (kbd "<mouse-4>"))
(global-set-key (kbd "C-M-)") (kbd "<mouse-5>"))
Felipe
  • 241
  • 1
  • 13
nega
  • 3,221
  • 15
  • 21
  • You can probably get it to work slightly more reliably if you use (define-key function-key-map (kbd "<mouse-11>") (kbd "<mouse-4>")) instead of global-set-key. – Stefan Apr 23 '19 at 15:30