Compute flycheck command line options properly

This causes flycheck to find the current packages from the buffer-local
packages variable as well as from the local .ipkg file. Fixes #271.
Factor out argument computation to one function
Fix definition order
Merge pull request #274 from david-christiansen/issue/271

Compute flycheck command line options properly