servingwater · 2022-11-03 21:09
Hello,
Is there some detailed documentation of how to setup flymake with different languages?
I used this but I must be missing something.
[https://www.gnu.org/software/emacs/manual/html\_mono/flymake.html](https://www.gnu.org/software/emacs/manual/html_mono/flymake.html)
I have flymake-php installed and php-mode.
I can start flymake with flymake-mode and get it in the menu.
But the check does nothing, after I put in deliberate syntax mistakes in the php file.
I tried flymake-php-load as well but that also does seem to do nothing for me.
A flymake-running-backends also shows me nothing, which makes me think it is not really running actually or knows which backend to use.
Do I need to install a language server or something? Or if there is perhaps an in depth guide.
Thank you very much.
alecStewart1 · 2022-11-04 21:58
Looking at the package, you should hook `flymake-php-load` into the `php-mode-hook`. So
(add-hook 'php-mode-hook #'flymake-php-load)
Are there any errors in the `*Message*` buffer or is there an error buffer for Flymake?
servingwater · 2022-11-05 01:48
Thank you.
I had that hook in my init.
I added to have flymake be automatically available in the menu, when opening a php file.
That works. Everything else however does not seem tom work.
The only message flymake gives me is
>Warning \[flymake index.php\]: Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)Warning \[flymake index.php\]: Disabling backend flymake-cc because make: \*\*\* No rule to make target 'check-syntax'. Stop.
alecStewart1 · 2022-11-05 17:39
Ah, you might want to have
(remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
Somewhere in your config.
When you're in a PHP file, what happens when you do `M-x flymake-start RET` or `M-x flymake-mode RET` ?
Also, is the `php` executable in your `PATH`? You might be able to do `which php` to get where the executable is located, if it is in your `PATH`.
Keep in mind the `flymake-php` package is pretty old. If you want, you can take a look at [flymake-collection](https://github.com/mohkale/flymake-collection) and possibly configure a checker for PHP yourself using the macros provided by that package.
servingwater · 2022-11-05 20:03
M-x flymake-mode RET
Just seeming does nothing.
I also added the remove hook entry, but no luck.
So I went and removed php-mode and installed phps-mode instead. It said it comes with some linting and error checking out the box.
And it does. I think I can work with that.
alecStewart1 · 2022-11-06 01:01
So when you do `M-x flymake-start RET` or `M-x flymake-mode RET` there's nothing in the minibuffer that mentions Flymake either starting or stopping or `flymake-mode` being disabled in the current buffer?
`phps-mode` will probably work for you, and it but I'm curious as to why Flymake doesn't work. But, in fairness, it might be due to the `flymake-php` package being quite old.
As of note, did you see [this](https://github.com/emacs-php/php-mode#flymake-support) in regards to the regular `php-mode` package?
servingwater · 2022-11-06 17:42
I'm going to try again with a fresh emacs install. I'm curios, too why it would not work for me.
I would prefer php-mode I think, to phps-mode.
servingwater · 2022-11-06 21:10
So I tried it again.
Fresh install in a VM.
Added php.
Added the flymake package to emacs alongside flymake-php and using php-mode.
Added those hook entries and ensured that "php" executable is in my $PATH.
Same problem
Flymake is available in the menu and when I run a check it says "menu bar flymake check now" but does nothing to highlight errors.
The log says
Disabling backend flymake-proc-legacy-flymake because (error can't find suitable init function)
Disabling backend flymake-cc because make: \*\* No rule to target 'check syntax'
Odd. Not sure what I'm doing wrong. There also seems to be not document with an example setup.
servingwater · 2022-11-06 22:01
OK, I think I have found something I can settle on for now.
phps-mode was a bit to heavy for my liking and I still could not get flymake to work.
So I installed flycheck, although I read somewhere that it is no longer used?!
In any case, it actually gave me exactly what I was looking for an non intrusive linter for simple syntax errors.
I think I'll stick with that for a while. I may revisit flymake later again.
I was attracted to it since it was supposed to be the build in tool for emacs.
My next hurdle will be Eglot, which is also failing right now.
But I'll track that down later.
Again, thank you for your time and efforts, they were appreciated.