2012-04-05 64 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