init.el: fix a bunch of flycheck errors

Also wrap up compile related defvar's in (eval-when-compile) forms.