1

I would like to make flycheck work with checkers installed via Bundler, and I've read that in order to do that, I have to implement the flycheck-command-wrapper-function.

What it should do is prepend command with bundle exec.

This is an implementation of such a wrapper for Haskell.

I'm a total newbie when it comes to Lisp, so I could only come up with

(setq flycheck-command-wrapper-function
      (lambda (command) (funcall "bundle exec " command))
)

which doesn't seem to work.

Any suggestions?

1

Well, it'd be:

(setq flycheck-command-wrapper-function
      (lambda (command)
        (append '("bundle" "exec") command)))

I think that there's a misunderstanding here, and I see that command is quite a confusing name here.

You can't use funcall here because command is not an Emacs Lisp interactive command—i.e. what you'd execute with M-x—in this case. It's a list of strings that constitute an executable command for the operating system. Essentially it's what you'd type into your shell to run a syntax checker, although Flycheck does not use the shell to run its commands for safety and efficiency reasons.

Right before it's about to execute such a command for a syntax checker Flycheck gives to whole command as argument to flycheck-command-wrapper-function. The function must then return another, potentially entirely different, list which is the command that Flycheck will subsequently execute without any further checks.

To run a syntax checker through bundle we just need to return the command with bundle exec prepended. Mind you, Flycheck doesn't use the shell so you need to pass bundle exec as two separate list items.

I hope that this clears up things a little bit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.