jerrypnz / major-mode-hydra.el

Spacemacs-esque major mode leader key powered by Hydra
294 stars 9 forks source link

Using command name as default label #10

Closed ghost closed 5 years ago

ghost commented 6 years ago

Thanks for making this tool, I use it all the time!

I often want to add a quick hydra with pretty-hydra-define, and I'd love to have the default label for each key be the name of the command that it runs, instead of being blank. Perhaps it could even have a default but customizable transformation of the name, such as stripping the name of the major mode off the front.

I'd love to hear your thoughts!

jerrypnz commented 6 years ago

@apnewberry Sorry for the late response. For some reason I didn't receive notification for this issue. That's definitely a reasonable suggestion. I didn't implement it as it got a bit complex and I personally always assign labels to the hydra heads. I'll give it another try hopefully in the next few days. Finally got a chance to get back to this project.

Also I'm really glad that you find it useful and thanks for your suggestion.

jerrypnz commented 6 years ago

@apnewberry Apparently it's already supported. I was looking at the tests and realised that it's already there: https://github.com/jerrypnz/major-mode-hydra.el/blob/master/test/major-mode-hydra-test.el#L37 It's been too long and I've totally forgot about it 😂

I also just tested it and can confirm it works, e.g:

(major-mode-hydra-bind clojure-mode "Connect"
      ("Q" cider-quit)
jerrypnz commented 6 years ago

Perhaps it could even have a default but customizable transformation of the name, such as stripping the name of the major mode off the front.

This is an interesting idea. I'm actually working on customisation options #11 and might give it a try.

ghost commented 6 years ago

Thanks, I hadn't tried it with major-mode-hydra-bind. The function I'm most interested in is pretty-hydra-define, which as far as I can tell doesn't do it. For example this display is empty:

(pretty-hydra-define my-tmp-hydra (:hint nil)
  ("label" (("C-c a" jump-to-register))))
jerrypnz commented 5 years ago

@apnewberry sorry for taking so long to get back to it but this issue has been fixed and is available on develop branch.

jerrypnz commented 5 years ago

Actually merged it to master. Should be available on Melpa soon.