{"action":"created","issue":{"url":"https://api.github.com/repos/abo-abo/hydra/issues/185","repository_url":"https://api.github.com/repos/abo-abo/hydra","labels_url":"https://api.github.com/repos/abo-abo/hydra/issues/185/labels{/name}","comments_url":"https://api.github.com/repos/abo-abo/hydra/issues/185/comments","events_url":"https://api.github.com/repos/abo-abo/hydra/issues/185/events","html_url":"https://github.com/abo-abo/hydra/issues/185","id":145960699,"number":185,"title":"FR: Function to add heads to an existing hydra","user":{"login":"ennokde","id":16050332,"avatar_url":"https://avatars.githubusercontent.com/u/16050332?v=3","gravatar_id":"","url":"https://api.github.com/users/ennokde","html_url":"https://github.com/ennokde","followers_url":"https://api.github.com/users/ennokde/followers","following_url":"https://api.github.com/users/ennokde/following{/other_user}","gists_url":"https://api.github.com/users/ennokde/gists{/gist_id}","starred_url":"https://api.github.com/users/ennokde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ennokde/subscriptions","organizations_url":"https://api.github.com/users/ennokde/orgs","repos_url":"https://api.github.com/users/ennokde/repos","events_url":"https://api.github.com/users/ennokde/events{/privacy}","received_events_url":"https://api.github.com/users/ennokde/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-05T11:26:44Z","updated_at":"2016-04-13T12:45:51Z","closed_at":null,"body":"tl;dr: The Emacs hydra should be able to grow additional heads just like the mythological one. It would help to keep the separation of the configuration of different packages provided by use-/req-package.\r\n\r\n__Current:__\r\nI try to keep things clean in my config by using req-package to require and configure all my packages. If I want to have a hydra containing the functionality of several packages right now I have two options which both introduce otherwise unnecessary dependencies.\r\nThe first one is to make one package depend on all others involved and define a big hydra in its config block. This forces me to remember this dependency when I want to add/remove/replace a package. And it puts part of the configuration of one package into the config block of another. So it works against the req-package idea of keeping things separate.\r\nThe second option is to use inheritance. This makes it possible to put the heads provided by each package into the appropriate config block. But it also forces me to add dependencies to the req-package declarations to make them load in the right order. Otherwise the hydra I want to inherit from might not be defined yet. So this forces a specific loading sequence that makes deferred loading of packages complicated.\r\n\r\n__Desired:__\r\nA third option to add heads to an existing hydra would make the configuration a lot easier. One would only have to worry about defining the hydra before the rest of the configuration. After that all the following config blocks can add their heads at their own leisure. Deferred loading and the sequence of loaded packages do not matter anymore."},"comment":{"url":"https://api.github.com/repos/abo-abo/hydra/issues/comments/209412926","html_url":"https://github.com/abo-abo/hydra/issues/185#issuecomment-209412926","issue_url":"https://api.github.com/repos/abo-abo/hydra/issues/185","id":209412926,"user":{"login":"ennokde","id":16050332,"avatar_url":"https://avatars.githubusercontent.com/u/16050332?v=3","gravatar_id":"","url":"https://api.github.com/users/ennokde","html_url":"https://github.com/ennokde","followers_url":"https://api.github.com/users/ennokde/followers","following_url":"https://api.github.com/users/ennokde/following{/other_user}","gists_url":"https://api.github.com/users/ennokde/gists{/gist_id}","starred_url":"https://api.github.com/users/ennokde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ennokde/subscriptions","organizations_url":"https://api.github.com/users/ennokde/orgs","repos_url":"https://api.github.com/users/ennokde/repos","events_url":"https://api.github.com/users/ennokde/events{/privacy}","received_events_url":"https://api.github.com/users/ennokde/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T12:45:51Z","updated_at":"2016-04-13T12:45:51Z","body":"Sorry for the late answer.\r\nYes, I could use inheritance to do this just as I described. I can express that easily with one added line in the req-package statement:\r\n\r\n`(req-package PackageB\r\n:require PackageA\r\n:config\r\n(defhydra hydra-test (:inherit (hydra-PackageA/heads))\r\n  (\"j\" forward-char \"forward\"))`\r\n\r\nThe reason I would like to avoid it is that it would force the packages involved to load in a specific order."}}