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

Evilifying magit help buffers (technically magit popups) #3158

Closed
justbur opened this issue Sep 28, 2015 · 1 comment
Closed

Evilifying magit help buffers (technically magit popups) #3158

justbur opened this issue Sep 28, 2015 · 1 comment

Comments

@justbur
Copy link
Contributor

justbur commented Sep 28, 2015

I started to look into this just now, but I haven't figured out the easiest way to do this yet. I'm just recording the few things I learned in case anyone wants to help do this.

  1. The help buffers are called popups in magit and are just plists. See magit-dispatch-popup.
  2. The bindings in the popup are not derived from mode maps. They're defined independently as "actions" in the plist. That means that the bindings that show up in the help buffer are correct and work as written ("k" is still discard for example). The fact that the magit keymaps are evilified means that these bindings do not reflect the bindings when the help buffer is not showing.
  3. It seems that all one needs to do is modify the :actions element of the plist (actions is a list mostly consisting of elments of the form (event description command)). Here's a sketch of a way to do this (find-new-magit-event doesn't exist yet)
(defun evilify-magit-popup (popup)
  (let ((new-popup popup))
    (plist-put new-popup :actions
               (mapcar (lambda (action)
                         (if (listp action)
                             (let ((new-event (find-new-magit-event (car action))))
                               (if new-event
                                   (cons new-event (cdr action))
                                 action))
                           action))
                       (plist-get popup :actions)))))
  1. I don't know an easy way to do this automatically yet. I was thinking about building up a translation table from commands to events as the magit maps are being evilified and using this to translate the popup bindings. However, there are quite a few popups and quite a few maps to deal with in magit.

Hope that helps

@justbur
Copy link
Contributor Author

justbur commented Oct 28, 2015

Resolved with #3578

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

No branches or pull requests

2 participants