ergoemacs / ergoemacs-mode

ergoemacs-mode
ergoemacs.github.io/
GNU General Public License v3.0
293 stars 35 forks source link

mouse-4 and mouse-5 does not work in terminal #414

Closed ghost closed 7 years ago

ghost commented 8 years ago

within a xterm with ergoemacs-mode enabled, as long as xterm-mouse-mode is set to true, the following setting no longer works:

(unless window-system
  (require 'mouse)
  **(xterm-mouse-mode t)**
  (global-set-key [mouse-4] '(lambda ()
                              (interactive)
                              (scroll-down 1)))
  (global-set-key [mouse-5] '(lambda ()
                              (interactive)
                              (scroll-up 1)))
  (defun track-mouse (e))
  (setq mouse-sel-mode t)
  )

the following warning keep popping out:

ergoemacs-command-loop--decode-event: Wrong number of arguments: #[(_event) "ÀÁ!\207" [xterm-mouse-translate-1 1006] 2 ("/usr/local/Cellar/emacs/25.0.9\ 0/share/emacs/25.0.90/lisp/xt-mouse.elc" . 598)], 0Error during redisplay: (eval (ergoemacs-status--eval)) signaled (wrong-type-argument sequencep 6177\ 7) [23 times] it seems that the ergoemacs-command-loop does not work well with mouse events.

The main purpose to use (xterm-mouse-mode t) is to enable rich mouse interaction in a terminal environment.

env: OSX, xterm2

mattfidler commented 8 years ago

I can't test this on windows, but this should fix your issue.

mattfidler commented 8 years ago

Its not actually related to the mouse, so make sure it works...

ghost commented 8 years ago

Thanks for the rapid fix! The error no longer appear anymore. It probably related to iterm2 + emacs + OSX, mouse-* key binding still not work yet in combination with ergoemacs.

I have used the following minimised setting.

;; Enable mouse support
(unless window-system
  (require 'mouse)1
  (xterm-mouse-mode t) ;;
  (global-set-key [mouse-4] '(lambda ()
                                  (interactive)
                                  (scroll-down 1)))
  (global-set-key [mouse-5] '(lambda ()
                                  (interactive)
                                  (scroll-up 1)))
)

(require 'ergoemacs-mode)
(setq ergoemacs-theme nil)
(setq ergoemacs-keyboard-layout "us")
(ergoemacs-mode 1)

mouse-[4, 5] will not trigger the proper function

mattfidler commented 8 years ago

Does it trigger the proper function without ergoemacs-mode enabled? I read some of the code and I'm unsure I term would send the required escape codes to translate the mouse events. It may require xterm.

ghost commented 8 years ago

It works while comment out ergoemacs-mode

mattfidler commented 8 years ago

Could you try the mouse-3 and mouse-4 events and see what messages are shown in the Messages buffer?

mattfidler commented 7 years ago

This should be fixed with the most recent version of ergoemacs-mode. Let me know if it doesn't work.