2

I often run into an issue where I will click in a Emacs frame to make it active and accidentally slide my cursor so that it changes from a click to a drag. This means that some text is highlighted which can change behavior of the next commands I run (I am using evil-mode, so this puts me into visual state, but this is applicable outside of evil mode as well).

I don't want to completely disable the mouse, as I find it quite useful I just want to disable selecting text on a drag operation. I tried the following, but it lead to weird behavior (when the pointer leaving frames it will select text and it will still select one character sometimes).

(define-key evil-motion-state-map [down-mouse-1] 'ignore)

Is there a way to accomplish disabling drag to select (in evil specifically or outside)?

Drew
  • 75,699
  • 9
  • 109
  • 225
Prgrm.celeritas
  • 849
  • 6
  • 15

1 Answers1

0

If I understand you correctly, you want to set the point on click but not set the region on drag.

You can enable this behaviour globally with:

(progn
  (global-set-key [mouse-1] 'mouse-set-point)
  (global-unset-key [down-mouse-1])
  (global-unset-key [drag-mouse-1]))
halloleo
  • 1,215
  • 9
  • 23