(when (eval-when-compile (>= emacs-major-version 24))
  (require-package 'flycheck)
  (add-hook 'after-init-hook 'global-flycheck-mode))

;; Override default flycheck triggers
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled)
      flycheck-idle-change-delay 0.8)

(defun sanityinc/flycheck-errors-visible-p ()
  "Returns t if a window in the current frame is displaying \"*Flycheck errors*\"."
  (let (found-flycheck-errors-buf)
    (walk-window-tree (lambda (w)
                        (when (string-equal "*Flycheck errors*"
                          (buffer-name (window-buffer w)))
        (setq found-flycheck-errors-buf t))))
    (selected-frame)
    found-flycheck-errors-buf))

(defun sanityinc/flycheck-maybe-display-errors (errors)
  (unless (sanityinc/flycheck-errors-visible-p)
    (flycheck-display-error-messages errors)))

(setq flycheck-display-errors-function 'sanityinc/flycheck-maybe-display-errors)

(provide 'init-flycheck)

(when (eval-when-compile (>= emacs-major-version 24))
  (require-package 'flycheck)
  (add-hook 'after-init-hook 'global-flycheck-mode))

;; Override default flycheck triggers
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled)
      flycheck-idle-change-delay 0.8)

(setq flycheck-display-errors-function #'flycheck-display-error-messages-unless-error-list)


(provide 'init-flycheck)

Replace home-baked version of flycheck-display-error-messages-unless-error-list
Replace home-baked version of flycheck-display-error-messages-unless-error-list

Thanks @lunaryorn!

ernest-dzf/emacs.d,benkha/emacs.d,Werewolflsp/emacs.d,blueseason/emacs.d,modkzs/emcs.d,Jadecity/PurcellEmacs.d,cyjia/emacs.d,shafayetkhan/emacs.d,ruiyang/emacs.d,zhuoyikang/emacs.d,Togal/emacs.d,zhaotai/.emacs.d,kongfy/emacs.d,pairyo/emacs.d,alant/emacs.d,qinshulei/emacs.d,scorpionis/emacs.d,emuio/emacs.d,arthurl/emacs.d,svenyurgensson/emacs.d,farzadbekran/emacs.d,farzadbekran/emacs.d,fengxl/emacs.d,mpwang/emacs.d,krzysz00/emacs.d,mmqmzk/emacs.d,renatoriccio/emacs.d,caoyuanqi/emacs.d,lujianmei/emacs.d,gsmlg/emacs.d,LittleLmp/emacs.d,lust4life/emacs.d,Enzo-Liu/emacs.d,dcorking/emacs.d,roxolan/emacs.d,me020523/emacs.d,jhpx/emacs.d,bibaijin/emacs.d,zenith-john/emacs.d,carlosliu/emacs.d,exclamaforte/emacs.d,jkaessens/emacs.d,Guoozz/emacs.d,dhanunjaya/emacs.d,qianwan/emacs.d,braveoyster/emacs.d,kindoblue/emacs.d,baohaojun/emacs.d,hophacker/emacs.d,jachinpy/emacs.d,sgarciac/emacs.d,hkcqr/emacs.d,DarkThrone/emacs.d,46do14/emacs.d,farzadbekran/emacs.d,wenpincui/emacs.d,haodaivshen/emacs.d,farzadbekran/emacs.d,wegatron/emacs.d,lromang/emacs.d,cjqw/emacs.d,jachinpy/emacs.d,purcell/emacs.d,danfengcao/emacs.d,LKI/emacs.d,jthetzel/emacs.d,atreeyang/emacs.d,dongdonghu/.emacs.d,boblannon/emacs.d,ilove0518/emacs.d,ruiyang/emacs.d,farzadbekran/emacs.d,blueabysm/emacs.d,whizzzkid/emacs.d,Shanicky/emacs.d