* Disable warning from irony for PHP files
@ 2015-10-14 14:40 Sanjeev Sariya
2015-10-14 19:51 ` John Mastro
0 siblings, 1 reply; 2+ messages in thread
From: Sanjeev Sariya @ 2015-10-14 14:40 UTC (permalink / raw)
To: help-gnu-emacs
Hi Emacs Community,
Version: GNU Emacs 24.5.1
Please bear with me, I'm a learner on how to enable and play around config file in emacs for different languages.
I've installed package for php : php-mode
For which the config file looks:
(require 'php-mode)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))
I've irony, and company-irony mode added in my init.el, for which init.el looks like:
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony))
(require 'irony)
(add-hook 'after-init-hook #'global-company-mode)
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
When I open alpha.php, I get following warning:
Warning (irony): Major mode is unknown to Irony, see `irony-supported-major-modes'.
I know irony doesn't support php file. How can I disable irony to work while working with .php or any other language, or say restrict it to c, cpp, .h, .hpp files?
Any guidance shall be highly appreciated
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Disable warning from irony for PHP files
2015-10-14 14:40 Disable warning from irony for PHP files Sanjeev Sariya
@ 2015-10-14 19:51 ` John Mastro
0 siblings, 0 replies; 2+ messages in thread
From: John Mastro @ 2015-10-14 19:51 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org; +Cc: Sanjeev Sariya
Sanjeev Sariya <sanjeevsariya@gmail.com> wrote:
> I've irony, and company-irony mode added in my init.el, for which
> init.el looks like:
>
> (eval-after-load 'company
> '(add-to-list 'company-backends 'company-irony))
>
> (require 'irony)
> (add-hook 'after-init-hook #'global-company-mode)
> (add-hook 'c++-mode-hook 'irony-mode)
> (add-hook 'c-mode-hook 'irony-mode)
>
> When I open alpha.php, I get following warning:
>
> Warning (irony): Major mode is unknown to Irony, see
> `irony-supported-major-modes'.
>
> I know irony doesn't support php file. How can I disable irony to work
> while working with .php or any other language, or say restrict it to
> c, cpp, .h, .hpp files?
I'm guessing it's because `company-irony' is being added to the global
`company-backends'. That's harmless (it won't produce any results, so
another backend will be used), but you could instead configure things
like this to avoid the warning:
(require 'irony)
(add-hook 'after-init-hook #'global-company-mode)
(defun my-company-irony ()
(irony-mode)
(unless (memq 'company-irony company-backends)
(setq-local company-backends (cons 'company-irony company-backends))))
(add-hook 'c-mode-hook #'my-company-irony)
(add-hook 'c++-mode-hook #'my-company-irony)
The idea is that, instead of modifying the global `company-backends',
you give it a separate value in c-mode and c++-mode buffers and add the
`company-irony' backend there.
--
john
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-14 19:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-14 14:40 Disable warning from irony for PHP files Sanjeev Sariya
2015-10-14 19:51 ` John Mastro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).