Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

God mode does not work in Transient UI #130

Open
rudolf-adamkovic opened this issue May 9, 2021 · 8 comments
Open

God mode does not work in Transient UI #130

rudolf-adamkovic opened this issue May 9, 2021 · 8 comments

Comments

@rudolf-adamkovic
Copy link
Contributor

Magit uses the Transient package to show dialogs, and God does not work inside of these buffers. Does anyone know how to work around this problem?

@darth10
Copy link
Collaborator

darth10 commented May 9, 2021

Transient doesn't allow entering any keys (including M-x) other than the ones shown in the popup dialog.

You could try customising god-exempt-major-modes (which currently includes magit-popup-mode) and see if that helps.

@rudolf-adamkovic
Copy link
Contributor Author

@darth10 Wait, but god-exempt-major-modes will not allow me to control Magit popups with God, will it?

@darth10
Copy link
Collaborator

darth10 commented May 9, 2021

Given the way transient works, I doubt it, but it's worth a shot.
I've tried it out, and that doesn't work.

A more important question would be whether God mode is actually needed to control transient UI popups.
IMHO the popups generally have single key bindings, so you wouldn't gain a lot through God mode.

@rudolf-adamkovic
Copy link
Contributor Author

rudolf-adamkovic commented May 11, 2021

I think the main reason is accessibility. If someone uses God to avoid RSI, or recover from RSI, they might prefer to use ESC g instead of C-g (given that m is M-), and the like. Another reason is consistency; once one gets used to God, they do not need to context switch.

@darth10
Copy link
Collaborator

darth10 commented May 11, 2021

That makes sense for C-g vs. ESC g, but for any other bindings, transient will print an Unbound suffix: ... message.

Maybe some more examples of what you're trying to achieve would be helpful here.
Is it just ESC g that you need?

@rudolf-adamkovic
Copy link
Contributor Author

rudolf-adamkovic commented May 12, 2021

Here is a real-world example:

Working in Org, I wanted to export a document as an HTML fragment.

I hit c e in God mode. Then, in the transient window:

  • actual: C-b C-v h H
  • expected: b v ESC h H (no C-, no RSI, no context switch)

More generally, these transient UIs can (and do) have C--bound shortcuts.

@darth10
Copy link
Collaborator

darth10 commented May 12, 2021

That's a great example, but c e in org-mode invokes org-export-dispatch (ox.el) which doesn't use transient 😄

Coming back to transient specifically, have you tried customising transient-map to fit your workflow?

(define-key transient-map (kbd "<escape> g") 'transient-quit-one) ;; ESC g

I understand this is hard to do for every command you intend to use, but it's even harder to implement in God mode for every popup dialog mode that Emacs supports.
For example, for org-export-dispatch, since the popup buffer uses read-char-exclusive to read keys in org-export--dispatch-action, there's nothing to hook God mode into for the purpose of adding modifier keys.
Transient on the other hand uses keymaps, so might be a bit more straightforward to implement.
Evil doesn't support transient UI buffers though (see emacs-evil/evil-magit#77).
Regardless, God mode needs be aware of every popup mode out there to have 100% consistency in all popups.

There was some potential in using set-transient-map in #113, but that has been abandoned as it wouldn't support Magit.

I'll explore how this can be implemented cleanly, but it could take a while.

@rudolf-adamkovic
Copy link
Contributor Author

rudolf-adamkovic commented May 12, 2021

@darth10

have you tried customising

To be honest, customizing a single key binding is not what I am after. Instead, I would like to see a solution that would always work reliably in all buffers, with no exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants