;;; syntax-checking-settings --- Settings file for syntax checking features

;;; Commentary:
;; Syntax checking configurations

;; Requirements:
;; - flycheck  https://melpa.org/#/flycheck  https://github.com/flycheck/flycheck

;; flycheck is used, because flymake supports less languages than flycheck

;; there are in place temporary files for Python, LaTeX and Emacs Lisp, see https://github.com/flycheck/flycheck/issues/92
;; if working with some kind of cloud sync systems, one may filter "flycheck_*" files

;; no activated yet:
;; https://melpa.org/#/flycheck-pos-tip require pos-tip

;;; Code:
;; do not load directly with e.g. (global-flycheck-mode) or via
;; after-init-hook while loading the init because flycheck will freeze
;; for a short while. Therefore better defer loading.
;;(require 'flycheck (concat config-dir "lisp/flycheck/flycheck.el"))
(use-package flycheck
  :defer 2
  :init
  (setq flycheck-mode-line-prefix "F")  ;; \u24BB \u01D4D5 \u2708 f  ;; other flycheck settings see syntax-checking-settings.el
  (setq flycheck-mode-line '(:eval (concat (flycheck-mode-line-status-text) " ")))
  :config
  (setq-default flycheck-disabled-checkers '(python-flake8))  ;; disable the python-flake8 checker. This will make the next checker which is python-pylint to be used.
  (setq flycheck-check-syntax-automatically '(save mode-enabled))  ;; flycheck only while saving, default is (save idle-change new-line mode-enabled)
   ;; flycheck-mode-line-prefix see general-settings-post.el
  (setq flycheck-emacs-lisp-load-path 'inherit)
  ;;(add-hook 'after-init-hook #'global-flycheck-mode)  ;; deactivated bc of defer
  (global-flycheck-mode))

;; flycheck also has tooltips
;; flycheck-pos-tip shows errors under point in pos-tip popups.
;;(require 'flycheck-pos-tip)
;;(with-eval-after-load 'flycheck
;;  (flycheck-pos-tip-mode))

(provide 'syntax-checking-settings)
;;; syntax-checking-settings.el ends here
