error: one of my transients misplaces cursor activity

Table of Contents

Repo Bug-Report Template

magit-version: Magit v3.3.0-402-gacd26dd9, Git 2.36.1, Emacs 28.1, gnu/linux

(1) what behavior you expected

When I use a transient with

:transient-non-suffix 'transient--do-quit-one
:transient-suffix 'transient--do-stay  

I expect to be able to continue using transient commands regardless of what buffer-switches are occurring above the transient.

(2) what behavior you observed

After executing a buffer-switching command within my transient, such as find-file, the transient remains visible but no longer has focus and cannot be used/switched to.

(3) and how we can reproduce the issue.

Attempt one of the following misbehaving commands:

  ;; this is bound to <f2>
     (transient-define-prefix tsa/transient-window ()
       "Window navigation transient"
       :transient-non-suffix 'transient--do-quit-one
       :transient-suffix 'transient--do-stay  
       [["Switch"
         ("b" "buffer" switch-to-buffer) ;; FOCUS MISBEHAVIOR
         ("f" "find-file" find-file) ;; FOCUS MISBEHAVIOR
]
         ])

Explanation

One of my transients has recently changed behavior, and is very bothersome. Normally I would use it to choose a file from the project and then, with the transient menu staying open after visiting the file, I can press the another transient key and do that thing. But no more.

Now, after visiting a file, it looks the same as before – meaning, the transient stays open at the bottom of the screen – but my cursor has now moved to the file itself and attempting to press one of the transient keys just inserts that character into the buffer, as if transient wasn’t there. I then usually hav to get rid of the inaccessible transient menu by calling another transient and cancelling it immediately, after which my screen has returned to full no-transient normal. And there is no way to resume my old ideal work-flow in which I can stay in the transient, consecutively changing buffers/finding files.

Why would this one command be now causing my transient to lose focus without visibly exiting?

Code:

;; this is bound to <f2>
   (transient-define-prefix tsa/transient-window ()
     "Window navigation transient"
     :transient-non-suffix 'transient--do-quit-one
     :transient-suffix 'transient--do-stay  
     [["Switch"
       ("b" "buffer" switch-to-buffer) ;; FOCUS MISBEHAVIOR
       ("f" "find-file" find-file) ;; FOCUS MISBEHAVIOR
       ("p" "projectile" tsa/projectile) ;; FOCUS MISBEHAVIOR
       ("g" "git-grep" consult-git-grep)
       ("F" "follow" follow-mode)
       ("a" "ace 1" transient-ace-cmd)]
       ])

Suffix problems?

I have found that changing functions, or even using a completely different function in this transient, has the same problem. For instance, it’s the same thing with a transient key for `find-file`: upon finding one, the transient menu is still visible but is not actually active or usable. This indicates that it might me my suffix settings at the top:

:transient-non-suffix 'transient--do-quit-one
:transient-suffix 'transient--do-stay  

I am trying (with difficulty) to comb the documentation to see what might have changed there.

Solution

As given on the github issue1, this was fixed somewhere along the way to a recent major-version update to Transient. Success!

Resources

https://www.reddit.com/r/emacs/comments/w41f9j/comment/igzqm6r

Footnotes

1 Issue with several contributors to the conversation at https://github.com/magit/transient/issues/207

Tory Anderson avatar
Tory Anderson
Web App Engineer, Digital Humanist, Researcher, Computer Psychologist