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.

  • Are you using Emacs in a terminal?
    – user12563
    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)
    – user12563
    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: emacs.stackexchange.com/questions/36024/… without success in my init file. Here: emacs.stackexchange.com/questions/36024/… 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

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"
  (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>"))
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.