From b4fe6a119e14178078e73ed925c6663d0fcf1ba0 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sun, 13 Jul 2025 20:16:28 +0200 Subject: [PATCH] flycheck config --- .../flycheck-posframe-autoloads.el | 48 +++ lisp/flycheck/flycheck-autoloads.el | 306 ++++++++++++++++++ lisp/update-autoloads.el | 2 + settings/syntax-checking-settings.el | 70 ++-- 4 files changed, 399 insertions(+), 27 deletions(-) create mode 100644 lisp/flycheck-posframe/flycheck-posframe-autoloads.el create mode 100644 lisp/flycheck/flycheck-autoloads.el diff --git a/lisp/flycheck-posframe/flycheck-posframe-autoloads.el b/lisp/flycheck-posframe/flycheck-posframe-autoloads.el new file mode 100644 index 00000000..2c21a070 --- /dev/null +++ b/lisp/flycheck-posframe/flycheck-posframe-autoloads.el @@ -0,0 +1,48 @@ +;;; flycheck-posframe-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + +;;; Code: + +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + + + +;;; Generated autoloads from flycheck-posframe.el + +(autoload 'flycheck-posframe-configure-pretty-defaults "flycheck-posframe" "\ +Configure some nicer settings for prettier display.") +(autoload 'flycheck-posframe-mode "flycheck-posframe" "\ +A minor mode to show Flycheck error messages in a posframe. + +This is a minor mode. If called interactively, toggle the +`Flycheck-Posframe mode' mode. If the prefix argument is positive, +enable the mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable the +mode if ARG is nil, omitted, or is a positive number. Disable the mode +if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate the variable `flycheck-posframe-mode'. + +The mode's hook is called both when the mode is enabled and when it is +disabled. + +(fn &optional ARG)" t) +(register-definition-prefixes "flycheck-posframe" '("flycheck-posframe-")) + +;;; End of scraped data + +(provide 'flycheck-posframe-autoloads) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; no-native-compile: t +;; coding: utf-8-emacs-unix +;; End: + +;;; flycheck-posframe-autoloads.el ends here diff --git a/lisp/flycheck/flycheck-autoloads.el b/lisp/flycheck/flycheck-autoloads.el new file mode 100644 index 00000000..c29ab306 --- /dev/null +++ b/lisp/flycheck/flycheck-autoloads.el @@ -0,0 +1,306 @@ +;;; flycheck-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + +;;; Code: + +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + + + +;;; Generated autoloads from flycheck.el + +(autoload 'flycheck-manual "flycheck" "\ +Open the Flycheck manual." t) +(autoload 'flycheck-quick-help "flycheck" "\ +Display brief Flycheck help." t) +(autoload 'flycheck-mode "flycheck" "\ +Flycheck is a minor mode for on-the-fly syntax checking. + +In `flycheck-mode' the buffer is automatically syntax-checked +using the first suitable syntax checker from `flycheck-checkers'. +Use `flycheck-select-checker' to select a checker for the current +buffer manually. + +If you run into issues, use `\\[flycheck-verify-setup]' to get help. + +Flycheck supports many languages out of the box, and many +additional ones are available on MELPA. Adding new ones is very +easy. Complete documentation is available online at URL +`https://www.flycheck.org/en/latest/'. Please report issues and +request features at URL `https://github.com/flycheck/flycheck'. + +Flycheck displays its status in the mode line. In the default +configuration, it looks like this: + +`FlyC' This buffer has not been checked yet. +`FlyC*' Flycheck is running. Expect results soon! +`FlyC:0' Last check resulted in no errors and no warnings. +`FlyC:3|5' This buffer contains three errors and five warnings. + Use `\\[flycheck-list-errors]' to see the list. +`FlyC-' Flycheck doesn't have a checker for this buffer. + +You may also see the following icons: +`FlyC!' The checker crashed. +`FlyC.' The last syntax check was manually interrupted. +`FlyC?' The checker did something unexpected, like exiting with 1 + but returning no errors. + +The following keybindings are available in `flycheck-mode': + +\\{flycheck-mode-map} +(you can change the prefix by customizing +`flycheck-keymap-prefix') + +If called interactively, enable Flycheck mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, +also enable the mode if ARG is omitted or nil, and toggle it if +ARG is ‘toggle’; disable the mode otherwise. + +(fn &optional ARG)" t) +(put 'global-flycheck-mode 'globalized-minor-mode t) +(defvar global-flycheck-mode nil "\ +Non-nil if Global Flycheck mode is enabled. +See the `global-flycheck-mode' command +for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-flycheck-mode'.") +(custom-autoload 'global-flycheck-mode "flycheck" nil) +(autoload 'global-flycheck-mode "flycheck" "\ +Toggle Flycheck mode in all buffers. +With prefix ARG, enable Global Flycheck mode if ARG is positive; +otherwise, disable it. + +If called from Lisp, toggle the mode if ARG is `toggle'. +Enable the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +Flycheck mode is enabled in all buffers where `flycheck-mode-on-safe' +would do it. + +See `flycheck-mode' for more information on Flycheck mode. + +(fn &optional ARG)" t) +(autoload 'flycheck-define-error-level "flycheck" "\ +Define a new error LEVEL with PROPERTIES. + +The following PROPERTIES constitute an error level: + +`:severity SEVERITY' + A number denoting the severity of this level. The higher + the number, the more severe is this level compared to other + levels. Defaults to 0; info is -10, warning is 10, and + error is 100. + + The severity is used by `flycheck-error-level-<' to + determine the ordering of errors according to their levels. + +`:compilation-level LEVEL' + + A number indicating the broad class of messages that errors + at this level belong to: one of 0 (info), 1 (warning), or + 2 or nil (error). Defaults to nil. + + This is used by `flycheck-checker-pattern-to-error-regexp' + to map error levels into `compilation-mode''s hierarchy and + to get proper highlighting of errors in `compilation-mode'. + +`:overlay-category CATEGORY' + A symbol denoting the overlay category to use for error + highlight overlays for this level. See Info + node `(elisp)Overlay Properties' for more information about + overlay categories. + + A category for an error level overlay should at least define + the `face' property, for error highlighting. Another useful + property for error level categories is `priority', to + influence the stacking of multiple error level overlays. + +`:fringe-bitmap BITMAPS' + A fringe bitmap symbol denoting the bitmap to use for fringe + indicators for this level, or a cons of two bitmaps (one for + narrow fringes and one for wide fringes). See Info node + `(elisp)Fringe Bitmaps' for more information about fringe + bitmaps, including a list of built-in fringe bitmaps. + +`:fringe-face FACE' + A face symbol denoting the face to use for fringe indicators + for this level. + +`:margin-spec SPEC' + A display specification indicating what to display in the + margin when `flycheck-indication-mode' is `left-margin' or + `right-margin'. See Info node `(elisp)Displaying in the + Margins'. If omitted, Flycheck generates an image spec from + the fringe bitmap. + +`:error-list-face FACE' + A face symbol denoting the face to use for messages of this + level in the error list. See `flycheck-list-errors'. + +(fn LEVEL &rest PROPERTIES)") +(function-put 'flycheck-define-error-level 'lisp-indent-function 1) +(autoload 'flycheck-define-command-checker "flycheck" "\ +Define SYMBOL as syntax checker to run a command. + +Define SYMBOL as generic syntax checker via +`flycheck-define-generic-checker', which uses an external command +to check the buffer. SYMBOL and DOCSTRING are the same as for +`flycheck-define-generic-checker'. + +In addition to the properties understood by +`flycheck-define-generic-checker', the following PROPERTIES +constitute a command syntax checker. Unless otherwise noted, all +properties are mandatory. Note that the default `:error-filter' +of command checkers is `flycheck-sanitize-errors'. + +`:command COMMAND' + The command to run for syntax checking. + + COMMAND is a list of the form `(EXECUTABLE [ARG ...])'. + + EXECUTABLE is a string with the executable of this syntax + checker. It can be overridden with the variable + `flycheck-SYMBOL-executable'. Note that this variable is + NOT implicitly defined by this function. Use + `flycheck-def-executable-var' to define this variable. + + Each ARG is an argument to the executable, either as string, + or as special symbol or form for + `flycheck-substitute-argument', which see. + +`:error-patterns PATTERNS' + A list of patterns to parse the output of the `:command'. + + Each ITEM in PATTERNS is a list `(LEVEL SEXP ...)', where + LEVEL is a Flycheck error level (see + `flycheck-define-error-level'), followed by one or more RX + `SEXP's which parse an error of that level and extract line, + column, file name and the message. + + See `rx' for general information about RX, and + `flycheck-rx-to-string' for some special RX forms provided + by Flycheck. + + All patterns are applied in the order of declaration to the + whole output of the syntax checker. Output already matched + by a pattern will not be matched by subsequent patterns. In + other words, the first pattern wins. + + This property is optional. If omitted, however, an + `:error-parser' is mandatory. + +`:error-parser FUNCTION' + A function to parse errors with. + + The function shall accept three arguments OUTPUT CHECKER + BUFFER. OUTPUT is the syntax checker output as string, + CHECKER the syntax checker that was used, and BUFFER a + buffer object representing the checked buffer. The function + must return a list of `flycheck-error' objects parsed from + OUTPUT. + + This property is optional. If omitted, it defaults to + `flycheck-parse-with-patterns'. In this case, + `:error-patterns' is mandatory. + +`:standard-input t' + Whether to send the buffer contents on standard input. + + If this property is given and has a non-nil value, send the + contents of the buffer on standard input. + + Some checkers that support reading from standard input have + a separate flag to indicate the name of the file whose + contents are being passed on standard input (typically + `stdin-filename'). In that case, use the `(option)' form in + `:command' to pass the value of variable `buffer-file-name' + when the current buffer has a file name (that is, + use `option \"--stdin-file-name\" buffer-file-name'). + + For buffers not backed by files, checkers that support input + on stdin typically report a file name like `-' or `'. + Make sure your error parser or patterns expect these file + names (for example, use `(or \"\" (file-name))') or + call `flycheck-remove-error-file-names' in a custom + `:error-filter'. + + Defaults to nil. + +Note that you may not give `:start', `:interrupt', and +`:print-doc' for a command checker. You can give a custom +`:verify' function, though, whose results will be appended to the +default `:verify' function of command checkers. + +(fn SYMBOL DOCSTRING &rest PROPERTIES)") +(function-put 'flycheck-define-command-checker 'lisp-indent-function 1) +(function-put 'flycheck-define-command-checker 'doc-string-elt 2) +(autoload 'flycheck-def-config-file-var "flycheck" "\ +Define SYMBOL as config file variable for CHECKER, with default FILE-NAME. + +SYMBOL is declared as customizable variable using `defcustom', to +provide configuration files for the given syntax CHECKER. +CUSTOM-ARGS are forwarded to `defcustom'. + +FILE-NAME is the initial value of the new variable. If omitted, +the default value is nil. It can be either a string or a list of +strings. + +Use this together with the `config-file' form in the `:command' +argument to `flycheck-define-checker'. + +(fn SYMBOL CHECKER &optional FILE-NAME &rest CUSTOM-ARGS)" nil t) +(function-put 'flycheck-def-config-file-var 'lisp-indent-function 3) +(autoload 'flycheck-def-option-var "flycheck" "\ +Define SYMBOL as option variable with INIT-VALUE for CHECKER. + +SYMBOL is declared as customizable variable using `defcustom', to +provide an option for the given syntax CHECKERS (a checker or a +list of checkers). INIT-VALUE is the initial value of the +variable, and DOCSTRING is its docstring. CUSTOM-ARGS are +forwarded to `defcustom'. + +Use this together with the `option', `option-list' and +`option-flag' forms in the `:command' argument to +`flycheck-define-checker'. + +(fn SYMBOL INIT-VALUE CHECKERS DOCSTRING &rest CUSTOM-ARGS)" nil t) +(function-put 'flycheck-def-option-var 'lisp-indent-function 3) +(function-put 'flycheck-def-option-var 'doc-string-elt 4) +(autoload 'flycheck-define-checker "flycheck" "\ +Define SYMBOL as command syntax checker with DOCSTRING and PROPERTIES. + +Like `flycheck-define-command-checker', but PROPERTIES must not +be quoted. Also, implicitly define the executable variable for +SYMBOL with `flycheck-def-executable-var'. + +(fn SYMBOL DOCSTRING &rest PROPERTIES)" nil t) +(function-put 'flycheck-define-checker 'lisp-indent-function 1) +(function-put 'flycheck-define-checker 'doc-string-elt 2) +(register-definition-prefixes "flycheck" '("flycheck-" "help-flycheck-checker-d" "list-flycheck-errors")) + + +;;; Generated autoloads from flycheck-buttercup.el + +(register-definition-prefixes "flycheck-buttercup" '("flycheck-buttercup-format-error-list")) + + +;;; Generated autoloads from flycheck-ert.el + +(register-definition-prefixes "flycheck-ert" '("flycheck-er")) + +;;; End of scraped data + +(provide 'flycheck-autoloads) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; no-native-compile: t +;; coding: utf-8-emacs-unix +;; End: + +;;; flycheck-autoloads.el ends here diff --git a/lisp/update-autoloads.el b/lisp/update-autoloads.el index 4a6d1bc5..3b4c7f91 100644 --- a/lisp/update-autoloads.el +++ b/lisp/update-autoloads.el @@ -45,6 +45,8 @@ (package-generate-autoloads "all-the-icons" (concat config-dir "lisp/all-the-icons")) (package-generate-autoloads "dashboard" (concat config-dir "lisp/dashboard")) (package-generate-autoloads "diff-hl" (concat config-dir "lisp/diff-hl")) + (package-generate-autoloads "flycheck" (concat config-dir "lisp/flycheck")) + (package-generate-autoloads "flycheck-posframe" (concat config-dir "lisp/flycheck-posframe")) (package-generate-autoloads "focus" (concat config-dir "lisp/focus")) (package-generate-autoloads "indent-guide" (concat config-dir "lisp/indent-guide")) (package-generate-autoloads "iscroll" (concat config-dir "lisp/iscroll")) diff --git a/settings/syntax-checking-settings.el b/settings/syntax-checking-settings.el index 4dd83a1f..3733cf19 100644 --- a/settings/syntax-checking-settings.el +++ b/settings/syntax-checking-settings.el @@ -9,38 +9,54 @@ ;; Requirements: ;; - flycheck https://melpa.org/#/flycheck https://github.com/flycheck/flycheck -;; flycheck is used, because flymake supports less languages than 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 +;; 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 ;;; 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)) +(use-package flycheck + ;; 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. + :defer t + :init + (require 'flycheck-autoloads) + (setq flycheck-mode-line-prefix "F") ;; \u24BB \u01D4D5 \u2708 f + (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) + (setq flycheck-emacs-lisp-load-path 'inherit) ) -;; 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)) +(use-package flycheck-posframe + ;; https://melpa.org/#/flycheck-posframe + :after (flycheck) + :if (display-graphic-p) + :init (require 'flycheck-posframe-autoloads) + :config + (add-hook 'flycheck-mode-hook #'flycheck-posframe-mode) + (setq flycheck-posframe-position 'window-bottom-left-corner) + (setq flycheck-posframe-info-prefix "➤ ") + (setq flycheck-posframe-warning-prefix "➤ ") ;; "➤ " "\u26a0 " + (setq flycheck-posframe-error-prefix "➤ ") + (setq flycheck-posframe-border-use-error-face t) + (setq flycheck-posframe-border-width 1) + (set-face-attribute 'flycheck-posframe-info-face nil + :inherit nil + :foreground (plist-get (face-attribute 'flycheck-info :underline) :color)) + (set-face-attribute 'flycheck-posframe-warning-face nil + :inherit nil + :foreground (plist-get (face-attribute 'flycheck-warning :underline) :color)) + (set-face-attribute 'flycheck-posframe-error-face nil :inherit 'error + :inherit nil + :foreground (plist-get (face-attribute 'flycheck-error :underline) :color)) + ;; (set-face-attribute 'flycheck-posframe-border-face nil :inherit nil :foreground "#dc752f") + ) (provide 'syntax-checking-settings) ;;; syntax-checking-settings.el ends here