11

I noticed two keys: [mouse-1] and [down-mouse-1].

When I use describe-key with a single click, it shows:

There were several key-sequences:

  <down-mouse-1> at that spot runs the command evil-mouse-drag-region
  <mouse-1> at that spot runs the command mouse-set-point

If I want to bind a function to a single click event, which key is better?

Besides, when clicking the mouse, how to only trigger a single key sequence, either <down-mouse-1> or <mouse-1> but not both?

Drew
  • 75,699
  • 9
  • 109
  • 225
FunkyBaby
  • 767
  • 1
  • 4
  • 10

1 Answers1

7

down-mouse-1 is a "button-down" event which is generated immediately when you press the mouse button.

mouse-1 is a "click" event, which is generated if you release the button at the same position as the "button-down" event.

drag-mouse-1 is a "drag" event which would be generated if you released the button at a different position.

You can learn about these and more at C-hig (elisp)Input Events

phils
  • 48,657
  • 3
  • 76
  • 115