Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
901 stars 98 forks source link

issue with using with use-package #523

Closed jstaursky closed 5 years ago

jstaursky commented 5 years ago

Minor issue but took me a minute to notice If you try and do the following with use-package there is an error

(use-package irony
  :ensure t
  :hook (c-mode c++-mode objc-mode)
)

But if you do the following--which is supposed to be equivalent according to the main pg of use-package--there is no error.

(use-package irony
  :ensure t
  :hook ((c++-mode . irony-mode)
         (c-mode . irony-mode)
         (objc-mode . irony-mode))
)

Note how in one version irony-mode is spelled out but not with the other--I think use-package expects the package name to match with the mode name.

Sarcasm commented 5 years ago

Indeed, as the package is not named with the -mode suffix, I would expect the second form to be the correct one.

Was the 1st form recommended somewhere?

jstaursky commented 5 years ago

yeah take a look at the hooks section of use-package you can see the mention of them being equivalent. For example he shows ace-jump-mode being hooked from prog-mode and text-mode

(use-package ace-jump-mode
  :hook (prog-mode text-mode))

This is equivalent to

(use-package ace-jump-mode
  :hook ((prog-mode . ace-jump-mode)
         (text-mode . ace-jump-mode)))

Irony currently needs to use the second form in order to work.

Admittedly this is a minor gripe but if a quick fix is possible, I'd prefer to use the less verbose version.

Sarcasm commented 5 years ago

Well, I have the feeling that for this to work, irony would have to be renamed irony-mode. Maybe we should ask the use-package project if that is correct.

When I looked whether or not the package should be named irony or irony-mode, I concluded that it should be irony for some reasons, which I don't remember now. But it is something we can see on some famous packages too, such as company or flycheck.

jstaursky commented 5 years ago

Was thinking that might be the case as well, but was hoping otherwise. Seems like it would be a pretty noticeable oversight to miss though, hard to think he would not have considered such a use case. Suppose I'll open an issue on use-package. Thanks