2012-04-05 71 views
3

我想在emacs中使用两个手指侧滑手势。对于向上和向下滑动,它们被绑定到[mouse-4][mouse-5]。是否有另一个绑定为两个手指侧滑动?如果没有,是否有任何事件在two finger mouse运动中触发?谢谢。在emacs lisp中使用侧滑手势

+0

什么操作系统?zzzzzzzz – 2012-04-05 11:42:30

+0

osx.zzzzzzzzzzzzzzzz – Doboy 2012-04-05 18:20:31

+0

你如何让您的Emacs?你使用的是什么版本的Emacs?你对Unix构建工具链感到满意吗? – 2012-04-06 01:26:04

回答

2

我认为这是可能的,但我不认为Emacs默认了解触摸板的任何信息。你刷卡上下车时看到的事件是鼠标滚轮上/下事件:

`(wheel-up POSITION)' 

`(wheel-down POSITION)' 
    These kinds of event are generated by moving a mouse wheel. Their 
    usual meaning is a kind of scroll or zoom. 

    The element POSITION is a list describing the position of the 
    event, in the same format as used in a mouse-click event (*note 
    Click Events::). 

    This kind of event is generated only on some kinds of systems. On 
    some systems, `mouse-4' and `mouse-5' are used instead. For 
    portable code, use the variables `mouse-wheel-up-event' and 
    `mouse-wheel-down-event' defined in `mwheel.el' to determine what 
    event types to expect for the mouse wheel. 

M-:(info "(elisp) Misc Events")RET

+0

FWIW,我并不期待这个答案被接受;我只是想澄清你实际看到的。我认为如何以Emacs的形式发送触摸板事件是一个很好的选择(虽然可能有一个具有各种操作系统特定的解决方案),而且我没有回答这个问题,这应该可能仍然开放。 – phils 2012-04-06 12:24:13

2

这听起来像你问mouse gestures,或多或少。如果是这样,那么答案是肯定的。 Emacs支持鼠标手势:库strokes.el和次要模式strokes-mode就是这样。以下是文档字符串:

切换笔划模式,全局次要模式。 使用前缀参数ARG,如果ARG为 为正值,则启用Strokes模式,否则将其禁用。如果从Lisp调用,则在缺省ARG或零时启用 模式。

Strokes are pictographic mouse gestures which invoke commands. 
Strokes are invoked with S-down-mouse-2. You can define 
new strokes with M-x strokes-global-set-stroke. See also 
M-down-mouse-2 for `complex' strokes. 

To use strokes for pictographic editing, such as Chinese/Japanese, use 
M-x strokes-compose-complex-stroke, which draws strokes and inserts them. 
Encode/decode your strokes with M-x strokes-encode-buffer, 
M-x strokes-decode-buffer. 

key    binding 
---    ------- 

<M-down-mouse-2>    strokes-do-complex-stroke 
<S-down-mouse-2>    strokes-do-stroke 
0

这就是我在OSX 10.6.8上上下滚动的方式。

(global-set-key [(wheel)] 'mwheel-scroll) ;; magic mouse track-pad