forked from flycheck/flycheck
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflycheck.el
12440 lines (10613 loc) · 481 KB
/
flycheck.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; flycheck.el --- On-the-fly syntax checking -*- lexical-binding: t; -*-
;; Copyright (C) 2017-2020 Flycheck contributors
;; Copyright (C) 2012-2016 Sebastian Wiesner and Flycheck contributors
;; Copyright (C) 2013, 2014 Free Software Foundation, Inc.
;;
;; Author: Sebastian Wiesner <[email protected]>
;; Maintainer: Clément Pit-Claudel <[email protected]>
;; fmdkdd <[email protected]>
;; URL: http://www.flycheck.org
;; Keywords: convenience, languages, tools
;; Version: 32-cvs
;; Package-Requires: ((dash "2.12.1") (pkg-info "0.4") (let-alist "1.0.4") (seq "1.11") (emacs "24.3"))
;; This file is not part of GNU Emacs.
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; On-the-fly syntax checking for GNU Emacs 24.
;;
;; Flycheck is a modern on-the-fly syntax checking extension for GNU Emacs,
;; intended as replacement for the older Flymake extension which is part of GNU
;; Emacs.
;;
;; Flycheck automatically checks buffers for errors while you type, and reports
;; warnings and errors directly in the buffer and in an optional IDE-like error
;; list.
;;
;; It comes with a rich interface for custom syntax checkers and other
;; extensions, and has already many 3rd party extensions adding new features.
;;
;; Please read the online manual at http://www.flycheck.org for more
;; information. You can open the manual directly from Emacs with `M-x
;; flycheck-manual'.
;;
;; # Setup
;;
;; Flycheck works best on Unix systems. It does not officially support Windows,
;; but tries to maintain Windows compatibility and should generally work fine on
;; Windows, too.
;;
;; To enable Flycheck add the following to your init file:
;;
;; (add-hook 'after-init-hook #'global-flycheck-mode)
;;
;; Flycheck will then automatically check buffers in supported languages, as
;; long as all necessary tools are present. Use `flycheck-verify-setup' to
;; troubleshoot your Flycheck setup.
;;; Code:
(eval-when-compile
(require 'let-alist) ; `let-alist'
(require 'compile) ; Compile Mode integration
(require 'jka-compr) ; To inhibit compression of temp files
(require 'pcase) ; `pcase-dolist' (`pcase' itself is autoloaded)
)
(require 'dash)
(require 'seq) ; Sequence functions
(require 'subr-x nil 'no-error) ; Additional utilities, Emacs 24.4 and upwards
(require 'cl-lib) ; `cl-defstruct' and CL utilities
(require 'tabulated-list) ; To list errors
(require 'easymenu) ; Flycheck Mode menu definition
(require 'rx) ; Regexp fanciness in `flycheck-define-checker'
(require 'help-mode) ; `define-button-type'
(require 'find-func) ; `find-function-regexp-alist'
(require 'json) ; `flycheck-parse-tslint'
(require 'ansi-color) ; `flycheck-parse-with-patterns-without-color'
;; Declare a bunch of dynamic variables that we need from other modes
(defvar sh-shell) ; For shell script checker predicates
(defvar ess-language) ; For r-lintr predicate
(defvar markdown-hide-markup) ;
(defvar markdown-fontify-code-block-default-mode) ; For rust-error-explainer
(defvar markdown-fontify-code-blocks-natively) ;
;; Tell the byte compiler about autoloaded functions from packages
(declare-function pkg-info-version-info "pkg-info" (package))
;;; Compatibility
(eval-and-compile
(unless (fboundp 'string-suffix-p)
;; TODO: Remove when dropping support for Emacs 24.3 and earlier
(defun string-suffix-p (suffix string &optional ignore-case)
"Return non-nil if SUFFIX is a suffix of STRING.
If IGNORE-CASE is non-nil, the comparison is done without paying
attention to case differences."
(let ((start-pos (- (length string) (length suffix))))
(and (>= start-pos 0)
(eq t (compare-strings suffix nil nil
string start-pos nil ignore-case))))))
(defalias 'flycheck--format-message
(if (fboundp 'format-message) #'format-message #'format))
;; TODO: Remove when dropping support for Emacs 24.3 and earlier
(unless (featurep 'subr-x)
;; `subr-x' function for Emacs 24.3 and below
(defsubst string-join (strings &optional separator)
"Join all STRINGS using SEPARATOR."
(mapconcat 'identity strings separator))
(defsubst string-trim-left (string)
"Remove leading whitespace from STRING."
(if (string-match "\\`[ \t\n\r]+" string)
(replace-match "" t t string)
string))
(defsubst string-trim-right (string)
"Remove trailing whitespace from STRING."
(if (string-match "[ \t\n\r]+\\'" string)
(replace-match "" t t string)
string))
(defsubst string-trim (string)
"Remove leading and trailing whitespace from STRING."
(string-trim-left (string-trim-right string)))
(defsubst string-empty-p (string)
"Check whether STRING is empty."
(string= string ""))))
;;; Customization
(defgroup flycheck nil
"Modern on-the-fly syntax checking for GNU Emacs."
:prefix "flycheck-"
:group 'tools
:link '(url-link :tag "Website" "http://www.flycheck.org")
:link '(url-link :tag "Github" "https://github.com/flycheck/flycheck"))
(defgroup flycheck-config-files nil
"Configuration files for on-the-fly syntax checkers."
:prefix "flycheck-"
:group 'flycheck)
(defgroup flycheck-options nil
"Options for on-the-fly syntax checkers."
:prefix "flycheck-"
:group 'flycheck)
(defgroup flycheck-executables nil
"Executables of syntax checkers."
:prefix "flycheck-"
:group 'flycheck)
(defgroup flycheck-faces nil
"Faces used by on-the-fly syntax checking."
:prefix "flycheck-"
:group 'flycheck)
(defcustom flycheck-checkers
'(ada-gnat
ansible-ansiblelint
asciidoctor
asciidoc
awk-gawk
bazel-buildifier
c/c++-clang
c/c++-gcc
c/c++-cppcheck
cfengine
chef-foodcritic
coffee
coffee-coffeelint
coq
css-csslint
css-stylelint
cuda-nvcc
cwl
d-dmd
dockerfile-hadolint
elixir-credo
emacs-lisp
emacs-lisp-checkdoc
ember-template
erlang-rebar3
erlang
eruby-erubis
eruby-ruumba
fortran-gfortran
go-gofmt
go-golint
go-vet
go-build
go-test
go-errcheck
go-unconvert
go-staticcheck
groovy
haml
handlebars
haskell-stack-ghc
haskell-ghc
haskell-hlint
html-tidy
javascript-eslint
javascript-jshint
javascript-standard
json-jsonlint
json-python-json
json-jq
jsonnet
less
less-stylelint
llvm-llc
lua-luacheck
lua
markdown-markdownlint-cli
markdown-mdl
nix
nix-linter
opam
perl
perl-perlcritic
php
php-phpmd
php-phpcs
processing
proselint
protobuf-protoc
protobuf-prototool
pug
puppet-parser
puppet-lint
python-flake8
python-pylint
python-pycompile
python-pyright
python-mypy
r-lintr
racket
rpm-rpmlint
rst-sphinx
rst
ruby-rubocop
ruby-standard
ruby-reek
ruby-rubylint
ruby
ruby-jruby
rust-cargo
rust
rust-clippy
scala
scala-scalastyle
scheme-chicken
scss-lint
scss-stylelint
sass/scss-sass-lint
sass
scss
sh-bash
sh-posix-dash
sh-posix-bash
sh-zsh
sh-shellcheck
slim
slim-lint
sql-sqlint
systemd-analyze
tcl-nagelfar
terraform
terraform-tflint
tex-chktex
tex-lacheck
texinfo
textlint
typescript-tslint
verilog-verilator
vhdl-ghdl
xml-xmlstarlet
xml-xmllint
yaml-jsyaml
yaml-ruby
yaml-yamllint)
"Syntax checkers available for automatic selection.
A list of Flycheck syntax checkers to choose from when syntax
checking a buffer. Flycheck will automatically select a suitable
syntax checker from this list, unless `flycheck-checker' is set,
either directly or with `flycheck-select-checker'.
You should not need to change this variable normally. In order
to disable syntax checkers, please use
`flycheck-disabled-checkers'. This variable is intended for 3rd
party extensions to tell Flycheck about new syntax checkers.
Syntax checkers in this list must be defined with
`flycheck-define-checker'."
:group 'flycheck
:type '(repeat (symbol :tag "Checker"))
:risky t)
(defcustom flycheck-disabled-checkers nil
"Syntax checkers excluded from automatic selection.
A list of Flycheck syntax checkers to exclude from automatic
selection. Flycheck will never automatically select a syntax
checker in this list, regardless of the value of
`flycheck-checkers'.
However, syntax checkers in this list are still available for
manual selection with `flycheck-select-checker'.
Use this variable to disable syntax checkers, instead of removing
the syntax checkers from `flycheck-checkers'. You may also use
this option as a file or directory local variable to disable
specific checkers in individual files and directories
respectively."
:group 'flycheck
:type '(repeat (symbol :tag "Checker"))
:package-version '(flycheck . "0.16")
:safe #'flycheck-symbol-list-p)
(make-variable-buffer-local 'flycheck-disabled-checkers)
(defvar-local flycheck--automatically-disabled-checkers nil
"List of syntax checkers automatically disabled for this buffer.
A checker can be automatically disabled in two cases:
1. Its `:enabled' predicate returned false.
2. It returned too many errors (see `flycheck-checker-error-threshold').
To trigger a reverification from Emacs Lisp code, do not modify
this variable: use `flycheck-reset-enabled-checker'.")
(defvar-local flycheck-checker nil
"Syntax checker to use for the current buffer.
If unset or nil, automatically select a suitable syntax checker
from `flycheck-checkers' on every syntax check.
If set to a syntax checker only use this syntax checker and never
select one from `flycheck-checkers' automatically. The syntax
checker is used regardless of whether it is contained in
`flycheck-checkers' or `flycheck-disabled-checkers'. If the
syntax checker is unusable in the current buffer an error is
signaled.
A syntax checker assigned to this variable must be defined with
`flycheck-define-checker'.
Use the command `flycheck-select-checker' to select a syntax
checker for the current buffer, or set this variable as file
local variable to always use a specific syntax checker for a
file. See Info Node `(emacs)Specifying File Variables' for more
information about file variables.")
(put 'flycheck-checker 'safe-local-variable 'flycheck-registered-checker-p)
(defcustom flycheck-locate-config-file-functions nil
"Functions to locate syntax checker configuration files.
Each function in this hook must accept two arguments: The value
of the configuration file variable, and the syntax checker
symbol. It must return either a string with an absolute path to
the configuration file, or nil, if it cannot locate the
configuration file.
The functions in this hook are called in order of appearance, until a
function returns non-nil. The configuration file returned by that
function is then given to the syntax checker if it exists.
This variable is an abnormal hook. See Info
node `(elisp)Hooks'."
:group 'flycheck
:type 'hook
:risky t)
(defcustom flycheck-checker-error-threshold 400
"Maximum errors allowed per syntax checker.
The value of this variable is either an integer denoting the
maximum number of errors per syntax checker and buffer, or nil to
not limit the errors reported from a syntax checker.
If this variable is a number and a syntax checker reports more
errors than the value of this variable, its errors are not
discarded, and not highlighted in the buffer or available in the
error list. The affected syntax checker is also disabled for
future syntax checks of the buffer."
:group 'flycheck
:type '(choice (const :tag "Do not limit reported errors" nil)
(integer :tag "Maximum number of errors"))
:risky t
:package-version '(flycheck . "0.22"))
(defcustom flycheck-process-error-functions nil
"Functions to process errors.
Each function in this hook must accept a single argument: A
Flycheck error to process.
All functions in this hook are called in order of appearance,
until a function returns non-nil. Thus, a function in this hook
may return nil, to allow for further processing of the error, or
any non-nil value, to indicate that the error was fully processed
and inhibit any further processing.
The functions are called for each newly parsed error immediately
after the corresponding syntax checker finished. At this stage,
the overlays from the previous syntax checks are still present,
and there may be further syntax checkers in the chain.
This variable is an abnormal hook. See Info
node `(elisp)Hooks'."
:group 'flycheck
:type 'hook
:package-version '(flycheck . "0.13")
:risky t)
(defcustom flycheck-display-errors-delay 0.9
"Delay in seconds before displaying errors at point.
Use floating point numbers to express fractions of seconds."
:group 'flycheck
:type 'number
:package-version '(flycheck . "0.15")
:safe #'numberp)
(defcustom flycheck-display-errors-function #'flycheck-display-error-messages
"Function to display error messages.
If set to a function, call the function with the list of errors
to display as single argument. Each error is an instance of the
`flycheck-error' struct.
If set to nil, do not display errors at all."
:group 'flycheck
:type '(choice (const :tag "Display error messages"
flycheck-display-error-messages)
(const :tag "Display error messages only if no error list"
flycheck-display-error-messages-unless-error-list)
(function :tag "Error display function"))
:package-version '(flycheck . "0.13")
:risky t)
(defcustom flycheck-help-echo-function #'flycheck-help-echo-all-error-messages
"Function to compute the contents of the error tooltips.
If set to a function, call the function with the list of errors
to display as single argument. Each error is an instance of the
`flycheck-error' struct. The function is used to set the
help-echo property of flycheck error overlays. It should return
a string, which is displayed when the user hovers over an error
or presses \\[display-local-help].
If set to nil, do not show error tooltips."
:group 'flycheck
:type '(choice (const :tag "Concatenate error messages to form a tooltip"
flycheck-help-echo-all-error-messages)
(function :tag "Help echo function"))
:package-version '(flycheck . "0.25")
:risky t)
(defcustom flycheck-command-wrapper-function #'identity
"Function to modify checker commands before execution.
The value of this option is a function which is given a list
containing the full command of a syntax checker after
substitution through `flycheck-substitute-argument' but before
execution. The function may return a new command for Flycheck to
execute.
The default value is `identity' which does not change the
command. You may provide your own function to run Flycheck
commands through `bundle exec', `nix-shell' or similar wrappers."
:group 'flycheck
:type '(choice (const :tag "Do not modify commands" identity)
(function :tag "Modify command with a custom function"))
:package-version '(flycheck . "0.25")
:risky t)
(defcustom flycheck-executable-find #'flycheck-default-executable-find
"Function to search for executables.
The value of this option is a function which is given the name or
path of an executable and shall return the full path to the
executable, or nil if the executable does not exit.
The default is `flycheck-default-executable-find', which searches
variable `exec-path' when given a command name, and resolves
paths to absolute ones. You can customize this option to search
for checkers in other environments such as bundle or NixOS
sandboxes."
:group 'flycheck
:type '(choice
(const :tag "Search executables in `exec-path'"
flycheck-default-executable-find)
(function :tag "Search executables with a custom function"))
:package-version '(flycheck . "32")
:risky t)
(defun flycheck-default-executable-find (executable)
"Resolve EXECUTABLE to a full path.
Like `executable-find', but supports relative paths.
Attempts invoking `executable-find' first; if that returns nil,
and EXECUTABLE contains a directory component, expands to a full
path and tries invoking `executable-find' again."
;; file-name-directory returns non-nil iff the given path has a
;; directory component.
(or
(executable-find executable)
(when (file-name-directory executable)
(executable-find (expand-file-name executable)))))
(defcustom flycheck-indication-mode 'left-fringe
"The indication mode for Flycheck errors.
This variable controls how Flycheck indicates errors in buffers.
May be `left-fringe', `right-fringe', `left-margin',
`right-margin', or nil.
If set to `left-fringe' or `right-fringe', indicate errors via
icons in the left and right fringe respectively. If set to
`left-margin' or `right-margin', use the margins instead.
If set to nil, do not indicate errors and warnings, but just
highlight them according to `flycheck-highlighting-mode'."
:group 'flycheck
:type '(choice (const :tag "Indicate in the left fringe" left-fringe)
(const :tag "Indicate in the right fringe" right-fringe)
(const :tag "Indicate in the left margin" left-margin)
(const :tag "Indicate in the right margin" right-margin)
(const :tag "Do not indicate" nil))
:safe #'symbolp)
(defcustom flycheck-highlighting-mode 'symbols
"The highlighting mode for Flycheck errors and warnings.
The highlighting mode controls how Flycheck highlights errors in
buffers when a checker only reports the starting position of an
error. The following modes are known:
`columns'
Highlight a single character. If the error does not have a column,
highlight the whole line.
`symbols'
Highlight a full symbol if there is any, otherwise behave like `columns'.
This is the default.
`sexps'
Highlight a full expression, if there is any, otherwise behave like
`columns'. Note that this mode can be *very* slow in some major modes.
`lines'
Highlight the whole line.
nil
Do not highlight errors at all. However, errors will still
be reported in the mode line and in error message popups,
and indicated according to `flycheck-indication-mode'."
:group 'flycheck
:type '(choice (const :tag "Highlight columns only" columns)
(const :tag "Highlight symbols" symbols)
(const :tag "Highlight expressions" sexps)
(const :tag "Highlight whole lines" lines)
(const :tag "Do not highlight errors" nil))
:package-version '(flycheck . "0.14")
:safe #'symbolp)
(defvar flycheck-current-errors)
(defun flycheck-refresh-fringes-and-margins ()
"Refresh fringes and margins of all windows displaying the current buffer.
If any errors are currently shown, launch a new check, to adjust
to a potential new indication mode."
(dolist (win (get-buffer-window-list))
(set-window-margins win left-margin-width right-margin-width)
(set-window-fringes win left-fringe-width right-fringe-width))
(when flycheck-current-errors
(flycheck-buffer)))
(defun flycheck-set-indication-mode (&optional mode)
"Set `flycheck-indication-mode' to MODE and adjust margins and fringes.
When MODE is nil, adjust window parameters without changing the
mode. This function can be useful as a `flycheck-mode-hook',
especially if you use margins only in Flycheck buffers.
When MODE is `left-margin', the left fringe is reduced to 1 pixel
to save space."
(interactive (list (intern (completing-read
"Mode: " '("left-fringe" "right-fringe"
"left-margin" "right-margin")
nil t nil nil
(prin1-to-string flycheck-indication-mode)))))
(setq mode (or mode flycheck-indication-mode))
(pcase mode
((or `left-fringe `right-fringe)
(setq left-fringe-width 8 right-fringe-width 8
left-margin-width 0 right-margin-width 0))
(`left-margin
(setq left-fringe-width 1 right-fringe-width 8
left-margin-width 1 right-margin-width 0))
(`right-margin
(setq left-fringe-width 8 right-fringe-width 8
left-margin-width 0 right-margin-width 1))
(_ (user-error "Invalid indication mode")))
(setq-local flycheck-indication-mode mode)
(flycheck-refresh-fringes-and-margins))
(define-widget 'flycheck-highlighting-style 'lazy
"A value for `flycheck-highlighting-style'."
:offset 2
:format "%t: Use %v"
:type '(choice
:format "%[Value Menu%] %v"
(const :tag "no highlighting" nil)
(const :tag "a face indicating the error level" level-face)
(list :tag "a pair of delimiters"
(const :format "" delimiters)
(string :tag "Before")
(string :tag "After"))
(list :tag "a conditional mix of styles"
(const :format "" conditional)
(integer :tag "Up to this many lines")
(flycheck-highlighting-style :format "Use %v")
(flycheck-highlighting-style :format "Otherwise, use %v"))))
(defun flycheck--make-highlighting-delimiter (char)
"Make a highlighting bracket symbol by repeating CHAR twice."
(compose-chars ?\s
;; '(Bl . Br) ?\s
'(Bc Br 30 0) char
'(Bc Bl -30 0) char))
(defcustom flycheck-highlighting-style
`(conditional 4 level-face (delimiters "" ""))
"The highlighting style for Flycheck errors and warnings.
The highlighting style controls how Flycheck highlights error
regions in buffers. The following styles are supported:
nil
Do not highlight errors. Same as setting
`flycheck-highlighting-mode' to nil.
`level-face'
Chose a face depending on the severity of the error, and
apply it to the whole error text. See also the
`flycheck-define-error-level' and `flycheck-error',
`flycheck-warning', and `flycheck-info' faces.
\(`delimiters' BEFORE AFTER)
Draw delimiters on each side of the error. BEFORE and AFTER
indicate which delimiters to use. If they are strings, they
are used as-is. If they are characters, they are repeated
twice and composed into a single character. Delimiters use
the fringe face corresponding to the severity of each error,
as well as the `flycheck-error-delimiter' face. Delimited
text has the `flycheck-delimited-error' face.
\(`conditional' NLINES S1 S2)
Use style S1 for errors spanning up to NLINES lines, and
style S2 otherwise.
See also `flycheck-highlighting-mode' and
`flycheck-indication-mode'."
:group 'flycheck
:type 'flycheck-highlighting-style
:package-version '(flycheck . "32")
:safe t)
(defcustom flycheck-check-syntax-automatically '(save
idle-change
new-line
mode-enabled)
"When Flycheck should check syntax automatically.
This variable is a list of events that may trigger syntax checks.
The following events are known:
`save'
Check syntax immediately after the buffer was saved.
`idle-change'
Check syntax a short time (see `flycheck-idle-change-delay')
after the last change to the buffer.
`idle-buffer-switch'
Check syntax a short time (see `flycheck-idle-buffer-switch-delay')
after the user switches to a buffer.
`new-line'
Check syntax immediately after a new line was inserted into
the buffer.
`mode-enabled'
Check syntax immediately when variable `flycheck-mode' is
non-nil.
Flycheck performs a syntax checks only on events, which are
contained in this list. For instance, if the value of this
variable is `(mode-enabled save)', Flycheck will only check if
the mode is enabled or the buffer was saved, but never after
changes to the buffer contents.
If nil, never check syntax automatically. In this case, use
`flycheck-buffer' to start a syntax check manually."
:group 'flycheck
:type '(set (const :tag "After the buffer was saved" save)
(const :tag "After the buffer was changed and idle" idle-change)
(const
:tag "After switching the current buffer" idle-buffer-switch)
(const :tag "After a new line was inserted" new-line)
(const :tag "After `flycheck-mode' was enabled" mode-enabled))
:package-version '(flycheck . "0.12")
:safe #'flycheck-symbol-list-p)
(defcustom flycheck-idle-change-delay 0.5
"How many seconds to wait after a change before checking syntax.
After the buffer was changed, Flycheck will wait as many seconds
as the value of this variable before starting a syntax check. If
the buffer is modified during this time, Flycheck will wait
again.
This variable has no effect, if `idle-change' is not contained in
`flycheck-check-syntax-automatically'."
:group 'flycheck
:type 'number
:package-version '(flycheck . "0.13")
:safe #'numberp)
(defcustom flycheck-idle-buffer-switch-delay 0.5
"How many seconds to wait after switching buffers before checking syntax.
After the user switches to a new buffer, Flycheck will wait as
many seconds as the value of this variable before starting a
syntax check. If the user switches to another buffer during this
time, whether a syntax check is still performed depends on the
value of `flycheck-buffer-switch-check-intermediate-buffers'.
This variable has no effect if `idle-buffer-switch' is not
contained in `flycheck-check-syntax-automatically'."
:group 'flycheck
:type 'number
:package-version '(flycheck . "32")
:safe #'numberp)
(defcustom flycheck-buffer-switch-check-intermediate-buffers nil
"Whether to check syntax in a buffer you only visit briefly.
If nil, then when you switch to a buffer but switch to another
buffer before the syntax check is performed, then the check is
canceled. If non-nil, then syntax checks due to switching
buffers are always performed. This only affects buffer switches
that happen less than `flycheck-idle-buffer-switch-delay' seconds
apart.
This variable has no effect if `idle-buffer-switch' is not
contained in `flycheck-check-syntax-automatically'."
:group 'flycheck
:type 'boolean
:package-version '(flycheck . "32")
:safe #'booleanp)
(defcustom flycheck-standard-error-navigation t
"Whether to support error navigation with `next-error'.
If non-nil, enable navigation of Flycheck errors with
`next-error', `previous-error' and `first-error'. Otherwise,
these functions just navigate errors from compilation modes.
Flycheck error navigation with `flycheck-next-error',
`flycheck-previous-error' and `flycheck-first-error' is always
enabled, regardless of the value of this variable.
Note that this setting only takes effect when variable
`flycheck-mode' is non-nil. Changing it will not affect buffers
where variable `flycheck-mode' is already non-nil."
:group 'flycheck
:type 'boolean
:package-version '(flycheck . "0.15")
:safe #'booleanp)
(define-widget 'flycheck-minimum-level 'lazy
"A radio-type choice of minimum error levels.
See `flycheck-navigation-minimum-level' and
`flycheck-error-list-minimum-level'."
:type '(radio (const :tag "All locations" nil)
(const :tag "Informational messages" info)
(const :tag "Warnings" warning)
(const :tag "Errors" error)
(symbol :tag "Custom error level")))
(defcustom flycheck-navigation-minimum-level nil
"The minimum level of errors to navigate.
If set to an error level, only navigate errors whose error level
is at least as severe as this one. If nil, navigate all errors."
:group 'flycheck
:type 'flycheck-minimum-level
:safe #'flycheck-error-level-p
:package-version '(flycheck . "0.21"))
(defcustom flycheck-error-list-minimum-level nil
"The minimum level of errors to display in the error list.
If set to an error level, only display errors whose error level
is at least as severe as this one in the error list. If nil,
display all errors.
This is the default level, used when the error list is opened.
You can temporarily change the level using
\\[flycheck-error-list-set-filter], or reset it to this value
using \\[flycheck-error-list-reset-filter]."
:group 'flycheck
:type 'flycheck-minimum-level
:safe #'flycheck-error-level-p
:package-version '(flycheck . "0.24"))
(defcustom flycheck-relevant-error-other-file-minimum-level 'error
"The minimum level of errors from other files to display in this buffer.
If set to an error level, only display errors from other files
whose error level is at least as severe as this one. If nil,
display all errors from other files."
:group 'flycheck
:type 'flycheck-minimum-level
:safe #'flycheck-error-level-p
:package-version '(flycheck . "32"))
(defcustom flycheck-relevant-error-other-file-show t
"Whether to show errors from other files."
:group 'flycheck
:type 'boolean
:package-version '(flycheck . "32")
:safe #'booleanp)
(defcustom flycheck-completing-read-function #'completing-read
"Function to read from minibuffer with completion.
The function must be compatible to the built-in `completing-read'
function."
:group 'flycheck
:type '(choice (const :tag "Default" completing-read)
(const :tag "IDO" ido-completing-read)
(function :tag "Custom function"))
:risky t
:package-version '(flycheck . "26"))
(defcustom flycheck-temp-prefix "flycheck"
"Prefix for temporary files created by Flycheck."
:group 'flycheck
:type 'string
:package-version '(flycheck . "0.19")
:risky t)
(defcustom flycheck-mode-hook nil
"Hooks to run after command `flycheck-mode' is toggled."
:group 'flycheck
:type 'hook
:risky t)
(defcustom flycheck-after-syntax-check-hook nil
"Functions to run after each syntax check.
This hook is run after a syntax check was finished.
At this point, *all* chained checkers were run, and all errors
were parsed, highlighted and reported. The variable
`flycheck-current-errors' contains all errors from all syntax
checkers run during the syntax check, so you can apply any error
analysis functions.
Note that this hook does *not* run after each individual syntax
checker in the syntax checker chain, but only after the *last
checker*.
This variable is a normal hook. See Info node `(elisp)Hooks'."
:group 'flycheck
:type 'hook
:risky t)
(defcustom flycheck-before-syntax-check-hook nil
"Functions to run before each syntax check.
This hook is run right before a syntax check starts.
Error information from the previous syntax check is *not*
cleared before this hook runs.
Note that this hook does *not* run before each individual syntax
checker in the syntax checker chain, but only before the *first
checker*.
This variable is a normal hook. See Info node `(elisp)Hooks'."
:group 'flycheck
:type 'hook
:risky t)
(defcustom flycheck-syntax-check-failed-hook nil
"Functions to run if a syntax check failed.
This hook is run whenever an error occurs during Flycheck's
internal processing. No information about the error is given to
this hook.
You should use this hook to conduct additional cleanup actions
when Flycheck failed.
This variable is a normal hook. See Info node `(elisp)Hooks'."
:group 'flycheck
:type 'hook
:risky t)
(defcustom flycheck-status-changed-functions nil
"Functions to run if the Flycheck status changed.
This hook is run whenever the status of Flycheck changes. Each
hook function takes the status symbol as single argument, as
given to `flycheck-report-status', which see.
This variable is an abnormal hook. See Info
node `(elisp)Hooks'."
:group 'flycheck
:type 'hook
:risky t
:package-version '(flycheck . "0.20"))
(defcustom flycheck-error-list-after-refresh-hook nil
"Functions to run after the error list was refreshed.
This hook is run whenever the error list is refreshed.
This variable is a normal hook. See Info node `(elisp)Hooks'."
:group 'flycheck
:type 'hook
:risky t
:package-version '(flycheck . "0.21"))
(defface flycheck-error-delimiter
`((t))
"Flycheck face for errors spanning multiple lines.
See `flycheck-highlighting-style' for details on when this face
is used."
:package-version '(flycheck . "32")
:group 'flycheck-faces)
(defface flycheck-delimited-error
`((t))
"Flycheck face for errors spanning multiple lines.
See `flycheck-highlighting-style' for details on when this face
is used."
:package-version '(flycheck . "32")
:group 'flycheck-faces)
(defface flycheck-error
'((((supports :underline (:style wave)))
:underline (:style wave :color "Red1"))
(t
:underline t :inherit error))
"Flycheck face for errors."
:package-version '(flycheck . "0.13")
:group 'flycheck-faces)
(defface flycheck-warning
'((((supports :underline (:style wave)))
:underline (:style wave :color "DarkOrange"))
(t
:underline t :inherit warning))
"Flycheck face for warnings."
:package-version '(flycheck . "0.13")
:group 'flycheck-faces)
(defface flycheck-info
'((((supports :underline (:style wave)))
:underline (:style wave :color "ForestGreen"))
(t
:underline t :inherit success))
"Flycheck face for informational messages."
:package-version '(flycheck . "0.15")
:group 'flycheck-faces)
(defface flycheck-fringe-error