8

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?

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.