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)?

2
  • Because I have emacs full screen (with multiple monitors) and so there is no title bar or edge :) – Prgrm.celeritas Feb 8 '19 at 19:54
  • Also I will often click on the window I want to select. – Prgrm.celeritas Feb 8 '19 at 22:25
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]))

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.