Sarcasm / irony-mode

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

Option to silence "irony--find-server-executable" #470

Open matthewbauer opened 6 years ago

matthewbauer commented 6 years ago

If irony-server can't be found, I'd like to Irony to just silently turn itself off. Is this possible?

This would be useful for people that use the same config across multiple machines some which have "irony-server" installed and some that don't.

nlsnightmare commented 6 years ago

Unless I am mistaken, there really is no point in having irony-mode enabled w/o the irony server, so I'd suggest disabling irony-mode.

matthewbauer commented 6 years ago

Yes, but how to detect if irony server is available?

I want to be able to do something like this:

(irony-mode (irony--has-executable))

Where irony--has-executable-silent gives me t when the executable exists and nil when it doesn't. You can kind of get this by catching irony--find-server-executable but it will still show a message in each c buffer.

Sarcasm commented 6 years ago

Yes it's possible.

I have no issue with exposing a public function:

(defun irony-find-server-executable ()
  (let ((exec-path (cons (expand-file-name "bin" irony-server-install-prefix)
                         exec-path)))
    (executable-find "irony-server")))

Which you could use in your config:

(irony-mode (and (irony-find-server-executable) t))

Is that sufficient?