Skip to content

Footer region shown in gptel-menu transient changes on first keypress while evil-mode is turned on #1985

@EyoelYT

Description

@EyoelYT

Related: karthink/gptel#909

Description
While using evil-mode, I noticed that the region info displayed in the footer of the gptel-menu transient (from karthink/gptel) is correct when the menu opens, but as soon as I press the first key inside that transient (e.g. n, p, TAB, arrow keys), the footer’s region display jumps to a different region. I initially reported this to the transient maintainer, who suggested it might be an evil-mode thing.

Steps to reproduce

  1. Start Emacs 30.1 with evil-mode enabled.
  2. In any buffer, select a region using M-x evil-visual-line.
  3. Invoke the gptel-menu: M-x gptel-menu.
  4. Observe the footer: it correctly shows the active region.
  5. Press any key inside the transient (e.g. n, p, , arrow keys).
  6. Notice the footer’s region display immediately updates or resets, showing a different region.

Expected behavior
The footer’s region information should remain exactly as it was when the transient opened, regardless of keypresses inside the transient.

Actual behavior
On the very first keypress inside the transient, evil-mode appears to alter the active region or its reported bounds. The footer then displays this new (incorrect) region.

Environment

  • Emacs 30.1
  • transient 0.9.2
  • evil 1.15.0
  • gptel latest master

Note

  • I confirmed that transient itself is not deliberately modifying the region.
  • Disabling evil-mode (or using emacs-state) prevents the footer from changing its region display.
  • Additionally, using evil-visual-end and evil-visual-beginning instead of region-beginning and region-end when (evil-visual-state-p) returns t seems to alleviate this problem, but the maintainer insisted that this could be a bug within either transient or evil-mode, which is why I'm reaching out.

Is this behavior expected from evil? Or could it be a bug in how evil handles regions when a transient keymap is activated? I'd greatly appreciate any guidance on fixing or working around this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions