Emacs鼠标-5绑定问题(向下滚动)

时间:2011-11-07 17:46:17

标签: emacs

我将此添加到我的配置文件中以修复滚动并为文本缩放添加一些技巧但是鼠标5和M-mouse-5和C-mouse-5不起作用。我仍然可以看到消息:<mouse-5>未定义等等...为什么它对鼠标5不起作用?我该如何绑定mouse-5?

;; ===== Scrolling fix for advanced mouses =============================
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)
; Scroll up five lines with META held
(global-set-key [M-mouse-4] 'down-slightly)
(global-set-key [M-mouse-5] 'up-slightly)
; Scroll up one line with SHIFT held
(defun up-one () (interactive) (scroll-up 1))
(defun down-one () (interactive) (scroll-down 1))
(global-set-key [S-mouse-4] 'down-one)
(global-set-key [S-mouse-5] 'up-one)
; Scroll up one page with CTRL held
;;(defun up-a-lot () (interactive) (scroll-up))
;;(defun down-a-lot () (interactive) (scroll-down))
;;(global-set-key [C-mouse-4] 'down-a-lot)
;;(global-set-key [C-mouse-5] 'up-a-lot)
(global-set-key (kbd "<C-mouse-4>") 'text-scale-decrease)
(global-set-key (kbd "<C-mouse-5>") 'text-scale-increase)
  

app-editors / emacs-23.3-r2 USE =“X alsa dbus gif gpm gtk jpeg png sound   tiff xft xpm -Xaw3d(-aqua)-athena -gconf -gzip-el -hesiod -kerberos   -livecd -m17n-lib -motif -source -svg -toolkit-scroll-bars“

1 个答案:

答案 0 :(得分:4)

我喜欢使用kbd宏b / c,您可以使用 C-h k 剪切并粘贴您获得的密钥的名称。所以试试这个:

(global-set-key (kbd "<mouse-4>") 'down-slightly)
(global-set-key (kbd "<mouse-5>") 'up-slightly)