sigma / magit-gh-pulls

Magit plugin for dealing with GitHub pull requests
254 stars 48 forks source link

extract magit status info string to variable #95

Closed d12frosted closed 7 years ago

d12frosted commented 8 years ago

So it's possible to override this message if you mess with key bindings.

For example, I know that some evil users rebind # g to # r. So having # g in message is totally misleading.

Honestly, I didn't run tests, but I don't see anything related to my change. And also I don't know yet how to run these tests. 😕

Also, I am not very good at naming, so you might want to change it. 😕

Ideally, it would be nice to print Press '# $REAL_KEY_BINDING' to update the pull request list.\n\n instead of this solution, but I don't know how to implement it and not sure if it even worth the time 😸

Anyway, here it is 😸

justbur commented 8 years ago

There's a nicer way to do this. See https://www.gnu.org/software/emacs/manual/html_node/elisp/Keys-in-Documentation.html#Keys-in-Documentation

d12frosted commented 8 years ago

Wow, didn't know about that. Thanks for sharing.

But I am not sure that it can help us here. Since magit-gh-pulls-reload is not bound in magit status buffer. It has # bound to pulls popup which has magit-gh-pulls-reload keybinding. E. g. calling (substitute-command-keys "\\[magit-gh-pulls-reload]") in magit status buffer returns "M-x magit-gh-pulls-reload".

d12frosted commented 8 years ago

Hm...

For example, I know that some evil people

Just realised that this sounds not as I wanted it to sound. I mean 'evil users', not 'evil people'. Sorry about that!

justbur commented 8 years ago

That's what \<mapvar> is for

d12frosted commented 8 years ago

Still don't get how to get # g in this situation. I can get # just by calling (substitute-command-keys "\\[magit-gh-pulls-popup]"). But magit-gh-pulls-popup itself doesn't have corresponding map. There is magit-popup-mode-map, which remaps self-insert-command to magit-invoke-command-action. So actually, there is no keybinding for magit-gh-pulls-reload. But I believe that it's possible to fetch it somehow from magit-popup.

justbur commented 8 years ago

Ah my fault. I forgot this is not a proper map On Fri, Jul 15, 2016 at 11:37 AM Boris notifications@github.com wrote:

Still don't get how to get # g in this situation. I can get # just by calling (substitute-command-keys "[magit-gh-pulls-popup]"). But magit-gh-pulls-popup itself doesn't have corresponding map. There is magit-popup-mode-map, which remaps self-insert-command to magit-invoke-command-action. So actually, there is no keybinding for magit-gh-pulls-reload. But I believe that it's possible to fetch it somehow from magit-popup.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sigma/magit-gh-pulls/pull/95#issuecomment-232986916, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGyfsfTeCBXzzQeYBkAGvPb3crYHynSks5qV6kpgaJpZM4JMWWp .

justbur commented 8 years ago

This will find the current mapping

(char-to-string
 (car
  (seq-find
   (lambda (entry)
     (eq (nth 2 entry) 'magit-gh-pulls-reload))
   (plist-get magit-gh-pulls-popup :actions))))
robbyoconnor commented 8 years ago

:+1: to this being merged!

d12frosted commented 8 years ago

@justbur 👍 nice

I've updated implementation using your trick. I still want to have separate variable for that because in some cases magit-gh-pulls-popup is wrapped.

P. S. this is getting more complicated that it should be 😜

alexander-yakushev commented 7 years ago

Missed all the action on this one :) Thank you @d12frosted!

d12frosted commented 7 years ago

Haha, it happens :) Thanks for merging :)

On Tuesday, 11 October 2016, Alexander Yakushev notifications@github.com wrote:

Merged #95 https://github.com/sigma/magit-gh-pulls/pull/95.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sigma/magit-gh-pulls/pull/95#event-819014670, or mute the thread https://github.com/notifications/unsubscribe-auth/AGNNifaHmBCOO859Oc4zwUMFPfyZGkE6ks5qyzCSgaJpZM4JMWWp .

Cheers, Boris