Sarcasm / company-irony

company-mode completion back-end for irony-mode
118 stars 11 forks source link

Warnings when opening PHP files with the default configuration #27

Open MatMercer opened 7 years ago

MatMercer commented 7 years ago

Annoying messages shows up when I open PHP files. I use company-irony and I have read that this happens because of the hooks: Answer But even using the settings above didn't fix the problem. My init.el file is here: init.el

Irony mode configuration is at line 67.

screenshot from 2016-09-26 18 49 06

Thanks.

Sarcasm commented 7 years ago

When you see this warning you have 2 options.

Either irony-mode will work perfectly in this mode and you add the mode to irony-supported-major-modes, or the mode, like PHP in your case does not work and you should not enable irony in this case.

If you use the standard irony mode configuration:

(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)

It's possible that php-mode is derived from c-mode or something like that, and the c-mode-hook is invoked, enabling irony-mode.

You have to change these 2 lines with something different, for example (not tested):

(defun my-irony-enable ()
  (when (memq major-mode irony-supported-major-modes))
     (irony-mode 1)))

(add-hook 'c++-mode-hook 'my-irony-enable)
(add-hook 'c-mode-hook 'my-irony-enable)