2

My Setup

  • Emacs 28.1
  • Evil version 1.15.0
  • Gnome 42.4 wayland

Observed Behavior

  • In default emacs (GUI), with no init file, if you highlight a region with mouse 1 and then use a keyboard movement, the highlighted region disappears.

  • If you load evil and nothing else, then do the same, the region does not disappear and, in fact, will be extended as you move from the keyboard. In addition, the i command does not work to get into insert mode. This behavior is the same as it would be if you had used v to highlight the region instead of the mouse.

The latter behavior is problematic for my workflow because if I'm working in another window and click over to emacs, I often inadvertently highlight at least a little bit of text. I then get confused when I can't insert and there is a region following me around like I stepped on something sticky.

I'm having a hard time zeroing in on why this behavior occurs or finding a way to make the highlighted region behave the same as it would under non-evil Emacs. Do you know if this is a bug or an expected evil behavior? How would I go about changing it?

=== EDIT ===

I just tried this in gvim and the behavior is the same as the default behavior in evil. Evil considers deviation from the way things work in vim to be a bug, so my guess is this was implemented this way on purpose. I would still love to know how to un-implement it. Anyone who has another idea on where to look for the source of this will be a hero.

1
  • 1
    I am able to reproduce the behavior. I suspect a bad setting for the variable transient-mark-mode (which see). I'm not an evil user myself, but in my basic test, it looked like dragging the mouse invoked both evil-mouse-drag-region and mouse-set-region (which I learned via C-h k and then dragging to set a selection). I can't tell whether that is expected or not, but maybe it gives you (or someone else) a thread to pull.
    – nispio
    Oct 10, 2022 at 21:12

1 Answer 1

1

The evil folks have addressed this issue--gotta love the emacs community. You can now change the behavior so that text highlighted by the mouse will become unhighlighted when a keyboard command is issued. You need to put the following in your init

(setq evil-transient-mouse-selection t)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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