Skip to content

Feature request: use-package integration #272

@jwiegley

Description

@jwiegley

It would be neat if hydra provided a :hydra keyword to use-package (by extending use-package-keywords), that would gensym the hydra name and allow the bindings to be declared as part of the use-package declaration, with autoloads generated for all the referenced function names as they are now for :bind. Example:

(use-package yasnippet
  :load-path "site-lisp/yasnippet"
  :after hydra
  :demand t
  :diminish yas-minor-mode
  :commands (yas-expand yas-minor-mode)
  :functions (yas--guess-snippet-directories yas--table-name)
  :defines (yas--guessed-modes)
  :mode ("/\\.emacs\\.d/snippets/" . snippet-mode)
  :hydra ((:color blue :hint nil)
          "
              ^YASnippets^
--------------------------------------------
  Modes:    Load/Visit:    Actions:

 _g_lobal  _d_irectory    _i_nsert
 _m_inor   _f_ile         _t_ryout
 _e_xtra   _l_ist         _n_ew
         _a_ll
"
          ("d" yas-load-directory)
          ("e" yas-activate-extra-mode)
          ("i" yas-insert-snippet)
          ("f" yas-visit-snippet-file :color blue)
          ("n" yas-new-snippet)
          ("t" yas-tryout-snippet)
          ("l" yas-describe-tables)
          ("g" yas/global-mode)
          ("m" yas/minor-mode)
          ("a" yas-reload-all)))

As a bonus, also accepting ("d" . yas-load-directory) would make it appear more consistent with :bind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions