-
-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add working directory property #312
Comments
I'll work on this. |
+1 |
+1 |
+1, I'm using flycheck with a custom checker. I modified my flycheck sources such that it changes default-directory in the (let ... scope where the checker is executed. For me a static :cwd is sufficient at the moment. Also as discussed in #308 I added functionality to change the process-environment temporary to add environment variables needed by the checker, which are also static. |
@s3bs I'm sorry that you have to go so far as to modify our sources, but currently this feature has a rather low priority on our backlog. To me, #774 and #800 are much more important. They are also much larger and complex than this one, so it'll take a long time before I get to this issue. I'd love to see a PR for this feature |
@lunaryorn I actually like to tinker once in a while with elisp code. If I'd know more elisp I'd give you a hand. I put my changes that work for me as a fork in my github repository in the cwd branch if that helps anyone in the meantime. |
I did modify a checker to change directory using the (with-eval-after-load "flycheck"
(flycheck-define-checker elixir-mix
"An Elixir syntax checker using the Elixir interpreter.
See URL `http://elixir-lang.org/'."
:command ("mix"
"compile"
source)
:predicate is-mix-project-p
:error-patterns
((error line-start "** (" (zero-or-more not-newline) ") "
(zero-or-more not-newline) ":" line ": " (message) line-end)
(warning line-start
(one-or-more (not (syntax whitespace))) ":"
line ": "
(message)
line-end))
:modes elixir-mode)
(add-to-list 'flycheck-checkers 'elixir-mix))
(defun is-mix-project-p ()
(let ((mix-project-root (locate-dominating-file (buffer-file-name) "mix.exs")))
(if mix-project-root (cd mix-project-root) nil)))
|
The elixir checker uses the `mix compile` command. This command has to be executed from the root of the project containing the `mix.exs` config file. The commit allow the checker to find this root directory and launch the command from here, giving access to all libs dependencies. This is kind of a hack. An issue exist in the flycheck project: flycheck/flycheck#312
@BernardNotarianni You may have luck with hooking into If you have further questions about this hack or need further help please let us discuss elsewhere (i.e. in the issue you have referenced). Please let us keep this thread focused on the discussion of this pull request. Thank you. |
@lunaryorn Any chance of adding a cwd? |
@jaseemabid We have an open PR at #813 which still needs work and testing afaik. |
@lunaryorn Ah. Thank you. |
@lunaryorn In the specific project I'm working on, all source resides in a single src folder and all I have to do is add Is there a flycheck way to avoid the external bin file and add |
@jaseemabid Not currently, no. We do not even have |
Fixed as of #973 |
As discussed in #308, we should add a property called
:cwd
that will change thedefault-directory
when running a checker. The property takes a single argument, which is a function that will be called each time the checker runs and it will return a string path.I guess it makes to fallback and not change the default directory if the function returns
nil
.Example:
Note that I have noticed that setting the
default-directory
for a sub-process did not always work unless you specified the absolute path with an ending slash. The functionf-full
does exactly this.The text was updated successfully, but these errors were encountered: