Kungsgeten/ryo-modal

[Feature request] provide use-package integration through a :ryo-modal keyword?

moesasji opened this issue · 3 comments

To use ryo-moda with use-package I find that I have to trigger the loading of functions by adding them to either :commands or by binding these functions first to a C-c key using bind/bind*, so a lot of duplication/noise. This seems to result from needing to put the ryo-modal key definitions under the :config keyword.

In my evil-based config that use general.el to bind keys this is mostly unneeded as it provides the :general keyword extension to use-package that takes care of this resulting in a cleaner and far more readable config as in most cases adding the key-binding under the :general keywords works without putting the called commands under :commands. Although general.el is great it seems overkill for ryo-modal yet having the similar capabilities of only needing to put keybindings under a keyword for ryo-modal would be great.

Therefore my suggestion would be to add a ryo-modal keyword that would allow to do something along the lines of:

(use-package xxxx
  :ensure t
  :ryo-modal
  (:maps 'local-map
              "key" 'function-to-call
:init
 .....
:config...
)

or use even the same function signature for ryo-modal-key you already have, but enable putting these in under a :ryo-modal keyword just to get the lazy-binding to work more convenient.

The way to extend use-package with a new keyword is explained in the documentation for general.el (https://github.com/jwiegley/use-package) under extending with new keywords. This is cryptic, but the corresponding bit in general.el is pretty short and hopefully a bit clearer, see: https://github.com/noctuid/general.el/blob/master/general.el#L1013

This is a very good idea. I'll see what I can do. Or perhaps you'd like to try and implement it yourself?

Good to hear the positive reception of the idea itself!

btw) Unfortunately I will have to leave it with you as my elisp skills are pretty rudimentary at best.

A :ryo keyword has now been added to use-package, thanks to @hgersen