Closed favadi closed 6 years ago
Hello @favadi! Thank you for taking the time to open a PR.
By default value of solidity-solc-path is "solc", therefore (file-executable-p solidity-solium-path) always return nil unless solidity-solium-path is set to absolute path. This is fixed by replace file-executable-p with flycheck-executable-find.
I guess you mean (file-executable-p solidity-solc-path)
.
Yes that is true, you need to set the absolute path. But I tried what you suggest in my system and ran (funcall flycheck-executable-find "solc")
but it returns nil
, even though solc
is in the $PATH.
The flycheck checkers configurations codes are not loaded when (require solidity-mode), moved them to a function to explicitly call in config.
I prefer lazy configuration. I don't want to have to call a specific flycheck-setup
function in order to integrate with flycheck. Plus if we did that this would break everyone's existing configuration.
But I tried what you suggest in my system and ran (funcall flycheck-executable-find "solc") but it returns nil, even though solc is in the $PATH
It is pretty weird flycheck-executable-find
is defined in https://github.com/flycheck/flycheck/blob/master/flycheck.el and supposed to work. I tested in both OS X and Ubuntu.
I prefer lazy configuration. I don't want to have to call a specific flycheck-setup function in order to integrate with flycheck. Plus if we did that this would break everyone's existing configuration.
That's true, I should revert it.
For the flycheck-executable-find
I couldn't figured out why it didn't work for you. The only explanation left is you are using Emacs on OS X and the PATH inside Emacs is different with the one in your shell (https://emacs.stackexchange.com/questions/10722/emacs-and-command-line-path-disagreements-on-osx).
If I remove the defun
, somehow the checkers are not registered anymore. Look like they didn't even get executed when require. I even tried just put a (message "debug-abc")
to solidity-flycheck.el file but didn't see anything in Messages buffer. Do you have any idea why it behaves this way?
For the flycheck-executable-find I couldn't figured out why it didn't work for you.
Yes that's it (but I use Archlinux, not OSX). It can find python but not solc
. I compile solc myself and add it to ~/.local/bin/
but the emacs path does not know that as emacs is started before my shell.
I run emacs as a system service which is automatically started when the system boots, so getting the user specific path setting and other environment variables does not work. That's why I prefer the explicit way of setting the path and only if the path is not set would I allow a fallback to the flycheck-executable-find
.
If I remove the defun, somehow the checkers are not registered anymore.
Hmm .. some kind of caching issue? Make sure to delete all *.elc
compiled files.
That's why I prefer the explicit way of setting the path and only if the path is not set would I allow a fallback to the flycheck-executable-find.
flycheck-executable-find
works with absolute path too, no need to set a fall back.
Hmm .. some kind of caching issue? Make sure to delete all *.elc compiled files.
I deleted all .elc already, so it's something else. Could you help testing by put a (message "something")
to solidity-flycheck.el, restart Emacs to see if something prints out on Messages buffer?
flycheck-executable-find works with absolute path too, no need to set a fall back.
You are correct! So disregard that comments.
Could you help testing by put a (message "something") to solidity-flycheck.el, restart Emacs to see if something prints out on Messages buffer?
It does. But most importantly looking at flyckeck-checkers
both solc and solium are in there, every time I restart emacs.
@LefterisJP I updated the PR with just the change to use flycheck-executable-find
.
@favadi Thank you very much @favadi. Can you also add an entry to the changelog before I merge?
@LefterisJP I did that in https://github.com/ethereum/emacs-solidity/pull/28/commits/c62cc12dd3ffcca43b1d5de423bad6b1bd1f3d59.
Thankl you @favadi for the time you spent on this and for your contribution!
By default value of
solidity-solc-path
is "solc", therefore(file-executable-p solidity-solium-path)
always returnnil
unlesssolidity-solium-path
is set to absolute path. This is fixed by replacefile-executable-p
withflycheck-executable-find
.The flycheck checkers configurations codes are not loaded when
(require solidity-mode)
, moved them to a function to explicitly call in config.