#+BEGIN_SRC emacs-lisp
(if (>= emacs-major-version 24)
(progn
- (add-to-list 'load-path "~/.emacs.d/elpa/flycheck-20150703.359")
+ (add-to-list 'load-path "~/.emacs.d/elpa/flycheck-20160218.41")
(require 'flycheck)
(add-hook 'after-init-hook #'global-flycheck-mode)
+++ /dev/null
-This is the file .../info/dir, which contains the
-topmost node of the Info hierarchy, called (dir)Top.
-The first time you invoke Info you start off looking at this node.
-\1f
-File: dir, Node: Top This is the top of the INFO tree
-
- This (the Directory node) gives a menu of major topics.
- Typing "q" exits, "?" lists all Info commands, "d" returns here,
- "h" gives a primer for first-timers,
- "mEmacs<Return>" visits the Emacs manual, etc.
-
- In Emacs, you can click mouse button 2 on a menu item or cross reference
- to select it.
-
-* Menu:
-
-Emacs
-* Flycheck: (flycheck). Modern on-the-fly syntax checking
+++ /dev/null
-This is fdl-1.3.info, produced by makeinfo version 5.2 from
-fdl-1.3.texi.
-
- Version 1.3, 3 November 2008
-
- Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
- <http://fsf.org/>
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- 0. PREAMBLE
-
- The purpose of this License is to make a manual, textbook, or other
- functional and useful document "free" in the sense of freedom: to
- assure everyone the effective freedom to copy and redistribute it,
- with or without modifying it, either commercially or
- noncommercially. Secondarily, this License preserves for the
- author and publisher a way to get credit for their work, while not
- being considered responsible for modifications made by others.
-
- This License is a kind of "copyleft", which means that derivative
- works of the document must themselves be free in the same sense.
- It complements the GNU General Public License, which is a copyleft
- license designed for free software.
-
- We have designed this License in order to use it for manuals for
- free software, because free software needs free documentation: a
- free program should come with manuals providing the same freedoms
- that the software does. But this License is not limited to
- software manuals; it can be used for any textual work, regardless
- of subject matter or whether it is published as a printed book. We
- recommend this License principally for works whose purpose is
- instruction or reference.
-
- 1. APPLICABILITY AND DEFINITIONS
-
- This License applies to any manual or other work, in any medium,
- that contains a notice placed by the copyright holder saying it can
- be distributed under the terms of this License. Such a notice
- grants a world-wide, royalty-free license, unlimited in duration,
- to use that work under the conditions stated herein. The
- "Document", below, refers to any such manual or work. Any member
- of the public is a licensee, and is addressed as "you". You accept
- the license if you copy, modify or distribute the work in a way
- requiring permission under copyright law.
-
- A "Modified Version" of the Document means any work containing the
- Document or a portion of it, either copied verbatim, or with
- modifications and/or translated into another language.
-
- A "Secondary Section" is a named appendix or a front-matter section
- of the Document that deals exclusively with the relationship of the
- publishers or authors of the Document to the Document's overall
- subject (or to related matters) and contains nothing that could
- fall directly within that overall subject. (Thus, if the Document
- is in part a textbook of mathematics, a Secondary Section may not
- explain any mathematics.) The relationship could be a matter of
- historical connection with the subject or with related matters, or
- of legal, commercial, philosophical, ethical or political position
- regarding them.
-
- The "Invariant Sections" are certain Secondary Sections whose
- titles are designated, as being those of Invariant Sections, in the
- notice that says that the Document is released under this License.
- If a section does not fit the above definition of Secondary then it
- is not allowed to be designated as Invariant. The Document may
- contain zero Invariant Sections. If the Document does not identify
- any Invariant Sections then there are none.
-
- The "Cover Texts" are certain short passages of text that are
- listed, as Front-Cover Texts or Back-Cover Texts, in the notice
- that says that the Document is released under this License. A
- Front-Cover Text may be at most 5 words, and a Back-Cover Text may
- be at most 25 words.
-
- A "Transparent" copy of the Document means a machine-readable copy,
- represented in a format whose specification is available to the
- general public, that is suitable for revising the document
- straightforwardly with generic text editors or (for images composed
- of pixels) generic paint programs or (for drawings) some widely
- available drawing editor, and that is suitable for input to text
- formatters or for automatic translation to a variety of formats
- suitable for input to text formatters. A copy made in an otherwise
- Transparent file format whose markup, or absence of markup, has
- been arranged to thwart or discourage subsequent modification by
- readers is not Transparent. An image format is not Transparent if
- used for any substantial amount of text. A copy that is not
- "Transparent" is called "Opaque".
-
- Examples of suitable formats for Transparent copies include plain
- ASCII without markup, Texinfo input format, LaTeX input format,
- SGML or XML using a publicly available DTD, and standard-conforming
- simple HTML, PostScript or PDF designed for human modification.
- Examples of transparent image formats include PNG, XCF and JPG.
- Opaque formats include proprietary formats that can be read and
- edited only by proprietary word processors, SGML or XML for which
- the DTD and/or processing tools are not generally available, and
- the machine-generated HTML, PostScript or PDF produced by some word
- processors for output purposes only.
-
- The "Title Page" means, for a printed book, the title page itself,
- plus such following pages as are needed to hold, legibly, the
- material this License requires to appear in the title page. For
- works in formats which do not have any title page as such, "Title
- Page" means the text near the most prominent appearance of the
- work's title, preceding the beginning of the body of the text.
-
- The "publisher" means any person or entity that distributes copies
- of the Document to the public.
-
- A section "Entitled XYZ" means a named subunit of the Document
- whose title either is precisely XYZ or contains XYZ in parentheses
- following text that translates XYZ in another language. (Here XYZ
- stands for a specific section name mentioned below, such as
- "Acknowledgements", "Dedications", "Endorsements", or "History".)
- To "Preserve the Title" of such a section when you modify the
- Document means that it remains a section "Entitled XYZ" according
- to this definition.
-
- The Document may include Warranty Disclaimers next to the notice
- which states that this License applies to the Document. These
- Warranty Disclaimers are considered to be included by reference in
- this License, but only as regards disclaiming warranties: any other
- implication that these Warranty Disclaimers may have is void and
- has no effect on the meaning of this License.
-
- 2. VERBATIM COPYING
-
- You may copy and distribute the Document in any medium, either
- commercially or noncommercially, provided that this License, the
- copyright notices, and the license notice saying this License
- applies to the Document are reproduced in all copies, and that you
- add no other conditions whatsoever to those of this License. You
- may not use technical measures to obstruct or control the reading
- or further copying of the copies you make or distribute. However,
- you may accept compensation in exchange for copies. If you
- distribute a large enough number of copies you must also follow the
- conditions in section 3.
-
- You may also lend copies, under the same conditions stated above,
- and you may publicly display copies.
-
- 3. COPYING IN QUANTITY
-
- If you publish printed copies (or copies in media that commonly
- have printed covers) of the Document, numbering more than 100, and
- the Document's license notice requires Cover Texts, you must
- enclose the copies in covers that carry, clearly and legibly, all
- these Cover Texts: Front-Cover Texts on the front cover, and
- Back-Cover Texts on the back cover. Both covers must also clearly
- and legibly identify you as the publisher of these copies. The
- front cover must present the full title with all words of the title
- equally prominent and visible. You may add other material on the
- covers in addition. Copying with changes limited to the covers, as
- long as they preserve the title of the Document and satisfy these
- conditions, can be treated as verbatim copying in other respects.
-
- If the required texts for either cover are too voluminous to fit
- legibly, you should put the first ones listed (as many as fit
- reasonably) on the actual cover, and continue the rest onto
- adjacent pages.
-
- If you publish or distribute Opaque copies of the Document
- numbering more than 100, you must either include a machine-readable
- Transparent copy along with each Opaque copy, or state in or with
- each Opaque copy a computer-network location from which the general
- network-using public has access to download using public-standard
- network protocols a complete Transparent copy of the Document, free
- of added material. If you use the latter option, you must take
- reasonably prudent steps, when you begin distribution of Opaque
- copies in quantity, to ensure that this Transparent copy will
- remain thus accessible at the stated location until at least one
- year after the last time you distribute an Opaque copy (directly or
- through your agents or retailers) of that edition to the public.
-
- It is requested, but not required, that you contact the authors of
- the Document well before redistributing any large number of copies,
- to give them a chance to provide you with an updated version of the
- Document.
-
- 4. MODIFICATIONS
-
- You may copy and distribute a Modified Version of the Document
- under the conditions of sections 2 and 3 above, provided that you
- release the Modified Version under precisely this License, with the
- Modified Version filling the role of the Document, thus licensing
- distribution and modification of the Modified Version to whoever
- possesses a copy of it. In addition, you must do these things in
- the Modified Version:
-
- A. Use in the Title Page (and on the covers, if any) a title
- distinct from that of the Document, and from those of previous
- versions (which should, if there were any, be listed in the
- History section of the Document). You may use the same title
- as a previous version if the original publisher of that
- version gives permission.
-
- B. List on the Title Page, as authors, one or more persons or
- entities responsible for authorship of the modifications in
- the Modified Version, together with at least five of the
- principal authors of the Document (all of its principal
- authors, if it has fewer than five), unless they release you
- from this requirement.
-
- C. State on the Title page the name of the publisher of the
- Modified Version, as the publisher.
-
- D. Preserve all the copyright notices of the Document.
-
- E. Add an appropriate copyright notice for your modifications
- adjacent to the other copyright notices.
-
- F. Include, immediately after the copyright notices, a license
- notice giving the public permission to use the Modified
- Version under the terms of this License, in the form shown in
- the Addendum below.
-
- G. Preserve in that license notice the full lists of Invariant
- Sections and required Cover Texts given in the Document's
- license notice.
-
- H. Include an unaltered copy of this License.
-
- I. Preserve the section Entitled "History", Preserve its Title,
- and add to it an item stating at least the title, year, new
- authors, and publisher of the Modified Version as given on the
- Title Page. If there is no section Entitled "History" in the
- Document, create one stating the title, year, authors, and
- publisher of the Document as given on its Title Page, then add
- an item describing the Modified Version as stated in the
- previous sentence.
-
- J. Preserve the network location, if any, given in the Document
- for public access to a Transparent copy of the Document, and
- likewise the network locations given in the Document for
- previous versions it was based on. These may be placed in the
- "History" section. You may omit a network location for a work
- that was published at least four years before the Document
- itself, or if the original publisher of the version it refers
- to gives permission.
-
- K. For any section Entitled "Acknowledgements" or "Dedications",
- Preserve the Title of the section, and preserve in the section
- all the substance and tone of each of the contributor
- acknowledgements and/or dedications given therein.
-
- L. Preserve all the Invariant Sections of the Document, unaltered
- in their text and in their titles. Section numbers or the
- equivalent are not considered part of the section titles.
-
- M. Delete any section Entitled "Endorsements". Such a section
- may not be included in the Modified Version.
-
- N. Do not retitle any existing section to be Entitled
- "Endorsements" or to conflict in title with any Invariant
- Section.
-
- O. Preserve any Warranty Disclaimers.
-
- If the Modified Version includes new front-matter sections or
- appendices that qualify as Secondary Sections and contain no
- material copied from the Document, you may at your option designate
- some or all of these sections as invariant. To do this, add their
- titles to the list of Invariant Sections in the Modified Version's
- license notice. These titles must be distinct from any other
- section titles.
-
- You may add a section Entitled "Endorsements", provided it contains
- nothing but endorsements of your Modified Version by various
- parties--for example, statements of peer review or that the text
- has been approved by an organization as the authoritative
- definition of a standard.
-
- You may add a passage of up to five words as a Front-Cover Text,
- and a passage of up to 25 words as a Back-Cover Text, to the end of
- the list of Cover Texts in the Modified Version. Only one passage
- of Front-Cover Text and one of Back-Cover Text may be added by (or
- through arrangements made by) any one entity. If the Document
- already includes a cover text for the same cover, previously added
- by you or by arrangement made by the same entity you are acting on
- behalf of, you may not add another; but you may replace the old
- one, on explicit permission from the previous publisher that added
- the old one.
-
- The author(s) and publisher(s) of the Document do not by this
- License give permission to use their names for publicity for or to
- assert or imply endorsement of any Modified Version.
-
- 5. COMBINING DOCUMENTS
-
- You may combine the Document with other documents released under
- this License, under the terms defined in section 4 above for
- modified versions, provided that you include in the combination all
- of the Invariant Sections of all of the original documents,
- unmodified, and list them all as Invariant Sections of your
- combined work in its license notice, and that you preserve all
- their Warranty Disclaimers.
-
- The combined work need only contain one copy of this License, and
- multiple identical Invariant Sections may be replaced with a single
- copy. If there are multiple Invariant Sections with the same name
- but different contents, make the title of each such section unique
- by adding at the end of it, in parentheses, the name of the
- original author or publisher of that section if known, or else a
- unique number. Make the same adjustment to the section titles in
- the list of Invariant Sections in the license notice of the
- combined work.
-
- In the combination, you must combine any sections Entitled
- "History" in the various original documents, forming one section
- Entitled "History"; likewise combine any sections Entitled
- "Acknowledgements", and any sections Entitled "Dedications". You
- must delete all sections Entitled "Endorsements."
-
- 6. COLLECTIONS OF DOCUMENTS
-
- You may make a collection consisting of the Document and other
- documents released under this License, and replace the individual
- copies of this License in the various documents with a single copy
- that is included in the collection, provided that you follow the
- rules of this License for verbatim copying of each of the documents
- in all other respects.
-
- You may extract a single document from such a collection, and
- distribute it individually under this License, provided you insert
- a copy of this License into the extracted document, and follow this
- License in all other respects regarding verbatim copying of that
- document.
-
- 7. AGGREGATION WITH INDEPENDENT WORKS
-
- A compilation of the Document or its derivatives with other
- separate and independent documents or works, in or on a volume of a
- storage or distribution medium, is called an "aggregate" if the
- copyright resulting from the compilation is not used to limit the
- legal rights of the compilation's users beyond what the individual
- works permit. When the Document is included in an aggregate, this
- License does not apply to the other works in the aggregate which
- are not themselves derivative works of the Document.
-
- If the Cover Text requirement of section 3 is applicable to these
- copies of the Document, then if the Document is less than one half
- of the entire aggregate, the Document's Cover Texts may be placed
- on covers that bracket the Document within the aggregate, or the
- electronic equivalent of covers if the Document is in electronic
- form. Otherwise they must appear on printed covers that bracket
- the whole aggregate.
-
- 8. TRANSLATION
-
- Translation is considered a kind of modification, so you may
- distribute translations of the Document under the terms of section
- 4. Replacing Invariant Sections with translations requires special
- permission from their copyright holders, but you may include
- translations of some or all Invariant Sections in addition to the
- original versions of these Invariant Sections. You may include a
- translation of this License, and all the license notices in the
- Document, and any Warranty Disclaimers, provided that you also
- include the original English version of this License and the
- original versions of those notices and disclaimers. In case of a
- disagreement between the translation and the original version of
- this License or a notice or disclaimer, the original version will
- prevail.
-
- If a section in the Document is Entitled "Acknowledgements",
- "Dedications", or "History", the requirement (section 4) to
- Preserve its Title (section 1) will typically require changing the
- actual title.
-
- 9. TERMINATION
-
- You may not copy, modify, sublicense, or distribute the Document
- except as expressly provided under this License. Any attempt
- otherwise to copy, modify, sublicense, or distribute it is void,
- and will automatically terminate your rights under this License.
-
- However, if you cease all violation of this License, then your
- license from a particular copyright holder is reinstated (a)
- provisionally, unless and until the copyright holder explicitly and
- finally terminates your license, and (b) permanently, if the
- copyright holder fails to notify you of the violation by some
- reasonable means prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
- reinstated permanently if the copyright holder notifies you of the
- violation by some reasonable means, this is the first time you have
- received notice of violation of this License (for any work) from
- that copyright holder, and you cure the violation prior to 30 days
- after your receipt of the notice.
-
- Termination of your rights under this section does not terminate
- the licenses of parties who have received copies or rights from you
- under this License. If your rights have been terminated and not
- permanently reinstated, receipt of a copy of some or all of the
- same material does not give you any rights to use it.
-
- 10. FUTURE REVISIONS OF THIS LICENSE
-
- The Free Software Foundation may publish new, revised versions of
- the GNU Free Documentation License from time to time. Such new
- versions will be similar in spirit to the present version, but may
- differ in detail to address new problems or concerns. See
- <http://www.gnu.org/copyleft/>.
-
- Each version of the License is given a distinguishing version
- number. If the Document specifies that a particular numbered
- version of this License "or any later version" applies to it, you
- have the option of following the terms and conditions either of
- that specified version or of any later version that has been
- published (not as a draft) by the Free Software Foundation. If the
- Document does not specify a version number of this License, you may
- choose any version ever published (not as a draft) by the Free
- Software Foundation. If the Document specifies that a proxy can
- decide which future versions of this License can be used, that
- proxy's public statement of acceptance of a version permanently
- authorizes you to choose that version for the Document.
-
- 11. RELICENSING
-
- "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
- World Wide Web server that publishes copyrightable works and also
- provides prominent facilities for anybody to edit those works. A
- public wiki that anybody can edit is an example of such a server.
- A "Massive Multiauthor Collaboration" (or "MMC") contained in the
- site means any set of copyrightable works thus published on the MMC
- site.
-
- "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
- license published by Creative Commons Corporation, a not-for-profit
- corporation with a principal place of business in San Francisco,
- California, as well as future copyleft versions of that license
- published by that same organization.
-
- "Incorporate" means to publish or republish a Document, in whole or
- in part, as part of another Document.
-
- An MMC is "eligible for relicensing" if it is licensed under this
- License, and if all works that were first published under this
- License somewhere other than this MMC, and subsequently
- incorporated in whole or in part into the MMC, (1) had no cover
- texts or invariant sections, and (2) were thus incorporated prior
- to November 1, 2008.
-
- The operator of an MMC Site may republish an MMC contained in the
- site under CC-BY-SA on the same site at any time before August 1,
- 2009, provided the MMC is eligible for relicensing.
-
-ADDENDUM: How to use this License for your documents
-====================================================
-
-To use this License in a document you have written, include a copy of
-the License in the document and put the following copyright and license
-notices just after the title page:
-
- Copyright (C) YEAR YOUR NAME.
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.3
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
- Texts. A copy of the license is included in the section entitled ``GNU
- Free Documentation License''.
-
- If you have Invariant Sections, Front-Cover Texts and Back-Cover
-Texts, replace the "with...Texts." line with this:
-
- with the Invariant Sections being LIST THEIR TITLES, with
- the Front-Cover Texts being LIST, and with the Back-Cover Texts
- being LIST.
-
- If you have Invariant Sections without Cover Texts, or some other
-combination of the three, merge those two alternatives to suit the
-situation.
-
- If your document contains nontrivial examples of program code, we
-recommend releasing these examples in parallel under your choice of free
-software license, such as the GNU General Public License, to permit
-their use in free software.
-
-
-\1f
-Tag Table:
-\1f
-End Tag Table
+++ /dev/null
-;;; flycheck-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
-\f
-;;;### (autoloads nil "flycheck" "flycheck.el" (21910 48941 0 0))
-;;; Generated autoloads from flycheck.el
-
-(autoload 'flycheck-info "flycheck" "\
-Open the Flycheck manual.
-
-\(fn)" t nil)
-
-(autoload 'flycheck-mode "flycheck" "\
-Minor mode for on-the-fly syntax checking.
-
-When called interactively, toggle `flycheck-mode'. With prefix
-ARG, enable `flycheck-mode' if ARG is positive, otherwise disable
-it.
-
-When called from Lisp, enable `flycheck-mode' if ARG is omitted,
-nil or positive. If ARG is `toggle', toggle `flycheck-mode'.
-Otherwise behave as if called interactively.
-
-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.
-
-\\{flycheck-mode-map}
-
-\(fn &optional ARG)" t nil)
-
-(defvar global-flycheck-mode nil "\
-Non-nil if Global-Flycheck mode is enabled.
-See the command `global-flycheck-mode' 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, enable the mode if
-ARG is omitted or nil.
-
-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 nil)
-
-(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.
-
- The severity is used by `flycheck-error-level-<' to
- determine the ordering of errors according to their levels.
-
-`: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. Other useful
- properties for error level categories are `priority' to
- influence the stacking of multiple error level overlays, and
- `help-echo' to define a default error messages for errors
- without messages.
-
-`:fringe-bitmap BITMAP'
- A fringe bitmap symbol denoting the bitmap to use for fringe
- indicators for this level. 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.
-
-`: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)" nil nil)
-
-(put 'flycheck-define-error-level 'lisp-indent-function '1)
-
-(autoload 'flycheck-define-command-checker "flycheck" "\
-Define SYMBOL as syntax checker which runs 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.
-
-Note that you may not give `:start', `:interrupt', and
-`:print-doc' for a command checker. You can give a custom
-`:verify' function, but you should take care to call
-`flycheck-verify-command-checker' in a custom `:verify'
-function.
-
-\(fn SYMBOL DOCSTRING &rest PROPERTIES)" nil nil)
-
-(put 'flycheck-define-command-checker 'lisp-indent-function '1)
-
-(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 a configuration file 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.
-
-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)
-
-(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 CHECKER. 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 CHECKER DOCSTRING &rest CUSTOM-ARGS)" nil t)
-
-(put 'flycheck-def-option-var 'lisp-indent-function '3)
-
-(put 'flycheck-def-option-var 'doc-string-elt '4)
-
-;;;***
-\f
-;;;### (autoloads nil nil ("flycheck-ert.el" "flycheck-pkg.el") (21910
-;;;;;; 48941 793934 0))
-
-;;;***
-\f
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; flycheck-autoloads.el ends here
+++ /dev/null
-;;; flycheck-ert.el --- Flycheck: ERT extensions -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2013-2015 Sebastian Wiesner and Flycheck contributors
-
-;; Author: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
-;; Maintainer: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
-;; URL: https://github.com/flycheck/flycheck
-
-;; 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:
-
-;; Unit testing library for Flycheck, the modern on-the-fly syntax checking
-;; extension for GNU Emacs.
-
-;; Provide various utility functions and unit test helpers to test Flycheck and
-;; Flycheck extensions.
-
-;;; Code:
-
-(require 'flycheck)
-(require 'ert)
-(require 'macroexp) ; For macro utilities
-
-\f
-;;; Compatibility
-
-(eval-and-compile
- ;; Provide `ert-skip' and friends for Emacs 24.3
- (defconst flycheck-ert-ert-can-skip (fboundp 'ert-skip)
- "Whether ERT supports test skipping.")
-
- (unless flycheck-ert-ert-can-skip
- ;; Fake skipping
-
- (put 'flycheck-ert-skipped 'error-message "Test skipped")
- (put 'flycheck-ert-skipped 'error-conditions '(error))
-
- (defun ert-skip (data)
- (signal 'flycheck-ert-skipped data))
-
- (defmacro skip-unless (form)
- `(unless (ignore-errors ,form)
- (signal 'flycheck-ert-skipped ',form)))
-
- (defun ert-test-skipped-p (result)
- (and (ert-test-failed-p result)
- (eq (car (ert-test-failed-condition result))
- 'flycheck-ert-skipped)))))
-
-\f
-;;; Internal variables
-
-(defvar flycheck-ert--resource-directory nil
- "The directory to get resources from in this test suite.")
-
-\f
-;;; Resource management macros
-
-(defmacro flycheck-ert-with-temp-buffer (&rest body)
- "Eval BODY within a temporary buffer.
-
-Like `with-temp-buffer', but resets the modification state of the
-temporary buffer to make sure that it is properly killed even if
-it has a backing file and is modified."
- (declare (indent 0))
- `(with-temp-buffer
- (unwind-protect
- ,(macroexp-progn body)
- ;; Reset modification state of the buffer, and unlink it from its backing
- ;; file, if any, because Emacs refuses to kill modified buffers with
- ;; backing files, even if they are temporary.
- (set-buffer-modified-p nil)
- (set-visited-file-name nil 'no-query))))
-
-(defmacro flycheck-ert-with-file-buffer (file-name &rest body)
- "Create a buffer from FILE-NAME and eval BODY.
-
-BODY is evaluated with `current-buffer' being a buffer with the
-contents FILE-NAME."
- (declare (indent 1))
- `(let ((file-name ,file-name))
- (unless (file-exists-p file-name)
- (error "%s does not exist" file-name))
- (flycheck-ert-with-temp-buffer
- (insert-file-contents file-name 'visit)
- (set-visited-file-name file-name 'no-query)
- (cd (file-name-directory file-name))
- ;; Mark the buffer as not modified, because we just loaded the file up to
- ;; now.
- (set-buffer-modified-p nil)
- ,@body)))
-
-(defmacro flycheck-ert-with-help-buffer (&rest body)
- "Execute BODY and kill the help buffer afterwards.
-
-Use this macro to test functions that create a Help buffer."
- (declare (indent 0))
- `(unwind-protect
- ,(macroexp-progn body)
- (when (buffer-live-p (get-buffer (help-buffer)))
- (kill-buffer (help-buffer)))))
-
-(defmacro flycheck-ert-with-global-mode (&rest body)
- "Execute BODY with Global Flycheck Mode enabled.
-
-After BODY, restore the old state of Global Flycheck Mode."
- (declare (indent 0))
- `(let ((old-state global-flycheck-mode))
- (unwind-protect
- (progn
- (global-flycheck-mode 1)
- ,@body)
- (global-flycheck-mode (if old-state 1 -1)))))
-
-(defmacro flycheck-ert-with-env (env &rest body)
- "Add ENV to `process-environment' in BODY.
-
-Execute BODY with a `process-environment' with contains all
-variables from ENV added.
-
-ENV is an alist, where each cons cell `(VAR . VALUE)' is a
-environment variable VAR to be added to `process-environment'
-with VALUE."
- (declare (indent 1))
- `(let ((process-environment (copy-sequence process-environment)))
- (pcase-dolist (`(,var . ,value) ,env)
- (setenv var value))
- ,@body))
-
-\f
-;;; Test resources
-(defun flycheck-ert-resource-filename (resource-file)
- "Determine the absolute file name of a RESOURCE-FILE.
-
-Relative file names are expanded against
-`flycheck-ert-resources-directory'."
- (expand-file-name resource-file flycheck-ert--resource-directory))
-
-(defmacro flycheck-ert-with-resource-buffer (resource-file &rest body)
- "Create a temp buffer from a RESOURCE-FILE and execute BODY.
-
-The absolute file name of RESOURCE-FILE is determined with
-`flycheck-ert-resource-filename'."
- (declare (indent 1))
- `(flycheck-ert-with-file-buffer
- (flycheck-ert-resource-filename ,resource-file)
- ,@body))
-
-(defun flycheck-ert-locate-config-file (filename _checker)
- "Find a configuration FILENAME within unit tests.
-
-_CHECKER is ignored."
- (let* ((directory (flycheck-ert-resource-filename "config-files"))
- (filepath (expand-file-name filename directory)))
- (when (file-exists-p filepath)
- filepath)))
-
-\f
-;;; Test suite initialization
-
-(defun flycheck-ert-initialize (resource-dir)
- "Initialize a test suite with RESOURCE-DIR.
-
-RESOURCE-DIR is the directory, `flycheck-ert-resource-filename'
-should use to lookup resource files."
- (when flycheck-ert--resource-directory
- (error "Test suite already initialized"))
- (let ((tests (ert-select-tests t t)))
- ;; Select all tests
- (unless tests
- (error "No tests defined. Call `flycheck-ert-initialize' after defining all tests!"))
-
- (setq flycheck-ert--resource-directory resource-dir)
-
- ;; Emacs 24.3 don't support skipped tests, so we add poor man's test
- ;; skipping: We mark skipped tests as expected failures by adjusting the
- ;; expected result of all test cases. Not particularly pretty, but works :)
- (unless flycheck-ert-ert-can-skip
- (dolist (test tests)
- (let ((result (ert-test-expected-result-type test)))
- (setf (ert-test-expected-result-type test)
- `(or ,result (satisfies ert-test-skipped-p))))))))
-
-\f
-;;; Environment and version information
-
-(defconst flycheck-ert-user-error-type
- (if (version< emacs-version "24.2")
- 'error
- 'user-error)
- "The `user-error' type used by Flycheck.")
-
-(defun flycheck-ert-travis-ci-p ()
- "Determine whether we are running on Travis CI."
- (string= (getenv "TRAVIS") "true"))
-
-(defun flycheck-ert-check-gpg ()
- "Check whether GPG is available."
- (or (epg-check-configuration (epg-configuration)) t))
-
-(defun flycheck-ert-extract-version-command (re executable &rest args)
- "Use RE to extract the version from EXECUTABLE with ARGS.
-
-Run EXECUTABLE with ARGS, catch the output, and apply RE to find
-the version number. Return the text captured by the first group
-in RE, or nil, if EXECUTABLE is missing, or if RE failed to
-match."
- (-when-let (executable (executable-find executable))
- (with-temp-buffer
- (apply #'call-process executable nil t nil args)
- (goto-char (point-min))
- (when (re-search-forward re nil 'no-error)
- (match-string 1)))))
-
-\f
-;;; Test case definitions
-(defmacro flycheck-ert-def-checker-test (checker language name
- &rest keys-and-body)
- "Define a test case for a syntax CHECKER for LANGUAGE.
-
-CHECKER is a symbol or a list of symbols denoting syntax checkers
-being tested by the test. The test case is skipped, if any of
-these checkers cannot be used. LANGUAGE is a symbol or a list of
-symbols denoting the programming languages supported by the
-syntax checkers. This is currently only used for tagging the
-test appropriately.
-
-NAME is a symbol denoting the local name of the test. The test
-itself is ultimately named
-`flycheck-define-checker/CHECKER/NAME'. If CHECKER is a list,
-the first checker in the list is used for naming the test.
-
-Optionally, the keyword arguments `:tags' and `:expected-result'
-may be given. They have the same meaning as in `ert-deftest.',
-and are added to the tags and result expectations set up by this
-macro.
-
-The remaining forms denote the body of the test case, including
-assertions and setup code."
- (declare (indent 3))
- (unless checker
- (error "No syntax checkers specified."))
- (unless language
- (error "No languages specified"))
- (let* ((checkers (if (symbolp checker) (list checker) checker))
- (checker (car checkers))
- (languages (if (symbolp language) (list language) language))
- (language-tags (mapcar (lambda (l) (intern (format "language-%s" l)))
- languages))
- (checker-tags (mapcar (lambda (c) (intern (format "checker-%s" c)))
- checkers))
- (local-name (or name 'default))
- (full-name (intern (format "flycheck-define-checker/%s/%s"
- checker local-name)))
- (keys-and-body (ert--parse-keys-and-body keys-and-body))
- (body (cadr keys-and-body))
- (keys (car keys-and-body))
- (default-tags '(syntax-checker external-tool)))
- `(ert-deftest ,full-name ()
- :expected-result
- (list 'or
- '(satisfies flycheck-ert-syntax-check-timed-out-p)
- ,(or (plist-get keys :expected-result) :passed))
- :tags (append ',(append default-tags language-tags checker-tags)
- ,(plist-get keys :tags))
- ,@(mapcar (lambda (c) `(skip-unless
- ;; Ignore non-command checkers
- (or (not (get ',c 'flycheck-command))
- (executable-find (flycheck-checker-executable ',c)))))
- checkers)
- ,@body)))
-
-\f
-;;; Test case results
-
-(defun flycheck-ert-syntax-check-timed-out-p (result)
- "Whether RESULT denotes a timed-out test.
-
-RESULT is an ERT test result object."
- (and (ert-test-failed-p result)
- (eq (car (ert-test-failed-condition result))
- 'flycheck-ert-syntax-check-timed-out)))
-
-\f
-;;; Syntax checking in tests
-
-(defvar-local flycheck-ert-syntax-checker-finished nil
- "Non-nil if the current checker has finished.")
-
-(add-hook 'flycheck-after-syntax-check-hook
- (lambda () (setq flycheck-ert-syntax-checker-finished t)))
-
-(defconst flycheck-ert-checker-wait-time 10
- "Time to wait until a checker is finished in seconds.
-
-After this time has elapsed, the checker is considered to have
-failed, and the test aborted with failure.")
-
-(put 'flycheck-ert-syntax-check-timed-out 'error-message
- "Syntax check timed out.")
-(put 'flycheck-ert-syntax-check-timed-out 'error-conditions '(error))
-
-(defun flycheck-ert-wait-for-syntax-checker ()
- "Wait until the syntax check in the current buffer is finished."
- (let ((starttime (float-time)))
- (while (and (not flycheck-ert-syntax-checker-finished)
- (< (- (float-time) starttime) flycheck-ert-checker-wait-time))
- (sleep-for 1))
- (unless (< (- (float-time) starttime) flycheck-ert-checker-wait-time)
- (flycheck-stop)
- (signal 'flycheck-ert-syntax-check-timed-out nil)))
- (setq flycheck-ert-syntax-checker-finished nil))
-
-(defun flycheck-ert-buffer-sync ()
- "Like `flycheck-buffer', but synchronously."
- (setq flycheck-ert-syntax-checker-finished nil)
- (should (not (flycheck-running-p)))
- (flycheck-mode) ; This will only start a deferred check,
- (flycheck-buffer) ; so we need an explicit manual check
- ;; After starting the check, the checker should either be running now, or
- ;; already be finished (if it was fast).
- (should (or flycheck-current-syntax-check
- flycheck-ert-syntax-checker-finished))
- ;; Also there should be no deferred check pending anymore
- (should-not (flycheck-deferred-check-p))
- (flycheck-ert-wait-for-syntax-checker))
-
-(defun flycheck-ert-ensure-clear ()
- "Clear the current buffer.
-
-Raise an assertion error if the buffer is not clear afterwards."
- (flycheck-clear)
- (should (not flycheck-current-errors))
- (should (not (-any? (lambda (ov) (overlay-get ov 'flycheck-overlay))
- (overlays-in (point-min) (point-max))))))
-
-\f
-;;; Test assertions
-
-(defun flycheck-ert-should-overlay (error)
- "Test that ERROR has a proper overlay in the current buffer.
-
-ERROR is a Flycheck error object."
- (let* ((overlay (-first (lambda (ov) (equal (overlay-get ov 'flycheck-error)
- error))
- (flycheck-overlays-in 0 (+ 1 (buffer-size)))))
- (region (flycheck-error-region-for-mode error 'symbols))
- (message (flycheck-error-message error))
- (level (flycheck-error-level error))
- (category (flycheck-error-level-overlay-category level))
- (face (get category 'face))
- (fringe-bitmap (flycheck-error-level-fringe-bitmap level))
- (fringe-face (flycheck-error-level-fringe-face level))
- (fringe-icon (list 'left-fringe fringe-bitmap fringe-face)))
- (should overlay)
- (should (overlay-get overlay 'flycheck-overlay))
- (should (= (overlay-start overlay) (car region)))
- (should (= (overlay-end overlay) (cdr region)))
- (should (eq (overlay-get overlay 'face) face))
- (should (equal (get-char-property 0 'display
- (overlay-get overlay 'before-string))
- fringe-icon))
- (should (eq (overlay-get overlay 'category) category))
- (should (equal (overlay-get overlay 'flycheck-error) error))
- (should (string= (overlay-get overlay 'help-echo) message))))
-
-(defun flycheck-ert-should-errors (&rest errors)
- "Test that the current buffers has ERRORS.
-
-ERRORS is a list of errors expected to be present in the current
-buffer. Each error is given as a list of arguments to
-`flycheck-error-new-at'.
-
-If ERRORS are omitted, test that there are no errors at all in
-the current buffer.
-
-With ERRORS, test that each error in ERRORS is present in the
-current buffer, and that the number of errors in the current
-buffer is equal to the number of given ERRORS. In other words,
-check that the buffer has all ERRORS, and no other errors."
- (let ((expected (mapcar (apply-partially #'apply #'flycheck-error-new-at)
- errors)))
- (should (equal expected flycheck-current-errors))
- (mapc #'flycheck-ert-should-overlay expected))
- (should (= (length errors)
- (length (flycheck-overlays-in (point-min) (point-max))))))
-
-(defun flycheck-ert-should-syntax-check (resource-file modes &rest errors)
- "Test a syntax check in RESOURCE-FILE with MODES.
-
-RESOURCE-FILE is the file to check. MODES is a single major mode
-symbol or a list thereof, specifying the major modes to syntax
-check with. If more than one major mode is specified, the test
-is run for each mode separately, so if you give three major
-modes, the entire test will run three times. ERRORS is the list
-of expected errors, as in `flycheck-ert-should-errors'. If
-omitted, the syntax check must not emit any errors. The errors
-are cleared after each test.
-
-The syntax checker is selected via standard syntax checker
-selection. To test a specific checker, you need to set
-`flycheck-checker' or `flycheck-disabled-checkers' accordingly
-before using this predicate, depending on whether you want to use
-manual or automatic checker selection.
-
-During the syntax check, configuration files of syntax checkers
-are also searched in the `config-files' sub-directory of the
-resource directory."
- (when (symbolp modes)
- (setq modes (list modes)))
- (dolist (mode modes)
- (unless (fboundp mode)
- (ert-skip (format "%S missing" mode)))
- (flycheck-ert-with-resource-buffer resource-file
- (funcall mode)
- ;; Configure config file locating for unit tests
- (dolist (fn '(flycheck-locate-config-file-absolute-path
- flycheck-ert-locate-config-file))
- (add-hook 'flycheck-locate-config-file-functions fn 'append 'local))
- (let ((process-hook-called 0))
- (add-hook 'flycheck-process-error-functions
- (lambda (_err)
- (setq process-hook-called (1+ process-hook-called))
- nil)
- nil :local)
- (flycheck-ert-buffer-sync)
- (apply #'flycheck-ert-should-errors errors)
- (should (= process-hook-called (length errors))))
- (flycheck-ert-ensure-clear))))
-
-(defun flycheck-ert-at-nth-error (n)
- "Determine whether point is at the N'th Flycheck error.
-
-Return non-nil if the point is at the N'th Flycheck error in the
-current buffer. Otherwise return nil."
- (let* ((error (nth (1- n) flycheck-current-errors))
- (mode flycheck-highlighting-mode)
- (region (flycheck-error-region-for-mode error mode)))
- (and (member error (flycheck-overlay-errors-at (point)))
- (= (point) (car region)))))
-
-(defun flycheck-ert-explain--at-nth-error (n)
- (let ((errors (flycheck-overlay-errors-at (point))))
- (if (null errors)
- (format "Expected to be at error %s, but no error at point %s"
- n (point))
- (let ((pos (cl-position (car errors) flycheck-current-errors)))
- (format "Expected to be at error %s, but point %s is at error %s"
- n (point) (1+ pos))))))
-
-(put 'flycheck-ert-at-nth-error 'ert-explainer
- 'flycheck-ert-explain--at-nth-error)
-
-(provide 'flycheck-ert)
-
-;;; flycheck-ert.el ends here
+++ /dev/null
-(define-package "flycheck" "20150703.359" "On-the-fly syntax checking"
- '((dash "2.4.0")
- (pkg-info "0.4")
- (let-alist "1.0.1")
- (cl-lib "0.3")
- (emacs "24.1"))
- :url "https://www.flycheck.org" :keywords
- '("convenience" "languages" "tools"))
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
+++ /dev/null
-;;; flycheck.el --- On-the-fly syntax checking -*- lexical-binding: t; -*-
-
-;; Copyright (c) 2012-2015 Sebastian Wiesner and Flycheck contributors
-;; Copyright (C) 2013, 2014 Free Software Foundation, Inc.
-;;
-;; Author: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
-;; Maintainer: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
-;; URL: https://www.flycheck.org
-;; Keywords: convenience, languages, tools
-;; Version: 0.24-cvs
-;; Package-Requires: ((dash "2.4.0") (pkg-info "0.4") (let-alist "1.0.1") (cl-lib "0.3") (emacs "24.1"))
-
-;; 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.
-;;
-;; This package provides on-the-fly syntax checking for GNU Emacs 24. It is a
-;; replacement for the older Flymake extension which is part of GNU Emacs, with
-;; many improvements and additional features.
-;;
-;; Flycheck provides fully-automatic, fail-safe, on-the-fly background syntax
-;; checking for over 30 programming and markup languages with more than 70
-;; different tools. It highlights errors and warnings inline in the buffer, and
-;; provides 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.
-;;
-;; # 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.
-;;
-;; # Documentation
-;;
-;; Flycheck comes with a rich manual, which you can read in Emacs with `M-x
-;; flycheck-info' after installing this package. It is also available online at
-;; URL `http://www.flycheck.org/manual/latest/index.html'.
-;;
-;; The manual has a Quickstart section which gives you a short and comprehensive
-;; introduction into Flycheck's features and usage, and a complete list of all
-;; supported languages and tools.
-
-;;; Code:
-
-(eval-when-compile
- (require 'let-alist) ; `let-alist'
- (require 'cl-lib) ; `cl-defstruct'
- (require 'compile) ; Compile Mode integration
- (require 'package) ; Tell Emacs about package-user-dir
- (require 'sh-script) ; `sh-shell' for sh checker predicates
- (require 'jka-compr) ; For JKA workarounds in `flycheck-temp-file-system'
- (require 'pcase) ; `pcase-dolist' (`pcase' itself is autoloaded)
- )
-
-(require 'dash)
-
-(require 'subr-x nil 'no-error) ; Additional utilities, Emacs 24.4 and upwards
-(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'
-
-;; Tell the byte compiler about autoloaded functions from packages
-(declare-function pkg-info-version-info "pkg-info" (package))
-
-\f
-;;; Compatibility
-(eval-and-compile
- ;; `defvar-local' Emacs 24.2 and below
- (unless (fboundp 'defvar-local)
- (defmacro defvar-local (var val &optional docstring)
- "Define VAR as a buffer-local variable with default value VAL.
-Like `defvar' but additionally marks the variable as being automatically
-buffer-local wherever it is set."
- (declare (debug defvar) (doc-string 3))
- `(progn
- (defvar ,var ,val ,docstring)
- (make-variable-buffer-local ',var))))
-
- (unless (fboundp 'setq-local)
- ;; `setq-local' for Emacs 24.2 and below
- (defmacro setq-local (var val)
- "Set variable VAR to value VAL in current buffer."
- `(set (make-local-variable ',var) ,val)))
-
- (unless (fboundp 'user-error)
- ;; `user-error' for Emacs 24.2 and below
- (defalias 'user-error 'error)
-
- (add-to-list 'debug-ignored-errors
- (rx string-start "No more Flycheck errors" string-end))
- (add-to-list 'debug-ignored-errors
- (rx string-start "Flycheck mode disabled" string-end))
- (add-to-list 'debug-ignored-errors
- (rx string-start "Configured syntax checker "
- symbol-start (one-or-more not-newline) symbol-end
- " cannot be used" string-end)))
-
- (unless (fboundp 'string-suffix-p)
- ;; `string-suffix-p' for Emacs 24.3 and below
- (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))))))
-
- (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 ""))))
-
-(when (and (not (get 'exclamation-mark 'fringe))
- (fboundp 'define-fringe-bitmap))
- ;; Provide `exclamation-mark' bitmap for Emacs 24.2 and below. We also check,
- ;; whether `define-fringe-bitmap' is defined, because this function is not
- ;; available if Emacs is built without GUI support. See
- ;; https://github.com/flycheck/flycheck/issues/57
- (define-fringe-bitmap 'exclamation-mark
- [24 60 60 24 24 0 0 24 24] nil nil 'center))
-
-\f
-;;; 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")
- :link '(custom-manual "(flycheck)Top")
- :link '(info-link "(flycheck)Usage"))
-
-(defgroup flycheck-config-files nil
- "Configuration files for on-the-fly syntax checkers."
- :prefix "flycheck-"
- :group 'flycheck
- :link '(custom-manual "(flycheck)Syntax checker configuration files"))
-
-(defgroup flycheck-options nil
- "Options for on-the-fly syntax checkers."
- :prefix "flycheck-"
- :group 'flycheck
- :link '(custom-manual "(flycheck)Syntax checker options"))
-
-(defgroup flycheck-executables nil
- "Executables of syntax checkers."
- :prefix "flycheck-"
- :group 'flycheck
- :link '(custom-manual "(flycheck)Syntax checker executables"))
-
-(defgroup flycheck-faces nil
- "Faces used by on-the-fly syntax checking."
- :prefix "flycheck-"
- :group 'flycheck
- :link '(info-link "(flycheck)Error reporting"))
-
-(defcustom flycheck-checkers
- '(ada-gnat
- asciidoc
- c/c++-clang
- c/c++-gcc
- c/c++-cppcheck
- cfengine
- chef-foodcritic
- coffee
- coffee-coffeelint
- coq
- css-csslint
- d-dmd
- emacs-lisp
- emacs-lisp-checkdoc
- erlang
- eruby-erubis
- fortran-gfortran
- go-gofmt
- go-golint
- go-vet
- go-build
- go-test
- go-errcheck
- haml
- handlebars
- haskell-ghc
- haskell-hlint
- html-tidy
- javascript-jshint
- javascript-eslint
- javascript-gjslint
- javascript-jscs
- javascript-standard
- json-jsonlint
- less
- luacheck
- lua
- perl
- perl-perlcritic
- php
- php-phpmd
- php-phpcs
- puppet-parser
- puppet-lint
- python-flake8
- python-pylint
- python-pycompile
- r-lintr
- racket
- rpm-rpmlint
- rst
- rst-sphinx
- ruby-rubocop
- ruby-rubylint
- ruby
- ruby-jruby
- rust
- sass
- scala
- scala-scalastyle
- scss-lint
- scss
- sh-bash
- sh-posix-dash
- sh-posix-bash
- sh-zsh
- sh-shellcheck
- slim
- tex-chktex
- tex-lacheck
- texinfo
- verilog-verilator
- xml-xmlstarlet
- xml-xmllint
- yaml-jsyaml
- yaml-ruby)
- "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-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-indication-mode 'left-fringe
- "The indication mode for Flycheck errors and warnings.
-
-This variable controls how Flycheck indicates errors in buffers.
-May either be `left-fringe', `right-fringe', or nil.
-
-If set to `left-fringe' or `right-fringe', indicate errors and
-warnings via icons in the left and right fringe respectively.
-
-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 "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. The following modes are known:
-
-`columns'
- Highlight the error column. If the error does not have a column,
- highlight the whole line.
-
-`symbols'
- Highlight the symbol at the error column, if there is any,
- otherwise behave like `columns'. This is the default.
-
-`sexps'
- Highlight the expression at the error column, 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)
-
-(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.
-
-`new-line'
- Check syntax immediately after a new line was inserted into
- the buffer.
-
-`mode-enabled'
- Check syntax immediately when `flycheck-mode' is enabled.
-
-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 a new line was inserted" new-line)
- (const :tag "After `flycheck-mode' was enabled" mode-enabled))
- :package-version '(flycheck . "0.12")
- :safe #'symbolp)
-
-(defcustom flycheck-idle-change-delay 0.5
- "How many seconds to wait before checking syntax automatically.
-
-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-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 `flycheck-mode' is
-enabled. Changing it will not affect buffers which already have
-`flycheck-mode' enabled."
- :group 'flycheck
- :type 'boolean
- :package-version '(flycheck . "0.15")
- :safe #'booleanp)
-
-(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 '(radio (const :tag "All locations" nil)
- (const :tag "Informational messages" info)
- (const :tag "Warnings" warning)
- (const :tag "Errors" error)
- (symbol :tag "Custom error level"))
- :safe #'flycheck-error-level-p
- :package-version '(flycheck . "0.21"))
-
-(defcustom flycheck-completion-system nil
- "The completion system to use.
-
-`ido'
- Use IDO.
-
- IDO is a built-in alternative completion system, without
- good flex matching and a powerful UI. You may want to
- install flx-ido (see URL `https://github.com/lewang/flx') to
- improve the flex matching in IDO.
-
-`grizzl'
- Use Grizzl.
-
- Grizzl is an alternative completion system with powerful
- flex matching, but a very limited UI. See URL
- `https://github.com/d11wtq/grizzl'.
-
-nil
- Use the standard unfancy `completing-read'.
-
- `completing-read' has a very simple and primitive UI, and
- does not offer flex matching. This is the default setting,
- though, to match Emacs' defaults. With this system, you may
- want enable option `icomplete-mode' to improve the display
- of completion candidates at least."
- :group 'flycheck
- :type '(choice (const :tag "IDO" ido)
- (const :tag "Grizzl" grizzl)
- (const :tag "Completing read" nil))
- :package-version '(flycheck . "0.17"))
-
-(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 `flycheck-mode'."
- :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 sinlge argument, as
-given to `flycheck-report-status', which see.
-
-This variable is a 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
- '((((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
- '((t :inherit error))
- "Flycheck face for fringe error indicators."
- :package-version '(flycheck . "0.13")
- :group 'flycheck-faces)
-
-(defface flycheck-fringe-warning
- '((t :inherit warning))
- "Flycheck face for fringe warning indicators."
- :package-version '(flycheck . "0.13")
- :group 'flycheck-faces)
-
-(defface flycheck-fringe-info
- ;; Semantically `success' is probably not the right face, but it looks nice as
- ;; a base face
- '((t :inherit success))
- "Flycheck face for fringe info indicators."
- :package-version '(flycheck . "0.15")
- :group 'flycheck-faces)
-
-(defface flycheck-error-list-error
- '((t :inherit error))
- "Flycheck face for error messages in the error list."
- :package-version '(flycheck . "0.16")
- :group 'flycheck-faces)
-
-(defface flycheck-error-list-warning
- '((t :inherit warning))
- "Flycheck face for warning messages in the error list."
- :package-version '(flycheck . "0.16")
- :group 'flycheck-faces)
-
-(defface flycheck-error-list-info
- '((t :inherit success))
- "Flycheck face for info messages in the error list."
- :package-version '(flycheck . "0.16")
- :group 'flycheck-faces)
-
-;; The base faces for the following two faces are inspired by Compilation Mode
-(defface flycheck-error-list-line-number
- '((t :inherit font-lock-constant-face))
- "Face for line numbers in the error list."
- :group 'flycheck-faces
- :package-version '(flycheck . "0.16"))
-
-(defface flycheck-error-list-column-number
- '((t :inherit font-lock-constant-face))
- "Face for line numbers in the error list."
- :group 'flycheck-faces
- :package-version '(flycheck . "0.16"))
-
-(defface flycheck-error-list-id
- '((t :inherit font-lock-type-face))
- "Face for the error ID in the error list."
- :group 'flycheck-faces
- :package-version '(flycheck . "0.22"))
-
-(defface flycheck-error-list-checker-name
- '((t :inherit font-lock-function-name-face))
- "Face for the syntax checker name in the error list."
- :group 'flycheck-faces
- :package-version '(flycheck . "0.21"))
-
-(defface flycheck-error-list-highlight
- '((t :inherit highlight))
- "Flycheck face to highlight errors in the error list."
- :package-version '(flycheck . "0.15")
- :group 'flycheck-faces)
-
-(defvar flycheck-command-map
- (let ((map (make-sparse-keymap)))
- (define-key map "c" #'flycheck-buffer)
- (define-key map "C" #'flycheck-clear)
- (define-key map (kbd "C-c") #'flycheck-compile)
- (define-key map "n" #'flycheck-next-error)
- (define-key map "p" #'flycheck-previous-error)
- (define-key map "l" #'flycheck-list-errors)
- (define-key map (kbd "C-w") #'flycheck-copy-errors-as-kill)
- (define-key map "s" #'flycheck-select-checker)
- (define-key map "e" #'flycheck-set-checker-executable)
- (define-key map "?" #'flycheck-describe-checker)
- (define-key map "i" #'flycheck-info)
- (define-key map "V" #'flycheck-version)
- (define-key map "v" #'flycheck-verify-setup)
- (define-key map "x" #'flycheck-disable-checker)
- map)
- "Keymap of Flycheck interactive commands.")
-
-(defcustom flycheck-keymap-prefix (kbd "C-c !")
- "Prefix for key bindings of Flycheck.
-
-Changing this variable outside Customize does not have any
-effect. To change the keymap prefix from Lisp, you need to
-explicitly re-define the prefix key:
-
- (define-key flycheck-mode-map flycheck-keymap-prefix nil)
- (setq flycheck-keymap-prefix (kbd \"C-c f\"))
- (define-key flycheck-mode-map flycheck-keymap-prefix
- flycheck-command-map)
-
-Please note that Flycheck's manual documents the default
-keybindings. Changing this variable is at your own risk."
- :group 'flycheck
- :package-version '(flycheck . "0.19")
- :type 'string
- :risky t
- :set
- (lambda (variable key)
- (when (and (boundp variable) (boundp 'flycheck-mode-map))
- (define-key flycheck-mode-map (symbol-value variable) nil)
- (define-key flycheck-mode-map key flycheck-command-map))
- (set-default variable key)))
-
-(defcustom flycheck-mode-line '(:eval (flycheck-mode-line-status-text))
- "Mode line lighter for Flycheck.
-
-The value of this variable is a mode line template as in
-`mode-line-format'. See Info Node `(elisp)Mode Line Format' for
-more information. Note that it should contain a _single_ mode
-line construct only.
-
-Customize this variable to change how Flycheck reports its status
-in the mode line. You may use `flycheck-mode-line-status-text'
-to obtain a human-readable status text, including an
-error/warning count.
-
-You may also assemble your own status text. The current status
-of Flycheck is available in `flycheck-last-status-change'. The
-errors in the current buffer are stored in
-`flycheck-current-errors', and the function
-`flycheck-count-errors' may be used to obtain the number of
-errors grouped by error level.
-
-Set this variable to nil to disable the mode line completely."
- :group 'flycheck
- :type 'sexp
- :risky t
- :package-version '(flycheck . "0.20"))
-
-(defcustom flycheck-error-list-mode-line
- `(,(propertized-buffer-identification "%12b")
- " for buffer "
- (:eval (flycheck-error-list-propertized-source-name)))
- "Mode line construct for Flycheck error list.
-
-The value of this variable is a mode line template as in
-`mode-line-format', to be used as
-`mode-line-buffer-identification' in `flycheck-error-list-mode'.
-See Info Node `(elisp)Mode Line Format' for more information.
-
-Customize this variable to change how the error list appears in
-the mode line. The default shows the name of the buffer and the
-name of the source buffer, i.e. the buffer whose errors are
-currently listed."
- :group 'flycheck
- :type 'sexp
- :risky t
- :package-version '(flycheck . "0.20"))
-
-(defcustom flycheck-global-modes t
- "Modes for which `flycheck-mode' is turned on by `global-flycheck-mode'.
-
-If t, Flycheck Mode is turned on for all major modes. If a list,
-Flycheck Mode is turned on for all `major-mode' symbols in that
-list. If the `car' of the list is `not', Flycheck Mode is turned
-on for all `major-mode' symbols _not_ in that list. If nil,
-Flycheck Mode is never turned on by `global-flycheck-mode'.
-
-Note that Flycheck is never turned on for modes whose
-`mode-class' property is `special' (see Info node `(elisp)Major
-Mode Conventions'), regardless of the value of this option."
- :group 'flycheck
- :type '(choice (const :tag "none" nil)
- (const :tag "all" t)
- (set :menu-tag "mode specific" :tag "modes"
- :value (not)
- (const :tag "Except" not)
- (repeat :inline t (symbol :tag "mode"))))
- :risky t
- :package-version '(flycheck . "0.23"))
-
-;; Add built-in functions to our hooks, via `add-hook', to make sure that our
-;; functions are really present, even if the variable was implicitly defined by
-;; another call to `add-hook' that occurred before Flycheck was loaded. See
-;; http://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01271.html for why
-;; we don't initialize the hook variables right away. We append our own
-;; functions, because a user likely expects that their functions come first,
-;; even if the added them before Flycheck was loaded.
-(dolist (hook (list #'flycheck-locate-config-file-absolute-path
- #'flycheck-locate-config-file-ancestor-directories
- #'flycheck-locate-config-file-home))
- (add-hook 'flycheck-locate-config-file-functions hook 'append))
-
-(add-hook 'flycheck-process-error-functions #'flycheck-add-overlay 'append)
-
-\f
-;;; Global Flycheck menu
-(defvar flycheck-mode-menu-map
- (easy-menu-create-menu
- "Syntax Checking"
- '(["Enable on-the-fly syntax checking" flycheck-mode
- :style toggle :selected flycheck-mode
- ;; Don't let users toggle the mode if there is no syntax checker for this
- ;; buffer
- :enable (or flycheck-mode (flycheck-get-checker-for-buffer))]
- ["Check current buffer" flycheck-buffer flycheck-mode]
- ["Clear errors in buffer" flycheck-clear t]
- "---"
- ["Go to next error" flycheck-next-error flycheck-mode]
- ["Go to previous error" flycheck-previous-error flycheck-mode]
- ["Show all errors" flycheck-list-errors flycheck-mode]
- "---"
- ["Copy messages at point" flycheck-copy-errors-as-kill
- (flycheck-overlays-at (point))]
- "---"
- ["Select syntax checker" flycheck-select-checker flycheck-mode]
- ["Disable syntax checker" flycheck-disable-checker flycheck-mode]
- ["Set executable of syntax checker" flycheck-set-checker-executable
- flycheck-mode]
- "---"
- ["Describe syntax checker" flycheck-describe-checker t]
- ["Show Flycheck version" flycheck-version t]
- ["Read the Flycheck manual" flycheck-info t]))
- "Menu of `flycheck-mode'.")
-
-(easy-menu-add-item nil '("Tools") flycheck-mode-menu-map "Spell Checking")
-
-\f
-;;; Version information, manual and loading of Flycheck
-(defun flycheck-version (&optional show-version)
- "Get the Flycheck version as string.
-
-If called interactively or if SHOW-VERSION is non-nil, show the
-version in the echo area and the messages buffer.
-
-The returned string includes both, the version from package.el
-and the library version, if both a present and different.
-
-If the version number could not be determined, signal an error,
-if called interactively, or if SHOW-VERSION is non-nil, otherwise
-just return nil."
- (interactive (list t))
- (let ((version (pkg-info-version-info 'flycheck)))
- (when show-version
- (message "Flycheck version: %s" version))
- version))
-
-(defun flycheck-unload-function ()
- "Unload function for Flycheck."
- (global-flycheck-mode -1)
- (easy-menu-remove-item nil '("Tools") (cadr flycheck-mode-menu-map))
- (remove-hook 'kill-emacs-hook #'flycheck-global-teardown)
- (setq find-function-regexp-alist
- (assq-delete-all 'flycheck-checker find-function-regexp-alist)))
-
-;;;###autoload
-(defun flycheck-info ()
- "Open the Flycheck manual."
- (interactive)
- (info "flycheck"))
-
-\f
-;;; Utility functions
-(defun flycheck-sexp-to-string (sexp)
- "Convert SEXP to a string.
-
-Like `prin1-to-string' but ensure that the returned string
-is loadable."
- (let ((print-quoted t)
- (print-length nil)
- (print-level nil))
- (prin1-to-string sexp)))
-
-(defun flycheck-string-to-number-safe (string)
- "Safely convert STRING to a number.
-
-If STRING is of string type and a numeric string, convert STRING
-to a number and return it. Otherwise return nil."
- (let ((number-re (rx string-start (one-or-more (any digit)) string-end)))
- (when (and (stringp string) (string-match-p number-re string))
- (string-to-number string))))
-
-(defun flycheck-string-list-p (obj)
- "Determine if OBJ is a list of strings."
- (and (listp obj) (-all? #'stringp obj)))
-
-(defun flycheck-symbol-list-p (obj)
- "Determine if OBJ is a list of symbols."
- (and (listp obj) (-all? #'symbolp obj)))
-
-(defun flycheck-same-files-p (file-a file-b)
- "Determine whether FILE-A and FILE-B refer to the same file."
- (let ((file-a (expand-file-name file-a))
- (file-b (expand-file-name file-b)))
- ;; We must resolve symbolic links here, since some syntax checker always
- ;; output canonical file names with all symbolic links resolved. However,
- ;; we still do a simple path compassion first, to avoid the comparatively
- ;; expensive file system call if possible. See
- ;; https://github.com/flycheck/flycheck/issues/561
- (or (string= (directory-file-name file-a) (directory-file-name file-b))
- (string= (directory-file-name (file-truename file-a))
- (directory-file-name (file-truename file-b))))))
-
-(defvar-local flycheck-temporaries nil
- "Temporary files and directories created by Flycheck.")
-
-(defun flycheck-temp-dir-system ()
- "Create a unique temporary directory.
-
-Use `flycheck-temp-prefix' as prefix, and add the directory to
-`flycheck-temporaries'.
-
-Return the path of the directory"
- (let* ((tempdir (make-temp-file flycheck-temp-prefix 'directory)))
- (push tempdir flycheck-temporaries)
- tempdir))
-
-(defun flycheck-temp-file-system (filename)
- "Create a temporary file named after FILENAME.
-
-If FILENAME is non-nil, this function creates a temporary
-directory with `flycheck-temp-dir-system', and creates a file
-with the same name as FILENAME in this directory.
-
-Otherwise this function creates a temporary file with
-`flycheck-temp-prefix' and a random suffix. The path of the file
-is added to `flycheck-temporaries'.
-
-Add the path of the file to `flycheck-temporaries'.
-
-Return the path of the file."
- (let (tempfile)
- (if filename
- (let ((directory (flycheck-temp-dir-system)))
- (setq tempfile (expand-file-name (file-name-nondirectory filename)
- directory)))
- (setq tempfile (make-temp-file flycheck-temp-prefix)))
- (push tempfile flycheck-temporaries)
- tempfile))
-
-(defun flycheck-temp-file-inplace (filename)
- "Create an in-place copy of FILENAME.
-
-Prefix the file with `flycheck-temp-prefix' and add the path of
-the file to `flycheck-temporaries'.
-
-If FILENAME is nil, fall back to `flycheck-temp-file-system'.
-
-Return the path of the file."
- (if filename
- (let* ((tempname (format "%s_%s"
- flycheck-temp-prefix
- (file-name-nondirectory filename)))
- (tempfile (expand-file-name tempname
- (file-name-directory filename))))
- (push tempfile flycheck-temporaries)
- tempfile)
- (flycheck-temp-file-system filename)))
-
-(defun flycheck-save-buffer-to-file (file-name)
- "Save the contents of the current buffer to FILE-NAME."
- (make-directory (file-name-directory file-name) t)
- (let ((jka-compr-inhibit t))
- (write-region nil nil file-name nil 0)))
-
-(defun flycheck-save-buffer-to-temp (temp-file-fn)
- "Save buffer to temp file returned by TEMP-FILE-FN.
-
-Return the name of the temporary file."
- (let ((filename (funcall temp-file-fn (buffer-file-name))))
- ;; Do not flush short-lived temporary files onto disk
- (let ((write-region-inhibit-fsync t))
- (flycheck-save-buffer-to-file filename))
- filename))
-
-(defun flycheck-prepend-with-option (option items &optional prepend-fn)
- "Prepend OPTION to each item in ITEMS, using PREPEND-FN.
-
-Prepend OPTION to each item in ITEMS.
-
-ITEMS is a list of strings to pass to the syntax checker. OPTION
-is the option, as string. PREPEND-FN is a function called to
-prepend OPTION to each item in ITEMS. It receives the option and
-a single item from ITEMS as argument, and must return a string or
-a list of strings with OPTION prepended to the item. If
-PREPEND-FN is nil or omitted, use `list'.
-
-Return a list of strings where OPTION is prepended to each item
-in ITEMS using PREPEND-FN. If PREPEND-FN returns a list, it is
-spliced into the resulting list."
- (unless (stringp option)
- (error "Option %S is not a string" option))
- (unless prepend-fn
- (setq prepend-fn #'list))
- (let ((prepend
- (lambda (item)
- (let ((result (funcall prepend-fn option item)))
- (cond
- ((and (listp result) (-all? #'stringp result)) result)
- ((stringp result) (list result))
- (t (error "Invalid result type for option: %S" result)))))))
- (apply #'append (mapcar prepend items))))
-
-(defun flycheck-find-in-buffer (pattern)
- "Find PATTERN in the current buffer.
-
-Return the result of the first matching group of PATTERN, or nil,
-if PATTERN did not match."
- (save-restriction
- (widen)
- (save-excursion
- (goto-char (point-min))
- (when (re-search-forward pattern nil 'no-error)
- (match-string-no-properties 1)))))
-
-(defun flycheck-ephemeral-buffer-p ()
- "Determine whether the current buffer is an ephemeral buffer.
-
-See Info node `(elisp)Buffer Names' for information about
-ephemeral buffers."
- (string-prefix-p " " (buffer-name)))
-
-(defun flycheck-encrypted-buffer-p ()
- "Determine whether the current buffer is an encrypted file.
-
-See Info node `(epa)Top' for Emacs' interface to encrypted
-files."
- ;; The EPA file handler sets this variable locally to remember the recipients
- ;; of the encrypted file for re-encryption. Hence, a local binding of this
- ;; variable is a good indication that the buffer is encrypted. I haven't
- ;; found any better indicator anyway.
- (local-variable-p 'epa-file-encrypt-to))
-
-(defun flycheck-autoloads-file-p ()
- "Determine whether the current buffer is a autoloads file.
-
-Autoloads are generated by package.el during installation."
- (string-suffix-p "-autoloads.el" (buffer-name)))
-
-(defun flycheck-in-user-emacs-directory-p (filename)
- "Whether FILENAME is in `user-emacs-directory'."
- (string-prefix-p (file-name-as-directory (file-truename user-emacs-directory))
- (file-truename filename)))
-
-(defun flycheck-safe-delete (file-or-dir)
- "Safely delete FILE-OR-DIR."
- (ignore-errors
- (if (file-directory-p file-or-dir)
- (delete-directory file-or-dir 'recursive)
- (delete-file file-or-dir))))
-
-(defun flycheck-safe-delete-temporaries ()
- "Safely delete all temp files and directories of Flycheck.
-
-Safely delete all files and directories listed in
-`flycheck-temporaries' and set the variable's value to nil."
- (mapc #'flycheck-safe-delete flycheck-temporaries)
- (setq flycheck-temporaries nil))
-
-(eval-and-compile
- (defun flycheck-rx-file-name (form)
- "Translate the `(file-name)' FORM into a regular expression."
- (let ((body (or (cdr form) '((minimal-match
- (one-or-more not-newline))))))
- (rx-submatch-n `(group-n 1 ,@body))))
-
- (defun flycheck-rx-message (form)
- "Translate the `(message)' FORM into a regular expression."
- (let ((body (or (cdr form) '((one-or-more not-newline)))))
- (rx-submatch-n `(group-n 4 ,@body))))
-
- (defun flycheck-rx-id (form)
- "Translate the `(id)' FORM into a regular expression."
- (rx-submatch-n `(group-n 5 ,@(cdr form))))
-
- (defun flycheck-rx-to-string (form &optional no-group)
- "Like `rx-to-string' for FORM, but with special keywords:
-
-`line'
- matches the line number.
-
-`column'
- matches the column number.
-
-`(file-name SEXP ...)'
- matches the file name. SEXP describes the file name. If no
- SEXP is given, use a default body of `(minimal-match
- (one-or-more not-newline))'.
-
-`(message SEXP ...)'
- matches the message. SEXP constitutes the body of the message. If no SEXP
- is given, use a default body of `(one-or-more not-newline)'.
-
-`(id SEXP ...)'
- matches an error ID. SEXP describes the ID.
-
-NO-GROUP is passed to `rx-to-string'."
- (let ((rx-constituents
- (append
- `((line . ,(rx (group-n 2 (one-or-more digit))))
- (column . ,(rx (group-n 3 (one-or-more digit))))
- (file-name flycheck-rx-file-name 0 nil)
- (message flycheck-rx-message 0 nil)
- (id flycheck-rx-id 0 nil))
- rx-constituents nil)))
- (rx-to-string form no-group))))
-
-(defun flycheck-current-load-file ()
- "Get the source file currently being loaded.
-
-Always return the name of the corresponding source file, never
-any byte-compiled file.
-
-Return nil, if the currently loaded file cannot be determined."
- (-when-let* ((this-file (cond
- (load-in-progress load-file-name)
- ((bound-and-true-p byte-compile-current-file))
- (t (buffer-file-name))))
- ;; A best guess for the source file of a compiled library. Works
- ;; well in most cases, and especially for ELPA packages
- (source-file (concat (file-name-sans-extension this-file)
- ".el")))
- (when (file-exists-p source-file)
- source-file)))
-
-(defun flycheck-module-root-directory (module &optional file-name)
- "Get the root directory for a MODULE in FILE-NAME.
-
-MODULE is a qualified module name, either a string with
-components separated by a dot, or as list of components.
-FILE-NAME is the name of the file or directory containing the
-module as string. When nil or omitted, defaults to the return
-value of function `buffer-file-name'.
-
-Return the root directory of the module, that is, the directory,
-from which FILE-NAME can be reached by descending directories
-along each part of MODULE.
-
-If the MODULE name does not match the directory hierarchy upwards
-from FILE-NAME, return the directory containing FILE-NAME. When
-FILE-NAME is nil, return `default-directory'."
- (let ((file-name (or file-name (buffer-file-name)))
- (module-components (if (stringp module)
- (split-string module (rx "."))
- (copy-sequence module))))
- (if (and module-components file-name)
- (let ((parts (nreverse module-components))
- (base-directory (directory-file-name
- (file-name-sans-extension file-name))))
- (while (and parts
- (string= (file-name-nondirectory base-directory)
- (car parts)))
- (pop parts)
- (setq base-directory (directory-file-name
- (file-name-directory base-directory))))
- (file-name-as-directory base-directory))
- (if file-name
- (file-name-directory file-name)
- (expand-file-name default-directory)))))
-
-\f
-;;; Minibuffer tools
-(defvar read-flycheck-checker-history nil
- "`completing-read' history of `read-flycheck-checker'.")
-
-(defun read-flycheck-checker (prompt &optional default property candidates)
- "Read a flycheck checker from minibuffer with PROMPT and DEFAULT.
-
-PROMPT is a string to show in the minibuffer as prompt. It
-should end with a single space. DEFAULT is a symbol denoting the
-default checker to use, if the user did not select any checker.
-PROPERTY is a symbol denoting a syntax checker property. If
-non-nil, only complete syntax checkers which have a non-nil value
-for PROPERTY. CANDIDATES is an optional list of all syntax
-checkers available for completion, defaulting to all defined
-checkers. If given, PROPERTY is ignored.
-
-Return the checker as symbol, or DEFAULT if no checker was
-chosen. If DEFAULT is nil and no checker was chosen, signal a
-`user-error' if the underlying completion system does not provide
-a default on its own."
- (when (and default (not (flycheck-valid-checker-p default)))
- (error "%S is no valid Flycheck checker" default))
- (let* ((candidates (mapcar #'symbol-name
- (or candidates
- (flycheck-defined-checkers property))))
- (default (and default (symbol-name default)))
- (input (pcase flycheck-completion-system
- (`ido (ido-completing-read prompt candidates nil
- 'require-match nil
- 'read-flycheck-checker-history
- default))
- (`grizzl (if (and (fboundp 'grizzl-make-index)
- (fboundp 'grizzl-completing-read))
- (grizzl-completing-read
- prompt (grizzl-make-index candidates))
- (user-error "Please install Grizzl from \
-https://github.com/d11wtq/grizzl")))
- (_ (completing-read prompt candidates nil 'require-match
- nil 'read-flycheck-checker-history
- default)))))
- (when (string-empty-p input)
- (unless default
- (user-error "No syntax checker selected"))
- (setq input default))
- (let ((checker (intern input)))
- (unless (flycheck-valid-checker-p checker)
- (error "%S is no Flycheck syntax checker" checker))
- checker)))
-
-\f
-;;; Checker API
-(defun flycheck-defined-checkers (&optional property)
- "Find all defined syntax checkers, optionally with PROPERTY.
-
-PROPERTY is a symbol. If given, only return syntax checkers with
-a non-nil value for PROPERTY.
-
-The returned list is sorted alphapetically by the symbol name of
-the syntax checkers."
- (let (defined-checkers)
- (mapatoms (lambda (symbol)
- (when (and (flycheck-valid-checker-p symbol)
- (or (null property) (get symbol property)))
- (push symbol defined-checkers))))
- (sort defined-checkers #'string<)))
-
-(defun flycheck-registered-checker-p (checker)
- "Determine whether CHECKER is registered.
-
-A checker is registered if it is contained in
-`flycheck-checkers'."
- (and (flycheck-valid-checker-p checker)
- (memq checker flycheck-checkers)))
-
-(defun flycheck-disabled-checker-p (checker)
- "Determine whether CHECKER is disabled.
-
-A checker is disabled if it is contained in
-`flycheck-disabled-checkers'."
- (memq checker flycheck-disabled-checkers))
-
-(defun flycheck-possibly-suitable-checkers ()
- "Find possibly suitable checkers for the current buffer.
-
-Return a list of all syntax checkers which could possibly be
-suitable for the current buffer, if any problems in their setup
-were fixed.
-
-Currently this function collects all registered syntax checkers
-whose `:modes' contain the current major mode or which do not
-have any `:modes', but a `:predicate' that returns non-nil for
-the current buffer."
- (let (checkers)
- (dolist (checker flycheck-checkers)
- (let ((modes (flycheck-checker-modes checker))
- (predicate (flycheck-checker-predicate checker)))
- (when (or (memq major-mode modes)
- (and (not modes)
- (functionp predicate)
- (funcall predicate)))
- (push checker checkers))))
- (nreverse checkers)))
-
-\f
-;;; Generic syntax checkers
-(defconst flycheck-generic-checker-version 2
- "The internal version of generic syntax checker declarations.
-
-Flycheck will not use syntax checkers whose generic version is
-less than this constant.")
-
-(defun flycheck-validate-next-checker (next &optional strict)
- "Validate NEXT checker.
-
-With STRICT non-nil, also check whether the syntax checker and
-the error level in NEXT are valid. Otherwise just check whether
-these are symbols.
-
-Signal an error if NEXT is not a valid entry for
-`:next-checkers'."
- (when (symbolp next)
- (setq next (cons t next)))
- (pcase next
- (`(,level . ,checker)
- (if strict
- (progn
- (unless (or (eq level t) (flycheck-error-level-p level))
- (error "%S is not a valid Flycheck error level" level))
- (unless (flycheck-valid-checker-p checker)
- (error "%s is not a valid Flycheck syntax checker" checker)))
- (unless (symbolp level)
- (error "Error level %S must be a symbol" level))
- (unless (symbolp checker)
- (error "Checker %S must be a symbol" checker))))
- (_ (error "%S must be a symbol or cons cell" next)))
- t)
-
-(defun flycheck-define-generic-checker (symbol docstring &rest properties)
- "Define SYMBOL as generic syntax checker.
-
-Any syntax checker defined with this macro is eligible for manual
-syntax checker selection with `flycheck-select-checker'. To make
-the new syntax checker available for automatic selection, it must
-be registered in `flycheck-checkers'.
-
-DOCSTRING is the documentation of the syntax checker, for
-`flycheck-describe-checker'. The following PROPERTIES constitute
-a generic syntax checker. Unless otherwise noted, all properties
-are mandatory.
-
-`:start FUNCTION'
- A function to start the syntax checker.
-
- FUNCTION shall take two arguments and return a context
- object if the checker is started successfully. Otherwise it
- shall signal an error.
-
- The first argument is the syntax checker being started. The
- second is a callback function to report state changes to
- Flycheck. The callback takes two arguments STATUS DATA,
- where STATUS is a symbol denoting the syntax checker status
- and DATA an optional argument with additional data for the
- status report. See `flycheck-report-buffer-checker-status'
- for more information about STATUS and DATA.
-
- FUNCTION may be synchronous or asynchronous, i.e. it may
- call the given callback either immediately, or at some later
- point (e.g. from a process sentinel).
-
- A syntax checker _must_ call CALLBACK at least once with a
- STATUS that finishes the current syntax checker. Otherwise
- Flycheck gets stuck at the current syntax check with this
- syntax checker.
-
- The context object returned by FUNCTION is passed to
- `:interrupt'.
-
-`:interrupt FUNCTION'
- A function to interrupt the syntax check.
-
- FUNCTION is called with the syntax checker and the context
- object returned by the `:start' function and shall try to
- interrupt the syntax check. The context may be nil, if the
- syntax check is interrupted before actually started.
- FUNCTION should handle this situation.
-
- If it cannot interrupt the syntax check, it may either
- signal an error or silently ignore the attempt to interrupt
- the syntax checker, depending on the severity of the
- situation.
-
- If interrupting the syntax check failed, Flycheck will let
- the syntax check continue, but ignore any status reports.
- Notably, it won't highlight any errors reported by the
- syntax check in the buffer.
-
- This property is optional. If omitted, Flycheck won't
- attempt to interrupt syntax checks wit this syntax checker,
- and simply ignore their results.
-
-`:print-doc FUNCTION'
- A function to print additional documentation into the Help
- buffer of this checker.
-
- FUNCTION is called when creating the Help buffer for the
- syntax checker, with the syntax checker as single argument,
- after printing the name of the syntax checker and its modes
- and predicate, but before printing DOCSTRING. It may insert
- additional documentation into the current buffer.
-
- The call occurs within `with-help-window'. Hence
- `standard-output' points to the current buffer, so you may
- use `princ' and friends to add content. Also, the current
- buffer is put into Help mode afterwards, which automatically
- turns symbols into references, if possible.
-
- This property is optional. If omitted, no additional
- documentation is printed for this syntax checker.
-
-:verify FUNCTION
- A function to verify the checker for the current buffer.
-
- FUNCTION is called with the syntax checker as single
- argument, and shall return a list of
- `flycheck-verification-result' objects indicating whether
- the syntax checker could be used in the current buffer, and
- highlighting potential setup problems.
-
- This property is optional. If omitted, no additional
- verification occurs for this syntax checker. It is however
- absolutely recommended that you add a `:verify' function to
- your syntax checker, because it will help users to spot
- potential setup problems.
-
-`:modes MODES'
- A major mode symbol or a list thereof, denoting major modes
- to use this syntax checker in.
-
- If given this syntax checker is only used in buffers whose
- `major-mode' is `eq' to any mode in MODES.
-
- If `:predicate' is also given, the syntax checker will only
- be used in buffers for which the `:predicate' returns
- non-nil.
-
- This property is optional, however at least one of `:modes'
- or `:predicate' must be given.
-
-`:predicate FUNCTION'
- A function to determine whether to use the syntax checker in
- the current buffer.
-
- FUNCTION is called without arguments and shall return
- non-nil if this syntax checker shall be used to check the
- current buffer. Otherwise it shall return nil.
-
- If `:modes' is also given, FUNCTION is only called in
- matching major modes.
-
- This property is optional, however at least one of `:modes'
- or `:predicate' must be given.
-
-`:error-filter FUNCTION'
- A function to filter the errors returned by this checker.
-
- FUNCTION is called with the list of `flycheck-error' objects
- returned by the syntax checker and shall return another list
- of `flycheck-error' objects, which is considered the final
- result of this syntax checker.
-
- FUNCTION is free to add, remove or modify errors, whether in
- place or by copying.
-
- This property is optional. The default filter is
- `identity'.
-
-`:next-checkers NEXT-CHECKERS'
- A list denoting syntax checkers to apply after this syntax
- checker, in what we call \"chaining\" of syntax checkers.
-
- Each ITEM is a cons cell `(LEVEL . CHECKER)'. CHECKER is a
- syntax checker to run after this syntax checker. LEVEL is
- an error level. CHECKER will only be used if there are no
- current errors of at least LEVEL. LEVEL may also be t, in
- which case CHECKER is used regardless of the current errors.
-
- ITEM may also be a syntax checker symbol, which is
- equivalent to `(t . ITEM)'.
-
- Flycheck tries all items in order of declaration, and uses
- the first whose LEVEL matches and whose CHECKER is
- registered and can be used for the current buffer.
-
- This feature is typically used to apply more than one syntax
- checker to a buffer. For instance, you might first use a
- compiler to check a buffer for syntax and type errors, and
- then run a linting tool that checks for insecure code, or
- questionable style.
-
- This property is optional. If omitted, it defaults to the
- nil, i.e. no other syntax checkers are applied after this
- syntax checker.
-
-Signal an error, if any property has an invalid value."
- (declare (indent 1)
- (doc-string 2))
- (let ((start (plist-get properties :start))
- (interrupt (plist-get properties :interrupt))
- (print-doc (plist-get properties :print-doc))
- (modes (plist-get properties :modes))
- (predicate (plist-get properties :predicate))
- (verify (plist-get properties :verify))
- (filter (or (plist-get properties :error-filter) #'identity))
- (next-checkers (plist-get properties :next-checkers))
- (file (flycheck-current-load-file)))
-
- (unless (listp modes)
- (setq modes (list modes)))
-
- (unless (functionp start)
- (error ":start %S of syntax checker %s is not a function" symbol start))
- (unless (or (null interrupt) (functionp interrupt))
- (error ":interrupt %S of syntax checker %s is not a function"
- symbol interrupt))
- (unless (or (null print-doc) (functionp print-doc))
- (error ":print-doc %S of syntax checker %s is not a function"
- symbol print-doc))
- (unless (or (null verify) (functionp verify))
- (error ":verify %S of syntax checker %S is not a function"
- symbol verify))
- (unless (or modes predicate)
- (error "Missing :modes or :predicate in syntax checker %s" symbol))
- (dolist (mode modes)
- (unless (symbolp mode)
- (error "Invalid :modes %s in syntax checker %s, %s must be a symbol"
- modes symbol mode)))
- (unless (or (null predicate) (functionp predicate))
- (error ":predicate %S of syntax checker %s is not a function"
- symbol predicate))
- (unless (functionp filter)
- (error ":error-filter %S of syntax checker %s is not a function"
- symbol filter))
- (dolist (checker next-checkers)
- (flycheck-validate-next-checker checker))
-
- (let ((real-predicate (lambda ()
- (if (flycheck-valid-checker-p symbol)
- (or (null predicate) (funcall predicate))
- (lwarn 'flycheck :warning "%S is no valid Flycheck syntax checker.
-Try to reinstall the package defining this syntax checker." symbol)
- nil))))
- (pcase-dolist (`(,prop . ,value)
- `((flycheck-start . ,start)
- (flycheck-interrupt . ,interrupt)
- (flycheck-print-doc . ,print-doc)
- (flycheck-modes . ,modes)
- (flycheck-predicate . ,real-predicate)
- (flycheck-verify . ,verify)
- (flycheck-error-filter . ,filter)
- (flycheck-next-checkers . ,next-checkers)
- (flycheck-documentation . ,docstring)
- (flycheck-file . ,file)))
- (put symbol prop value)))
-
- ;; Track the version, to avoid breakage if the internal format changes
- (put symbol 'flycheck-generic-checker-version
- flycheck-generic-checker-version)))
-
-(defun flycheck-valid-checker-p (checker)
- "Check whether a CHECKER is valid.
-
-A valid checker is a symbol defined as syntax checker with
-`flycheck-define-checker'."
- (and (symbolp checker)
- (= (or (get checker 'flycheck-generic-checker-version) 0)
- flycheck-generic-checker-version)))
-
-(defun flycheck-checker-modes (checker)
- "Get the modes of CHECKER."
- (get checker 'flycheck-modes))
-
-(defun flycheck-checker-predicate (checker)
- "Get the predicate function of CHECKER."
- (get checker 'flycheck-predicate))
-
-(defun flycheck-checker-next-checkers (checker)
- "Get the next checkers for CHECKER."
- (get checker 'flycheck-next-checkers))
-
-(defun flycheck-checker-error-filter (checker)
- "Get the error filter of CHECKER."
- (get checker 'flycheck-error-filter))
-
-(defun flycheck-checker-documentation (checker)
- "Get the documentation of CHECKER."
- (documentation-property checker 'flycheck-documentation))
-
-(defun flycheck-checker-file (checker)
- "Get the file CHECKER was defined in.
-
-Return nil if the file cannot be determined."
- (get checker 'flycheck-file))
-
-(defun flycheck-may-use-checker (checker)
- "Whether a generic CHECKER may be used.
-
-Return non-nil if CHECKER may be used for the current buffer, and
-nil otherwise."
- (let ((modes (flycheck-checker-modes checker))
- (predicate (flycheck-checker-predicate checker)))
- (and (flycheck-valid-checker-p checker)
- (not (flycheck-disabled-checker-p checker))
- (or (not modes) (memq major-mode modes))
- (funcall predicate))))
-
-(defun flycheck-may-use-next-checker (next-checker)
- "Determine whether NEXT-CHECKER may be used."
- (when (symbolp next-checker)
- (push t next-checker))
- (let ((level (car next-checker))
- (next-checker (cdr next-checker)))
- (and (or (eq level t)
- (flycheck-has-max-current-errors-p level))
- (flycheck-registered-checker-p next-checker)
- (flycheck-may-use-checker next-checker))))
-
-\f
-;;; Help for generic syntax checkers
-(define-button-type 'help-flycheck-checker-def
- :supertype 'help-xref
- 'help-function #'flycheck-goto-checker-definition
- 'help-echo "mouse-2, RET: find Flycheck checker definition")
-
-(defconst flycheck-find-checker-regexp
- (rx line-start (zero-or-more (syntax whitespace))
- "(" symbol-start "flycheck-define-checker" symbol-end
- (eval (list 'regexp find-function-space-re))
- symbol-start
- "%s"
- symbol-end
- (or (syntax whitespace) line-end))
- "Regular expression to find a checker definition.")
-
-(add-to-list 'find-function-regexp-alist
- '(flycheck-checker . flycheck-find-checker-regexp))
-
-(defun flycheck-goto-checker-definition (checker file)
- "Go to to the definition of CHECKER in FILE."
- (let ((location (find-function-search-for-symbol
- checker 'flycheck-checker file)))
- (pop-to-buffer (car location))
- (if (cdr location)
- (goto-char (cdr location))
- (message "Unable to find checker location in file"))))
-
-(defun flycheck-checker-at-point ()
- "Return the Flycheck checker found at or before point.
-
-Return 0 if there is no checker."
- (let ((symbol (variable-at-point 'any-symbol)))
- (if (and (symbolp symbol) (flycheck-valid-checker-p symbol))
- symbol
- 0)))
-
-(defun flycheck-describe-checker (checker)
- "Display the documentation of CHECKER.
-
-CHECKER is a checker symbol.
-
-Pop up a help buffer with the documentation of CHECKER."
- (interactive
- (let* ((checker (flycheck-checker-at-point))
- (enable-recursive-minibuffers t)
- (prompt (if (symbolp checker)
- (format "Describe syntax checker (default %s): " checker)
- "Describe syntax checker: "))
- (reply (read-flycheck-checker prompt)))
- (list (or reply checker))))
- (if (or (null checker) (not (flycheck-valid-checker-p checker)))
- (message "You didn't specify a Flycheck syntax checker.")
- (help-setup-xref (list #'flycheck-describe-checker checker)
- (called-interactively-p 'interactive))
- (save-excursion
- (with-help-window (help-buffer)
- (let ((filename (flycheck-checker-file checker))
- (modes (flycheck-checker-modes checker))
- (predicate (flycheck-checker-predicate checker))
- (print-doc (get checker 'flycheck-print-doc)))
- (princ (format "%s is a Flycheck syntax checker" checker))
- (when filename
- (princ (format " in `%s'" (file-name-nondirectory filename)))
- (with-current-buffer standard-output
- (save-excursion
- (re-search-backward "`\\([^`']+\\)'" nil t)
- (help-xref-button 1 'help-flycheck-checker-def checker filename))))
- (princ ".\n\n")
-
- (let ((modes-start (with-current-buffer standard-output (point-max))))
- ;; Track the start of the modes documentation, to properly re-fill
- ;; it later
- (if (not modes)
- ;; Syntax checkers without modes must have a predicate
- (princ " This syntax checker checks syntax if a custom predicate holds")
- (princ " This syntax checker checks syntax in the major mode(s) ")
- (princ (string-join
- (mapcar (apply-partially #'format "`%s'") modes)
- ", "))
- (when predicate
- (princ ", and uses a custom predicate")))
- (princ ".")
- (with-current-buffer standard-output
- (save-excursion
- (fill-region-as-paragraph modes-start (point-max)))))
- (princ "\n")
- ;; Call the custom print-doc function of the checker, if present
- (when print-doc
- (funcall print-doc checker))
- ;; Ultimately, print the docstring
- (princ "\nDocumentation:\n")
- (princ (flycheck-checker-documentation checker)))))))
-
-\f
-;;; Syntax checker verification
-(cl-defstruct (flycheck-verification-result
- (:constructor flycheck-verification-result-new))
- "Structure for storing a single verification result.
-
-Slots:
-
-`label'
- A label for this result, as string
-
-`message'
- A message for this result, as string
-
-`face'
- The face to use for the `message'.
-
- You can either use a face symbol, or a list of face symbols."
- label message face)
-
-(defun flycheck-verify-generic-checker (checker)
- "Verify a generic CHECKER in the current buffer.
-
-Return a list of `flycheck-verification-result' objects."
- (let (results
- (predicate (flycheck-checker-predicate checker))
- (verify (get checker 'flycheck-verify)))
- (when predicate
- (let ((result (funcall predicate)))
- (push (flycheck-verification-result-new
- :label "predicate"
- :message (prin1-to-string (not (null result)))
- :face (if result 'success '(bold warning)))
- results)))
- (append (nreverse results)
- (and verify (funcall verify checker)))))
-
-(define-button-type 'help-flycheck-checker-doc
- :supertype 'help-xref
- 'help-function #'flycheck-describe-checker
- 'help-echo "mouse-2, RET: describe Flycheck checker")
-
-(defun flycheck-verify-setup ()
- "Check whether Flycheck can be used in this buffer.
-
-Display a new buffer listing all syntax checkers that could be
-applicable in the current buffer. For each syntax checkers,
-possible problems are shown."
- (interactive)
- (when (and (buffer-file-name) (buffer-modified-p))
- ;; Save the buffer
- (save-buffer))
-
- (let ((buffer (current-buffer))
- (checkers (flycheck-possibly-suitable-checkers)))
-
- ;; Now print all applicable checkers
- (with-help-window (get-buffer-create " *Flycheck checkers*")
- (with-current-buffer standard-output
- (princ "Syntax checkers for buffer ")
- (insert (propertize (buffer-name buffer) 'face 'bold))
- (princ " in ")
- (let ((mode (buffer-local-value 'major-mode buffer)))
- (insert-button (symbol-name mode)
- 'type 'help-function
- 'help-args (list mode)))
- (princ ":\n\n")
- (unless checkers
- (insert (propertize "There are no syntax checkers for this buffer!\n\n"
- 'face '(bold error))))
- (dolist (checker checkers)
- (princ " ")
- (insert-button (symbol-name checker)
- 'type 'help-flycheck-checker-doc
- 'help-args (list checker))
- (princ "\n")
- (let* ((results (with-current-buffer buffer
- (flycheck-verify-generic-checker checker)))
- (label-length
- (-max (mapcar
- (lambda (res)
- (length (flycheck-verification-result-label res)))
- results)))
- (message-column (+ 8 label-length)))
- (dolist (result results)
- (princ " - ")
- (princ (flycheck-verification-result-label result))
- (princ ": ")
- (princ (make-string (- message-column (current-column)) ?\ ))
- (let ((message (flycheck-verification-result-message result))
- (face (flycheck-verification-result-face result)))
- (insert (propertize message 'face face)))
- (princ "\n")))
- (princ "\n"))
- (princ "Flycheck Mode is ")
- (let ((enabled (buffer-local-value 'flycheck-mode buffer)))
- (insert (propertize (if enabled "enabled" "disabled")
- 'face (if enabled 'success '(warning bold)))))
- (princ ".\n")
-
- (let ((unregistered-checkers (-difference (flycheck-defined-checkers)
- flycheck-checkers)))
- (when unregistered-checkers
- (insert (propertize "\nThe following syntax checkers are not registered:\n\n"
- 'face '(bold warning)))
- (dolist (checker unregistered-checkers)
- (princ " - ")
- (princ checker)
- (princ "\n"))
- (princ "\nTry adding these syntax checkers to `flycheck-checkers'.")))))))
-
-\f
-;;; Predicates for generic syntax checkers
-(defun flycheck-buffer-saved-p (&optional buffer)
- "Determine whether BUFFER is saved to a file.
-
-BUFFER is the buffer to check. If omitted or nil, use the
-current buffer as BUFFER.
-
-Return non-nil if the BUFFER is backed by a file, and not
-modified, or nil otherwise."
- (and (buffer-file-name buffer) (not (buffer-modified-p buffer))))
-
-\f
-;;; Extending generic checkers
-(defun flycheck-add-next-checker (checker next &optional append)
- "Add a NEXT checker after CHECKER.
-
-CHECKER is a syntax checker symbol, to which to add NEXT checker.
-
-NEXT is a cons cell `(LEVEL . NEXT-CHECKER)'. NEXT-CHECKER is a
-symbol denoting the syntax checker to run after CHECKER. LEVEL
-is an error level. NEXT-CHECKER will only be used if there is no
-current error whose level is more severe than LEVEL. LEVEL may
-also be t, in which case NEXT-CHECKER is used regardless of the
-current errors.
-
-NEXT can also be a syntax checker symbol only, which is
-equivalent to `(t . NEXT)'.
-
-NEXT-CHECKER is prepended before other next checkers, unless
-APPEND is non-nil."
- (unless (flycheck-valid-checker-p checker)
- (error "%s is not a valid syntax checker" checker))
- (flycheck-validate-next-checker next 'strict)
- (if append
- (put checker 'flycheck-next-checkers
- (append (get checker 'flycheck-next-checkers) (list next)))
- (push next (get checker 'flycheck-next-checkers))))
-
-(defun flycheck-add-mode (checker mode)
- "Add a new major MODE to CHECKER.
-
-CHECKER and MODE are symbols denoting a syntax checker and a
-major mode respectively.
-
-Add MODE to the `:modes' property of CHECKER, so that CHECKER
-will be used in buffers with MODE."
- (unless (flycheck-valid-checker-p checker)
- (error "%s is not a valid syntax checker" checker))
- (unless (symbolp mode)
- (error "%s is not a symbol" mode))
- (push mode (get checker 'flycheck-modes)))
-
-\f
-;;; Generic syntax checks
-(cl-defstruct (flycheck-syntax-check
- (:constructor flycheck-syntax-check-new))
- "Structure for storing syntax check state.
-
-Slots:
-
-`buffer'
- The buffer being checked
-
-`checker'
- The syntax checker being used
-
-`context'
- The context object."
- buffer checker context)
-
-(defun flycheck-syntax-check-start (syntax-check callback)
- "Start a SYNTAX-CHECK with CALLBACK."
- (let ((checker (flycheck-syntax-check-checker syntax-check)))
- (setf (flycheck-syntax-check-context syntax-check)
- (funcall (get checker 'flycheck-start) checker callback))))
-
-(defun flycheck-syntax-check-interrupt (syntax-check)
- "Interrupt a SYNTAX-CHECK."
- (let* ((checker (flycheck-syntax-check-checker syntax-check))
- (interrupt-fn (get checker 'flycheck-interrupt))
- (context (flycheck-syntax-check-context syntax-check)))
- (when interrupt-fn
- (funcall interrupt-fn checker context))))
-
-\f
-;;; Syntax checking mode
-
-(defvar flycheck-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map flycheck-keymap-prefix flycheck-command-map)
- ;; We place the menu under a custom menu key. Since this menu key is not
- ;; present in the menu of the global map, no top-level menu entry is added
- ;; to the global menu bar. However, it still appears on the mode line
- ;; lighter.
- (define-key map [menu-bar flycheck] flycheck-mode-menu-map)
- map)
- "Keymap of `flycheck-mode'.")
-
-(defvar-local flycheck-old-next-error-function nil
- "Remember the old `next-error-function'.")
-
-(defconst flycheck-hooks-alist
- '(
- ;; Handle events that may start automatic syntax checks
- (after-save-hook . flycheck-handle-save)
- (after-change-functions . flycheck-handle-change)
- ;; Handle events that may triggered pending deferred checks
- (window-configuration-change-hook . flycheck-perform-deferred-syntax-check)
- (post-command-hook . flycheck-perform-deferred-syntax-check)
- ;; Teardown Flycheck whenever the buffer state is about to get lost, to
- ;; clean up temporary files and directories.
- (kill-buffer-hook . flycheck-teardown)
- (change-major-mode-hook . flycheck-teardown)
- (before-revert-hook . flycheck-teardown)
- ;; Update the error list if necessary
- (post-command-hook . flycheck-error-list-update-source)
- (post-command-hook . flycheck-error-list-highlight-errors)
- ;; Show or hide error popups after commands
- (post-command-hook . flycheck-display-error-at-point-soon)
- (post-command-hook . flycheck-hide-error-buffer)
- ;; Immediately show error popups when navigating to an error
- (next-error-hook . flycheck-display-error-at-point))
- "Hooks which Flycheck needs to hook in.
-
-The `car' of each pair is a hook variable, the `cdr' a function
-to be added or removed from the hook variable if Flycheck mode is
-enabled and disabled respectively.")
-
-;;;###autoload
-(define-minor-mode flycheck-mode
- "Minor mode for on-the-fly syntax checking.
-
-When called interactively, toggle `flycheck-mode'. With prefix
-ARG, enable `flycheck-mode' if ARG is positive, otherwise disable
-it.
-
-When called from Lisp, enable `flycheck-mode' if ARG is omitted,
-nil or positive. If ARG is `toggle', toggle `flycheck-mode'.
-Otherwise behave as if called interactively.
-
-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.
-
-\\{flycheck-mode-map}"
- :init-value nil
- :keymap flycheck-mode-map
- :lighter flycheck-mode-line
- :after-hook (flycheck-buffer-automatically 'mode-enabled 'force-deferred)
- (cond
- (flycheck-mode
- (flycheck-clear)
-
- (pcase-dolist (`(,hook . ,fn) flycheck-hooks-alist)
- (add-hook hook fn nil 'local))
-
- (setq flycheck-old-next-error-function (if flycheck-standard-error-navigation
- next-error-function
- :unset))
- (when flycheck-standard-error-navigation
- (setq next-error-function #'flycheck-next-error-function)))
- (t
- (unless (eq flycheck-old-next-error-function :unset)
- (setq next-error-function flycheck-old-next-error-function))
-
- (pcase-dolist (`(,hook . ,fn) flycheck-hooks-alist)
- (remove-hook hook fn 'local))
-
- (flycheck-teardown))))
-
-\f
-;;; Syntax checker selection for the current buffer
-(defvar-local flycheck-last-checker nil
- "The last checker used for the current buffer.")
-
-(defun flycheck-get-checker-for-buffer ()
- "Find the checker for the current buffer.
-
-Use the selected checker for the current buffer, if any,
-otherwise search for the best checker from `flycheck-checkers'.
-
-Return checker if there is a checker for the current buffer, or
-nil otherwise."
- (if flycheck-checker
- (if (flycheck-may-use-checker flycheck-checker)
- flycheck-checker
- (user-error "Selected syntax checker %s cannot be used"
- flycheck-checker))
- (let ((checkers flycheck-checkers))
- (while (and checkers (not (flycheck-may-use-checker (car checkers))))
- (setq checkers (cdr checkers)))
- (car checkers))))
-
-(defun flycheck-get-next-checker-for-buffer (checker)
- "Get the checker to run after CHECKER for the current buffer."
- (let ((next-checkers (flycheck-checker-next-checkers checker)))
- (while (and next-checkers
- (not (flycheck-may-use-next-checker (car next-checkers))))
- (setq next-checkers (cdr next-checkers)))
- (when next-checkers
- (if (symbolp (car next-checkers))
- (car next-checkers)
- (cdar next-checkers)))))
-
-(defun flycheck-select-checker (checker)
- "Select CHECKER for the current buffer.
-
-CHECKER is a syntax checker symbol (see `flycheck-checkers') or
-nil. In the former case, use CHECKER for the current buffer,
-otherwise deselect the current syntax checker (if any) and use
-automatic checker selection via `flycheck-checkers'.
-
-If called interactively prompt for CHECKER. With prefix arg
-deselect the current syntax checker and enable automatic
-selection again.
-
-Set `flycheck-checker' to CHECKER and automatically start a new
-syntax check if the syntax checker changed.
-
-CHECKER will be used, even if it is not contained in
-`flycheck-checkers', or if it is disabled via
-`flycheck-disabled-checkers'."
- (interactive
- (if current-prefix-arg
- (list nil)
- (list (read-flycheck-checker "Select checker: "
- (flycheck-get-checker-for-buffer)))))
- (when (not (eq checker flycheck-checker))
- (unless (or (not checker) (flycheck-may-use-checker checker))
- (user-error "Can't use syntax checker %S in this buffer" checker))
- (setq flycheck-checker checker)
- (when flycheck-mode
- (flycheck-buffer))))
-
-(defun flycheck-disable-checker (checker &optional enable)
- "Interactively disable CHECKER for the current buffer.
-
-Interactively, prompt for a syntax checker to disable, and add
-the syntax checker to the buffer-local value of
-`flycheck-disabled-checkers'. With prefix arg, prompt for a
-disabled syntax checker and re-enable it by removing it from the
-buffer-local value of `flycheck-disabled-checkers'."
- (declare (interactive-only "Directly set `flycheck-disabled-checkers' instead"))
- (interactive
- (let* ((enable current-prefix-arg)
- (candidates (if enable flycheck-disabled-checkers flycheck-checkers))
- (prompt (if enable "Enable syntax checker: "
- "Disable syntax checker: ")))
- (when (and enable (not candidates))
- (user-error "No syntax checkers disabled in this buffer"))
- (list (read-flycheck-checker prompt nil nil candidates) enable)))
- (unless checker
- (user-error "No syntax checker given"))
- (if enable
- ;; We must use `remq' instead of `delq', because we must _not_ modify the
- ;; list. Otherwise we could potentially modify the global default value,
- ;; in case the list is the global default.
- (when (memq checker flycheck-disabled-checkers)
- (setq flycheck-disabled-checkers
- (remq checker flycheck-disabled-checkers))
- (flycheck-buffer))
- (unless (memq checker flycheck-disabled-checkers)
- (push checker flycheck-disabled-checkers)
- (flycheck-buffer))))
-
-\f
-;;; Syntax checks for the current buffer
-(defvar-local flycheck-current-syntax-check nil
- "The current syntax check in the this buffer.")
-(put 'flycheck-current-syntax-check 'permanent-local t)
-
-(defun flycheck-start-current-syntax-check (checker)
- "Start a syntax check in the current buffer with CHECKER.
-
-Set `flycheck-current-syntax-check' accordingly."
- ;; Allocate the current syntax check *before* starting it. This allows for
- ;; synchronous checks, which call the status callback immediately in there
- ;; start function.
- (let* ((check (flycheck-syntax-check-new :buffer (current-buffer)
- :checker checker
- :context nil))
- (callback (flycheck-buffer-status-callback check)))
- (setq flycheck-current-syntax-check check)
- (flycheck-report-status 'running)
- (flycheck-syntax-check-start check callback)))
-
-(defun flycheck-running-p ()
- "Determine whether a syntax check is running in the current buffer."
- (not (null flycheck-current-syntax-check)))
-
-(defun flycheck-stop ()
- "Stop any ongoing syntax check in the current buffer."
- (when (flycheck-running-p)
- (flycheck-syntax-check-interrupt flycheck-current-syntax-check)
- ;; Remove the current syntax check, to reset Flycheck into a non-running
- ;; state, and to make `flycheck-report-buffer-checker-status' ignore any
- ;; status reports from the current syntax check.
- (setq flycheck-current-syntax-check nil)
- (flycheck-report-status 'interrupted)))
-
-(defun flycheck-buffer-status-callback (syntax-check)
- "Create a status callback for SYNTAX-CHECK in the current buffer."
- (lambda (&rest args)
- (apply #'flycheck-report-buffer-checker-status
- syntax-check args)))
-
-(defun flycheck-buffer ()
- "Start checking syntax in the current buffer.
-
-Get a syntax checker for the current buffer with
-`flycheck-get-checker-for-buffer', and start it."
- (interactive)
- (flycheck-clean-deferred-check)
- (if flycheck-mode
- (unless (flycheck-running-p)
- ;; Clear error list and mark all overlays for deletion. We do not
- ;; delete all overlays immediately to avoid excessive re-displays and
- ;; flickering, if the same errors gets highlighted again after the check
- ;; completed.
- (run-hooks 'flycheck-before-syntax-check-hook)
- (flycheck-clear-errors)
- (flycheck-mark-all-overlays-for-deletion)
- (condition-case err
- (let* ((checker (flycheck-get-checker-for-buffer)))
- (if checker
- (flycheck-start-current-syntax-check checker)
- (flycheck-clear)
- (flycheck-report-status 'no-checker)))
- (error
- (flycheck-report-failed-syntax-check)
- (signal (car err) (cdr err)))))
- (user-error "Flycheck mode disabled")))
-
-(defun flycheck-report-buffer-checker-status
- (syntax-check status &optional data)
- "In BUFFER, report a SYNTAX-CHECK STATUS with DATA.
-
-SYNTAX-CHECK is the `flycheck-syntax-check' which reported
-STATUS. STATUS denotes the status of CHECKER, with an optional
-DATA. STATUS may be one of the following symbols:
-
-`errored'
- The syntax checker has errored. DATA is an optional error
- message.
-
- This report finishes the current syntax check.
-
-`interrupted'
- The syntax checker was interrupted. DATA is ignored.
-
- This report finishes the current syntax check.
-
-`finished'
- The syntax checker has finished with a proper error report
- for the current buffer. DATA is the (potentially empty)
- list of `flycheck-error' objects reported by the syntax
- check.
-
- This report finishes the current syntax check.
-
-`suspicious'
- The syntax checker encountered a suspicious state, which the
- user needs to be informed about. DATA is an optional
- message.
-
-A syntax checker _must_ report a status at least once with any
-symbol that finishes the current syntax checker. Otherwise
-Flycheck gets stuck with the current syntax check.
-
-If CHECKER is not the currently used syntax checker in
-`flycheck-current-syntax-check', the status report is largely
-ignored. Notably, any errors reported by the checker are
-discarded."
- (let ((buffer (flycheck-syntax-check-buffer syntax-check)))
- ;; Ignore the status report if the buffer is gone, or if this syntax check
- ;; isn't the current one in buffer (which can happen if this is an old
- ;; report of an interrupted syntax check, and a new syntax check was started
- ;; since this check was interrupted)
- (when (and (buffer-live-p buffer)
- (eq syntax-check
- (buffer-local-value 'flycheck-current-syntax-check buffer)))
- (with-current-buffer buffer
- (let ((checker (flycheck-syntax-check-checker syntax-check)))
- (pcase status
- ((or `errored `interrupted)
- (flycheck-report-failed-syntax-check status)
- (when (eq status 'errored)
- ;; In case of error, show the error message
- (message "Error from syntax checker %s: %s"
- checker (or data "UNKNOWN!"))))
- (`suspicious
- (when flycheck-mode
- (message "Suspicious state from syntax checker %s: %s"
- checker (or data "UNKNOWN!")))
- (flycheck-report-status 'suspicious))
- (`finished
- (when flycheck-mode
- ;; Only report errors from the checker if Flycheck Mode is
- ;; still enabled.
- (flycheck-finish-current-syntax-check data)))
- (_
- (error "Unknown status %s from syntax checker %s"
- status checker))))))))
-
-(defun flycheck-finish-current-syntax-check (errors)
- "Finish the current syntax-check in the current buffer with ERRORS.
-
-ERRORS is a list of `flycheck-error' objects reported by the
-current syntax check in `flycheck-current-syntax-check'.
-
-Report all ERRORS and potentially start any next syntax checkers.
-
-If the current syntax checker reported excessive errors, it is disabled
-via `flycheck-disable-excessive-checker' for subsequent syntax
-checks."
- (let* ((syntax-check flycheck-current-syntax-check)
- (checker (flycheck-syntax-check-checker syntax-check))
- (errors (flycheck-relevant-errors
- (flycheck-filter-errors
- (flycheck-assert-error-list-p errors) checker))))
- (unless (flycheck-disable-excessive-checker checker errors)
- (flycheck-report-current-errors errors))
- (let ((next-checker (flycheck-get-next-checker-for-buffer checker)))
- (if next-checker
- (flycheck-start-current-syntax-check next-checker)
- (setq flycheck-current-syntax-check nil)
- (flycheck-report-status 'finished)
- ;; Delete overlays only after the very last checker has run, to avoid
- ;; flickering on intermediate re-displays
- (flycheck-delete-marked-overlays)
- (flycheck-error-list-refresh)
- (run-hooks 'flycheck-after-syntax-check-hook)
- (when (eq (current-buffer) (window-buffer))
- (flycheck-display-error-at-point))
- ;; Immediately try to run any pending deferred syntax check, which
- ;; were triggered by intermediate automatic check event, to make sure
- ;; that we quickly refine outdated error information
- (flycheck-perform-deferred-syntax-check)))))
-
-(defun flycheck-disable-excessive-checker (checker errors)
- "Disable CHECKER if it reported excessive ERRORS.
-
-If ERRORS has more items than `flycheck-checker-error-threshold',
-add CHECKER to `flycheck-disabled-checkers', and show a warning.
-
-Return t when CHECKER was disabled, or nil otherwise."
- (when (and flycheck-checker-error-threshold
- (> (length errors) flycheck-checker-error-threshold))
- ;; Disable CHECKER for this buffer (`flycheck-disabled-checkers' is a local
- ;; variable).
- (lwarn '(flycheck syntax-checker) :warning
- "Syntax checker %s reported too many errors (%s) and is disabled."
- checker (length errors))
- (push checker flycheck-disabled-checkers)
- t))
-
-(defun flycheck-clear (&optional shall-interrupt)
- "Clear all errors in the current buffer.
-
-With prefix arg or SHALL-INTERRUPT non-nil, also interrupt the
-current syntax check."
- (interactive "P")
- (when shall-interrupt
- (flycheck-stop))
- (flycheck-delete-all-overlays)
- (flycheck-clear-errors)
- (flycheck-error-list-refresh)
- (flycheck-hide-error-buffer))
-
-(defun flycheck-teardown ()
- "Teardown Flycheck in the current buffer..
-
-Completely clear the whole Flycheck state. Remove overlays, kill
-running checks, and empty all variables used by Flycheck."
- (flycheck-safe-delete-temporaries)
- (flycheck-stop)
- (flycheck-clean-deferred-check)
- (flycheck-clear)
- (flycheck-cancel-error-display-error-at-point-timer))
-
-\f
-;;; Automatic syntax checking in a buffer
-(defun flycheck-may-check-automatically (&optional condition)
- "Determine whether the buffer may be checked under CONDITION.
-
-Read-only buffers may never be checked automatically.
-
-If CONDITION is non-nil, determine whether syntax may checked
-automatically according to
-`flycheck-check-syntax-automatically'."
- (and (not (or buffer-read-only (flycheck-ephemeral-buffer-p)))
- (file-exists-p default-directory)
- (or (not condition)
- (memq condition flycheck-check-syntax-automatically))))
-
-(defun flycheck-buffer-automatically (&optional condition force-deferred)
- "Automatically check syntax at CONDITION.
-
-Syntax is not checked if `flycheck-may-check-automatically'
-returns nil for CONDITION.
-
-The syntax check is deferred if FORCE-DEFERRED is non-nil, or if
-`flycheck-must-defer-check' returns t."
- (when (and flycheck-mode (flycheck-may-check-automatically condition))
- (if (or force-deferred (flycheck-must-defer-check))
- (flycheck-buffer-deferred)
- (with-demoted-errors "Error while checking syntax automatically: %S"
- (flycheck-buffer)))))
-
-(defvar-local flycheck-idle-change-timer nil
- "Timer to mark the idle time since the last change.")
-
-(defun flycheck-clear-idle-change-timer ()
- "Clear the idle change timer."
- (when flycheck-idle-change-timer
- (cancel-timer flycheck-idle-change-timer)
- (setq flycheck-idle-change-timer nil)))
-
-(defun flycheck-handle-change (beg end _len)
- "Handle a buffer change between BEG and END.
-
-BEG and END mark the beginning and end of the change text. _LEN
-is ignored.
-
-Start a syntax check if a new line has been inserted into the
-buffer."
- ;; Save and restore the match data, as recommended in (elisp)Change Hooks
- (save-match-data
- (when flycheck-mode
- ;; The buffer was changed, thus clear the idle timer
- (flycheck-clear-idle-change-timer)
- (if (string-match-p (rx "\n") (buffer-substring beg end))
- (flycheck-buffer-automatically 'new-line 'force-deferred)
- (setq flycheck-idle-change-timer
- (run-at-time flycheck-idle-change-delay nil
- #'flycheck-handle-idle-change))))))
-
-(defun flycheck-handle-idle-change ()
- "Handle an expired idle time since the last change."
- (flycheck-clear-idle-change-timer)
- (flycheck-buffer-automatically 'idle-change))
-
-(defun flycheck-handle-save ()
- "Handle a save of the buffer."
- (flycheck-buffer-automatically 'save))
-
-\f
-;;; Deferred syntax checking
-(defvar-local flycheck-deferred-syntax-check nil
- "If non-nil, a deferred syntax check is pending.")
-
-(defun flycheck-must-defer-check ()
- "Determine whether the syntax check has to be deferred.
-
-A check has to be deferred if the buffer is not visible, or if the buffer is
-currently being reverted.
-
-Return t if the check is to be deferred, or nil otherwise."
- (or (not (get-buffer-window))
- ;; We defer the syntax check if Flycheck is already running, to
- ;; immediately start a new syntax check after the current one finished,
- ;; because the result of the current check will most likely be outdated by
- ;; the time it is finished.
- (flycheck-running-p)
- ;; We must defer checks while a buffer is being reverted, to avoid race
- ;; conditions while the buffer contents are being restored.
- revert-buffer-in-progress-p))
-
-(defun flycheck-deferred-check-p ()
- "Determine whether the current buffer has a deferred check.
-
-Return t if so, or nil otherwise."
- flycheck-deferred-syntax-check)
-
-(defun flycheck-buffer-deferred ()
- "Defer syntax check for the current buffer."
- (setq flycheck-deferred-syntax-check t))
-
-(defun flycheck-clean-deferred-check ()
- "Clean an deferred syntax checking state."
- (setq flycheck-deferred-syntax-check nil))
-
-(defun flycheck-perform-deferred-syntax-check ()
- "Perform any deferred syntax checks."
- (when (flycheck-deferred-check-p)
- (flycheck-clean-deferred-check)
- (flycheck-buffer-automatically)))
-
-\f
-;;; Syntax checking in all buffers
-(defun flycheck-may-enable-mode ()
- "Determine whether Flycheck mode may be enabled.
-
-Flycheck mode is not enabled for
-
-- the minibuffer,
-- major modes whose `mode-class' property is `special',
-- ephemeral buffers (see `flycheck-ephemeral-buffer-p'),
-- encrypted buffers (see `flycheck-encrypted-buffer-p'),
-- remote files (see `file-remote-p'),
-- and major modes excluded by `flycheck-global-modes'.
-
-Return non-nil if Flycheck mode may be enabled, and nil
-otherwise."
- (and (pcase flycheck-global-modes
- ;; Whether `major-mode' is disallowed by `flycheck-global-modes'
- (`t t)
- (`(not . ,modes) (not (memq major-mode modes)))
- (modes (memq major-mode modes)))
- (not (or (minibufferp)
- (eq (get major-mode 'mode-class) 'special)
- (flycheck-ephemeral-buffer-p)
- (flycheck-encrypted-buffer-p)
- (and (buffer-file-name)
- (file-remote-p (buffer-file-name) 'method))))))
-
-(defun flycheck-mode-on-safe ()
- "Enable `flycheck-mode' if it is safe to do so.
-
-`flycheck-mode' is only enabled if `flycheck-may-enable-mode'
-returns t."
- (when (flycheck-may-enable-mode)
- (flycheck-mode)))
-
-;;;###autoload
-(define-globalized-minor-mode global-flycheck-mode flycheck-mode
- flycheck-mode-on-safe
- :init-value nil
- ;; Do not expose Global Flycheck Mode on customize interface, because the
- ;; interaction between package.el and customize is currently broken. See
- ;; https://github.com/flycheck/flycheck/issues/595
-
- ;; :require 'flycheck :group
- ;; 'flycheck
- )
-
-(defun flycheck-global-teardown ()
- "Teardown Flycheck in all buffers.
-
-Completely clear the whole Flycheck state in all buffers, stop
-all running checks, remove all temporary files, and empty all
-variables of Flycheck."
- (dolist (buffer (buffer-list))
- (with-current-buffer buffer
- (when flycheck-mode
- (flycheck-teardown)))))
-
-;; Clean up the entire state of Flycheck when Emacs is killed, to get rid of any
-;; pending temporary files.
-(add-hook 'kill-emacs-hook #'flycheck-global-teardown)
-
-\f
-;;; Errors from syntax checks
-(cl-defstruct (flycheck-error
- (:constructor flycheck-error-new)
- (:constructor flycheck-error-new-at (line column
- &optional level message
- &key checker id
- (filename (buffer-file-name))
- (buffer (current-buffer)))))
- "Structure representing an error reported by a syntax checker.
-Slots:
-
-`buffer'
- The buffer the reported was reported for, as buffer object.
-
-`checker'
- The syntax checker which reported this error, as symbol.
-
-`filename'
- The file name the error refers to, as string.
-
-`line'
- The line number the error refers to, as number.
-
-`column' (optional)
- The column number the error refers to, as number.
-
- For compatibility with external tools and unlike Emacs
- itself (e.g. in Compile Mode) Flycheck uses _1-based_
- columns: The first character on a line is column 1.
-
- Occasionally some tools try to proactively adapt to Emacs
- and emit 0-based columns automatically. In these cases, the
- columns must be adjusted for Flycheck, see
- `flycheck-increment-error-columns'.
-
-`level'
- The error level, as either `warning' or `error'.
-
-`id' (optional)
- An ID identifying the kind of error."
- buffer checker filename line column message level id)
-
-(defmacro flycheck-error-with-buffer (err &rest forms)
- "Switch to the buffer of ERR and evaluate FORMS.
-
-If the buffer of ERR is not live, FORMS are not evaluated."
- (declare (indent 1) (debug t))
- `(when (buffer-live-p (flycheck-error-buffer ,err))
- (with-current-buffer (flycheck-error-buffer ,err)
- ,@forms)))
-
-(defun flycheck-error-line-region (err)
- "Get the line region of ERR.
-
-ERR is a Flycheck error whose region to get.
-
-Return a cons cell `(BEG . END)' where BEG is the first
-non-whitespace character on the line ERR refers to, and END the
-end of the line."
- (flycheck-error-with-buffer err
- (save-restriction
- (save-excursion
- (widen)
- (goto-char (point-min))
- (forward-line (- (flycheck-error-line err) 1))
- ;; We are at the beginning of the line now, so move to the beginning of
- ;; its indentation, similar to `back-to-indentation'
- (let ((end (line-end-position)))
- (skip-syntax-forward " " end)
- (backward-prefix-chars)
- ;; If the current line is empty, include the previous line break
- ;; character(s) to have any region at all. When called with 0,
- ;; `line-end-position' gives us the end of the previous line
- (cons (if (eolp) (line-end-position 0) (point)) end))))))
-
-(defun flycheck-error-column-region (err)
- "Get the error column region of ERR.
-
-ERR is a Flycheck error whose region to get.
-
-Return a cons cell `(BEG . END)' where BEG is the character
-before the error column, and END the actual error column, or nil
-if ERR has no column."
- (flycheck-error-with-buffer err
- (save-restriction
- (save-excursion
- (-when-let (column (flycheck-error-column err))
- (widen)
- (goto-char (point-min))
- (forward-line (- (flycheck-error-line err) 1))
- (cond
- ((eobp) ; Line beyond EOF
- ;; If we are at the end of the file (i.e. the line was beyond the
- ;; end of the file), use the very last column in the file.
- (cons (- (point-max) 1) (point-max)))
- ((eolp) ; Empty line
- ;; If the target line is empty, there's no column to highlight on
- ;; this line, so return the last column of the previous line.
- (cons (line-end-position 0) (point)))
- (t
- ;; The end is either the column offset of the line, or the end of
- ;; the line, if the column offset points beyond the end of the
- ;; line.
- (let ((end (min (+ (point) column)
- (+ (line-end-position) 1))))
- (cons (- end 1) end)))))))))
-
-(defun flycheck-error-thing-region (thing err)
- "Get the region of THING at the column of ERR.
-
-ERR is a Flycheck error whose region to get. THING is a
-understood by `thing-at-point'.
-
-Return a cons cell `(BEG . END)' where BEG is the beginning of
-the THING at the error column, and END the end of the symbol. If
-ERR has no error column, or if there is no THING at this column,
-return nil."
- (-when-let (column (car (flycheck-error-column-region err)))
- (flycheck-error-with-buffer err
- (save-excursion
- (save-restriction
- (widen)
- (goto-char column)
- (bounds-of-thing-at-point thing))))))
-
-(defun flycheck-error-region-for-mode (err mode)
- "Get the region of ERR for the highlighting MODE.
-
-ERR is a Flycheck error. MODE may be one of the following symbols:
-
-`columns'
- Get the column region of ERR, or the line region if ERR
- has no column.
-
-`symbols'
- Get the symbol region of ERR, or the result of `columns', if
- there is no sexp at the error column.
-
-`sexps'
- Get the sexp region of ERR, or the result of `columns', if
- there is no sexp at the error column.
-
-`lines'
- Return the line region.
-
-Otherwise signal an error."
- (pcase mode
- (`columns (or (flycheck-error-column-region err)
- (flycheck-error-line-region err)))
- (`symbols (or (flycheck-error-thing-region 'symbol err)
- (flycheck-error-region-for-mode err 'columns)))
- (`sexps (or (flycheck-error-thing-region 'sexp err)
- (flycheck-error-region-for-mode err 'columns)))
- (`lines (flycheck-error-line-region err))
- (_ (error "Invalid mode %S" mode))))
-
-(defun flycheck-error-pos (err)
- "Get the buffer position of ERR.
-
-ERR is a Flycheck error whose position to get.
-
-The error position is the error column, or the first
-non-whitespace character of the error line, if ERR has no error column."
- (car (or (flycheck-error-column-region err)
- (flycheck-error-line-region err))))
-
-(defun flycheck-error-format-message-and-id (err)
- "Format the message and id of ERR as human-readable string."
- (let ((id (flycheck-error-id err))
- (message (flycheck-error-message err)))
- (if id (format "%s [%s]" message id) message)))
-
-(defun flycheck-error-format (err)
- "Format ERR as human-readable string.
-
-Return a string that represents the given ERR. This string does
-_not_ include the file name."
- (let* ((line (flycheck-error-line err))
- (column (flycheck-error-column err))
- (level (symbol-name (flycheck-error-level err)))
- (checker (symbol-name (flycheck-error-checker err)))
- (format `(,(number-to-string line) ":"
- ,@(when column (list (number-to-string column) ":"))
- ,level ": "
- ,(flycheck-error-format-message-and-id err)
- " (" ,checker ")")))
- (apply #'concat format)))
-
-(defun flycheck-error-< (err1 err2)
- "Determine whether ERR1 goes before ERR2 by location.
-
-Compare by line numbers and then by column numbers."
- (let ((line1 (flycheck-error-line err1))
- (line2 (flycheck-error-line err2)))
- (if (= line1 line2)
- (let ((col1 (flycheck-error-column err1))
- (col2 (flycheck-error-column err2)))
- (and col2
- ;; Sort errors for the whole line first
- (or (not col1) (< col1 col2))))
- (< line1 line2))))
-
-(defun flycheck-error-level-< (err1 err2)
- "Determine whether ERR1 goes before ERR2 by error level.
-
-Like `flycheck-error-<', but compares by error level severity
-first. Levels of the same severity are compared by name."
- (let* ((level1 (flycheck-error-level err1))
- (level2 (flycheck-error-level err2))
- (severity1 (flycheck-error-level-severity level1))
- (severity2 (flycheck-error-level-severity level2)))
- (cond
- ((= severity1 severity2)
- (if (string= level1 level2)
- (flycheck-error-< err1 err2)
- (string< level1 level2)))
- (t (< severity1 severity2)))))
-
-(defun flycheck-assert-error-list-p (errors)
- "Assert that all items in ERRORS are of `flycheck-error' type.
-
-Signal an error if any item in ERRORS is not a `flycheck-error'
-object, as by `flycheck-error-p'. Otherwise return ERRORS
-again."
- (unless (listp errors)
- (signal 'wrong-type-argument (list 'listp errors)))
- (dolist (err errors)
- (unless (flycheck-error-p err)
- (signal 'wrong-type-argument (list 'flycheck-error-p err))))
- errors)
-
-\f
-;;; Errors in the current buffer
-(defvar-local flycheck-current-errors nil
- "A list of all errors and warnings in the current buffer.")
-
-(defun flycheck-report-current-errors (errors)
- "Report ERRORS in the current buffer.
-
-Add ERRORS to `flycheck-current-errors' and process each error
-with `flycheck-process-error-functions'."
- (setq flycheck-current-errors (sort (append errors flycheck-current-errors)
- #'flycheck-error-<))
- (mapc (lambda (err)
- (run-hook-with-args-until-success 'flycheck-process-error-functions
- err))
- errors))
-
-(defun flycheck-clear-errors ()
- "Remove all error information from the current buffer."
- (setq flycheck-current-errors nil)
- (flycheck-report-status 'not-checked))
-
-(defun flycheck-relevant-error-p (err)
- "Determine whether ERR is relevant for the current buffer.
-
-Return t if ERR may be shown for the current buffer, or nil
-otherwise."
- (flycheck-error-with-buffer err
- (let ((file-name (flycheck-error-filename err))
- (message (flycheck-error-message err)))
- (and
- (or (not file-name) (flycheck-same-files-p file-name (buffer-file-name)))
- message
- (not (string-empty-p message))
- (flycheck-error-line err)))))
-
-(defun flycheck-relevant-errors (errors)
- "Filter the relevant errors from ERRORS.
-
-Return a list of all errors that are relevant for their
-corresponding buffer."
- (-filter #'flycheck-relevant-error-p errors))
-
-\f
-;;; Status reporting for the current buffer
-(defvar-local flycheck-last-status-change 'not-checked
- "The last status change in the current buffer.")
-
-(defun flycheck-report-failed-syntax-check (&optional status)
- "Report a failed Flycheck syntax check with STATUS.
-
-STATUS is a status symbol for `flycheck-report-status',
-defaulting to `errored'.
-
-Clear Flycheck state, run `flycheck-syntax-check-failed-hook' and
-report an error STATUS."
- (flycheck-clear)
- (setq flycheck-current-syntax-check nil)
- (run-hooks 'flycheck-syntax-check-failed-hook)
- (flycheck-report-status (or status 'errored)))
-
-(defun flycheck-report-status (status)
- "Report Flycheck STATUS.
-
-STATUS is one of the following symbols:
-
-`not-checked'
- The current buffer was not checked.
-
-`no-checker'
- Automatic syntax checker selection did not find a suitable
- syntax checker.
-
-`running'
- A syntax check is now running in the current buffer.
-
-`errored'
- The current syntax check has errored.
-
-`finished'
- The current syntax check was finished normally.
-
-`interrupted'
- The current syntax check was interrupted.
-
-`suspicious'
- The last syntax check had a suspicious result.
-
-Set `flycheck-last-status-change' and call
-`flycheck-status-changed-functions' with STATUS. Afterwards
-refresh the mode line."
- (setq flycheck-last-status-change status)
- (run-hook-with-args 'flycheck-status-changed-functions status)
- (force-mode-line-update))
-
-(defun flycheck-mode-line-status-text (&optional status)
- "Get a text describing STATUS for use in the mode line.
-
-STATUS defaults to `flycheck-last-status-change' if omitted or
-nil."
- (let ((text (pcase (or status flycheck-last-status-change)
- (`not-checked "")
- (`no-checker "-")
- (`running "*")
- (`errored "!")
- (`finished
- (if flycheck-current-errors
- (let-alist (flycheck-count-errors flycheck-current-errors)
- (format ":%s/%s" (or .error 0) (or .warning 0)))
- ""))
- (`interrupted "-")
- (`suspicious "?"))))
- (concat " FlyC" text)))
-
-\f
-;;; Error levels
-;;;###autoload
-(defun flycheck-define-error-level (level &rest properties)
- "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.
-
- The severity is used by `flycheck-error-level-<' to
- determine the ordering of errors according to their levels.
-
-`: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. Other useful
- properties for error level categories are `priority' to
- influence the stacking of multiple error level overlays, and
- `help-echo' to define a default error messages for errors
- without messages.
-
-`:fringe-bitmap BITMAP'
- A fringe bitmap symbol denoting the bitmap to use for fringe
- indicators for this level. 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.
-
-`: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'."
- (declare (indent 1))
- (put level 'flycheck-error-level t)
- (put level 'flycheck-error-severity
- (or (plist-get properties :severity) 0))
- (put level 'flycheck-overlay-category
- (plist-get properties :overlay-category))
- (put level 'flycheck-fringe-bitmap
- (plist-get properties :fringe-bitmap))
- (put level 'flycheck-fringe-face
- (plist-get properties :fringe-face))
- (put level 'flycheck-error-list-face
- (plist-get properties :error-list-face)))
-
-(defun flycheck-error-level-p (level)
- "Determine whether LEVEL is a Flycheck error level."
- (get level 'flycheck-error-level))
-
-(defun flycheck-error-level-severity (level)
- "Get the numeric severity of LEVEL."
- (or (get level 'flycheck-error-severity) 0))
-
-(defun flycheck-error-level-overlay-category (level)
- "Get the overlay category for LEVEL."
- (get level 'flycheck-overlay-category))
-
-(defun flycheck-error-level-fringe-bitmap (level)
- "Get the fringe bitmap for LEVEL."
- (get level 'flycheck-fringe-bitmap))
-
-(defun flycheck-error-level-fringe-face (level)
- "Get the fringe face for LEVEL."
- (get level 'flycheck-fringe-face))
-
-(defun flycheck-error-level-error-list-face (level)
- "Get the error list face for LEVEL."
- (get level 'flycheck-error-list-face))
-
-(defun flycheck-error-level-make-fringe-icon (level side)
- "Create the fringe icon for LEVEL at SIDE.
-
-Return a propertized string that shows a fringe bitmap according
-to LEVEL and the given fringe SIDE.
-
-LEVEL is a Flycheck error level defined with
-`flycheck-define-error-level', and SIDE is either `left-fringe'
-or `right-fringe'.
-
-Return a propertized string representing the fringe icon,
-intended for use as `before-string' of an overlay to actually
-show the icon."
- (unless (memq side '(left-fringe right-fringe))
- (error "Invalid fringe side: %S" side))
- (propertize "!" 'display
- (list side
- (flycheck-error-level-fringe-bitmap level)
- (flycheck-error-level-fringe-face level))))
-
-\f
-;;; Built-in error levels
-(put 'flycheck-error-overlay 'face 'flycheck-error)
-(put 'flycheck-error-overlay 'priority 110)
-(put 'flycheck-error-overlay 'help-echo "Unknown error.")
-
-(flycheck-define-error-level 'error
- :severity 100
- :overlay-category 'flycheck-error-overlay
- :fringe-bitmap 'exclamation-mark
- :fringe-face 'flycheck-fringe-error
- :error-list-face 'flycheck-error-list-error)
-
-(put 'flycheck-warning-overlay 'face 'flycheck-warning)
-(put 'flycheck-warning-overlay 'priority 100)
-(put 'flycheck-warning-overlay 'help-echo "Unknown warning.")
-
-(flycheck-define-error-level 'warning
- :severity 10
- :overlay-category 'flycheck-warning-overlay
- :fringe-bitmap 'question-mark
- :fringe-face 'flycheck-fringe-warning
- :error-list-face 'flycheck-error-list-warning)
-
-(put 'flycheck-info-overlay 'face 'flycheck-info)
-(put 'flycheck-info-overlay 'priority 90)
-(put 'flycheck-info-overlay 'help-echo "Unknown info.")
-
-(flycheck-define-error-level 'info
- :severity -1
- :overlay-category 'flycheck-info-overlay
- ;; Not exactly the right indicator, but looks pretty, and I prefer to use
- ;; built-in bitmaps over diving into the hassle of messing around with custom
- ;; fringe bitmaps
- :fringe-bitmap 'empty-line
- :fringe-face 'flycheck-fringe-info
- :error-list-face 'flycheck-error-list-info)
-
-\f
-;;; Error filtering
-(defun flycheck-filter-errors (errors checker)
- "Filter ERRORS from CHECKER.
-
-Apply the error filter of CHECKER to ERRORs and return the
-result. If CHECKER has no error filter, fall back to
-`flycheck-sanitize-errors'."
- (let ((filter (or (flycheck-checker-error-filter checker)
- #'flycheck-sanitize-errors)))
- (funcall filter errors)))
-
-(defun flycheck-sanitize-errors (errors)
- "Sanitize ERRORS.
-
-Sanitize ERRORS by trimming leading and trailing whitespace in
-all error messages, and by replacing 0 columns and empty error
-messages with nil.
-
-Returns sanitized ERRORS."
- (dolist (err errors)
- (flycheck-error-with-buffer err
- (let ((message (flycheck-error-message err))
- (column (flycheck-error-column err))
- (id (flycheck-error-id err)))
- (when message
- (setq message (string-trim message))
- (setf (flycheck-error-message err)
- (if (string-empty-p message) nil message)))
- (when (and id (string-empty-p id))
- (setf (flycheck-error-id err) nil))
- (when (eq column 0)
- (setf (flycheck-error-column err) nil)))))
- errors)
-
-(defun flycheck-increment-error-columns (errors &optional offset)
- "Increment all columns of ERRORS by OFFSET.
-
-Use this as `:error-filter' if a syntax checker outputs 0-based
-columns."
- (mapc (lambda (err)
- (let ((column (flycheck-error-column err)))
- (when column
- (setf (flycheck-error-column err)
- (+ column (or offset 1))))))
- errors)
- errors)
-
-(defun flycheck-collapse-error-message-whitespace (errors)
- "Collapse whitespace in all messages of ERRORS.
-
-Return ERRORS."
- (dolist (err errors)
- (-when-let (message (flycheck-error-message err))
- (setf (flycheck-error-message err)
- (replace-regexp-in-string (rx (one-or-more (any space "\n" "\r")))
- " " message 'fixed-case 'literal))))
- errors)
-
-(defun flycheck-dedent-error-messages (errors)
- "Dedent all messages of ERRORS.
-
-For each error in ERRORS, determine the indentation offset from
-the leading whitespace of the first line, and dedent all further
-lines accordingly.
-
-Return ERRORS, with in-place modifications."
- (dolist (err errors)
- (-when-let (message (flycheck-error-message err))
- (with-temp-buffer
- (insert message)
- ;; Determine the indentation offset
- (goto-char (point-min))
- (back-to-indentation)
- (let* ((indent-offset (- (point) (point-min))))
- ;; Now iterate over all lines and dedent each according to
- ;; `indent-offset'
- (while (not (eobp))
- (back-to-indentation)
- ;; If the current line starts with sufficient whitespace, delete the
- ;; indendation offset. Otherwise keep the line intact, as we might
- ;; loose valuable information
- (when (>= (- (point) (line-beginning-position)) indent-offset)
- (delete-char (- indent-offset)))
- (forward-line 1)))
- (delete-trailing-whitespace (point-min) (point-max))
- (setf (flycheck-error-message err)
- (buffer-substring-no-properties (point-min) (point-max))))))
- errors)
-
-(defun flycheck-fold-include-levels (errors sentinel-message)
- "Fold levels of ERRORS from included files.
-
-ERRORS is a list of `flycheck-error' objects. SENTINEL-MESSAGE
-is a regular expression matched against the error message to
-determine whether the errror denotes errors from an included
-file. Alternatively, it is a function that is given an error and
-shall return non-nil, if the error denotes errors from an
-included file."
- (unless (or (stringp sentinel-message) (functionp sentinel-message))
- (error "Sentinel must be string or function: %S" sentinel-message))
- (let ((sentinel (if (functionp sentinel-message)
- sentinel-message
- (lambda (err)
- (string-match-p sentinel-message
- (flycheck-error-message err)))))
- (remaining-errors errors))
- (while remaining-errors
- (let* ((current-error (pop remaining-errors)))
- (when (funcall sentinel current-error)
- ;; We found an error denoting errors in the included file, so process
- ;; all subsequent errors until an error has the current file name
- ;; again, and find the most severe error level
- (let ((current-filename (flycheck-error-filename current-error))
- (current-level nil)
- (faulty-include-filename (flycheck-error-filename
- (car remaining-errors))))
- (while (and remaining-errors
- (not (string= (flycheck-error-filename
- (car remaining-errors))
- current-filename)))
- (let* ((error-in-include (pop remaining-errors))
- (in-include-level (flycheck-error-level error-in-include)))
- (unless (funcall sentinel error-in-include)
- ;; Ignore nested "included file" errors, we are only
- ;; interested in real errors because these define our level
- (when (or (not current-level)
- (> (flycheck-error-level-severity in-include-level)
- (flycheck-error-level-severity current-level)))
- (setq current-level in-include-level)))))
- (setf (flycheck-error-level current-error) current-level
- (flycheck-error-message current-error)
- (format "In include %s" faulty-include-filename))))))
- errors))
-
-(defun flycheck-dequalify-error-ids (errors)
- "De-qualify error ids in ERRORS.
-
-Remove all qualifications from error ids in ERRORS, by stripping
-all leading dotted components from error IDs. For instance, if
-the error ID is com.foo.E100, replace it with E100.
-
-This error filter is mainly useful to simplify error IDs obtained
-from parsing Checkstyle XML, which frequently has very verbose
-IDs, that include the name of the tool."
- (mapc (lambda (err)
- (let ((id (flycheck-error-id err)))
- (when id
- (setf (flycheck-error-id err)
- (replace-regexp-in-string
- (rx string-start
- (group
- (optional (zero-or-more not-newline) "."))
- (one-or-more (not (any ".")))
- string-end)
- "" id 'fixedcase 'literal 1)))))
- errors)
- errors)
-
-(defun flycheck-remove-error-ids (errors)
- "Remove all error ids from ERRORS."
- (mapc (lambda (err) (setf (flycheck-error-id err) nil)) errors)
- errors)
-
-\f
-;;; Error analysis
-(defun flycheck-count-errors (errors)
- "Count the number of ERRORS, grouped by level..
-
-Return an alist, where each ITEM is a cons cell whose `car' is an
-error level, and whose `cdr' is the number of errors of that
-level."
- (let (counts-by-level)
- (dolist (err errors)
- (let* ((level (flycheck-error-level err))
- (item (assq level counts-by-level)))
- (if item
- (setcdr item (1+ (cdr item)))
- (push (cons level 1) counts-by-level))))
- counts-by-level))
-
-(defun flycheck-has-max-errors-p (errors level)
- "Check if there is no error in ERRORS more severe than LEVEL."
- (let ((severity (flycheck-error-level-severity level))
- found)
- (while (and errors (not found))
- (setq found (< severity (flycheck-error-level-severity
- (flycheck-error-level (pop errors))))))
- (not found)))
-
-(defun flycheck-has-max-current-errors-p (level)
- "Check if there is no current error more severe than LEVEL."
- (flycheck-has-max-errors-p flycheck-current-errors level))
-
-(defun flycheck-has-errors-p (errors level)
- "Determine if there are any ERRORS with LEVEL."
- (let (found)
- (while (and errors (not found))
- (setq found (eq (flycheck-error-level (pop errors)) level)))
- found))
-
-(defun flycheck-has-current-errors-p (&optional level)
- "Determine if the current buffer has errors with LEVEL.
-
-If LEVEL is omitted if the current buffer has any errors at all."
- (if level
- (flycheck-has-errors-p flycheck-current-errors level)
- (and flycheck-current-errors t)))
-
-\f
-;;; Error overlays in the current buffer
-(defun flycheck-add-overlay (err)
- "Add overlay for ERR.
-
-Return the created overlay."
- ;; We must have a proper error region for the sake of fringe indication,
- ;; error display and error navigation, even if the highlighting is disabled.
- ;; We erase the highlighting later on in this case
- (pcase-let* ((`(,beg . ,end) (flycheck-error-region-for-mode
- err (or flycheck-highlighting-mode 'lines)))
- (overlay (make-overlay beg end))
- (level (flycheck-error-level err))
- (category (flycheck-error-level-overlay-category level)))
- (unless (flycheck-error-level-p level)
- (error "Undefined error level: %S" level))
- (overlay-put overlay 'flycheck-overlay t)
- (overlay-put overlay 'flycheck-error err)
- ;; TODO: Consider hooks to re-check if overlay contents change
- (overlay-put overlay 'category category)
- (unless flycheck-highlighting-mode
- ;; Erase the highlighting from the overlay if requested by the user
- (overlay-put overlay 'face nil))
- (when flycheck-indication-mode
- (overlay-put overlay 'before-string
- (flycheck-error-level-make-fringe-icon
- level flycheck-indication-mode)))
- (overlay-put overlay 'help-echo (flycheck-error-message err))
- overlay))
-
-(defun flycheck-filter-overlays (overlays)
- "Get all Flycheck overlays from OVERLAYS."
- (-filter (lambda (o) (overlay-get o 'flycheck-overlay)) overlays))
-
-(defun flycheck-overlays-at (pos)
- "Get all Flycheck overlays at POS."
- (flycheck-filter-overlays (overlays-at pos)))
-
-(defun flycheck-overlays-in (beg end)
- "Get all Flycheck overlays between BEG and END."
- (flycheck-filter-overlays (overlays-in beg end)))
-
-(defun flycheck-overlay-errors-at (pos)
- "Return a list of all flycheck errors overlayed at POS."
- (mapcar (lambda (o) (overlay-get o 'flycheck-error))
- (flycheck-overlays-at pos)))
-
-(defun flycheck-overlay-errors-in (beg end)
- "Return a list of all flycheck errors overlayed between BEG and END."
- (mapcar (lambda (o) (overlay-get o 'flycheck-error))
- (flycheck-overlays-in beg end)))
-
-(defvar-local flycheck-overlays-to-delete nil
- "Overlays mark for deletion after all syntax checks completed.")
-(put 'flycheck-overlays-to-delete 'permanent-local t)
-
-(defun flycheck-delete-all-overlays ()
- "Remove all flycheck overlays in the current buffer."
- (flycheck-delete-marked-overlays)
- (save-restriction
- (widen)
- (mapc #'delete-overlay (flycheck-overlays-in (point-min) (point-max)))))
-
-(defun flycheck-mark-all-overlays-for-deletion ()
- "Mark all current overlays for deletion."
- (setq flycheck-overlays-to-delete
- (append (flycheck-overlays-in (point-min) (point-max))
- flycheck-overlays-to-delete)))
-
-(defun flycheck-delete-marked-overlays ()
- "Delete all overlays marked for deletion."
- (mapc #'delete-overlay flycheck-overlays-to-delete)
- (setq flycheck-overlays-to-delete nil))
-
-\f
-;;; Error navigation in the current buffer
-(defun flycheck-error-level-interesting-at-pos-p (pos)
- "Check if error severity at POS passes `flycheck-error-level-interesting-p'."
- (flycheck-error-level-interesting-p (get-char-property pos 'flycheck-error)))
-
-(defun flycheck-error-level-interesting-p (err)
- "Check if ERR severity is >= `flycheck-navigation-minimum-level'."
- (when (flycheck-error-p err)
- (-if-let (min-level flycheck-navigation-minimum-level)
- (<= (flycheck-error-level-severity min-level)
- (flycheck-error-level-severity (flycheck-error-level err)))
- t)))
-
-(defun flycheck-next-error-pos (n &optional reset)
- "Get the position of the N-th next error.
-
-With negative n, get the position of the (-N)-th previous error
-instead. With non-nil RESET, search from `point-min', otherwise
-search from the current point.
-
-Return the position of the next or previous error, or nil if
-there is none."
- (let ((n (or n 1))
- (pos (if reset (point-min) (point))))
- (if (>= n 0)
- ;; Search forwards
- (while (and pos (> n 0))
- (setq n (1- n))
- (when (get-char-property pos 'flycheck-error)
- ;; Move beyond from the current error if any
- (setq pos (next-single-char-property-change pos 'flycheck-error)))
- (while (not (or (= pos (point-max))
- (flycheck-error-level-interesting-at-pos-p pos)))
- ;; Scan for the next error
- (setq pos (next-single-char-property-change pos 'flycheck-error)))
- (when (and (= pos (point-max))
- (not (flycheck-error-level-interesting-at-pos-p pos)))
- ;; If we reached the end of the buffer, but no error, we didn't find
- ;; any
- (setq pos nil)))
- ;; Search backwards
- (while (and pos (< n 0))
- (setq n (1+ n))
- ;; Loop until we find an error. We need to check the position *before*
- ;; the current one, because `previous-single-char-property-change'
- ;; always moves to the position *of* the change.
- (while (not (or (= pos (point-min))
- (flycheck-error-level-interesting-at-pos-p (1- pos))))
- (setq pos (previous-single-char-property-change pos 'flycheck-error)))
- (when (and (= pos (point-min))
- (not (flycheck-error-level-interesting-at-pos-p pos)))
- ;; We didn't find any error.
- (setq pos nil))
- (when pos
- ;; We found an error, so move to its beginning
- (setq pos (previous-single-char-property-change pos
- 'flycheck-error)))))
- pos))
-
-(defun flycheck-next-error-function (n reset)
- "Visit the N-th error from the current point.
-
-Intended for use with `next-error-function'."
- (let ((pos (flycheck-next-error-pos n reset)))
- (if pos
- (goto-char pos)
- (user-error "No more Flycheck errors"))))
-
-(defun flycheck-next-error (&optional n reset)
- "Visit the N-th error from the current point.
-
-If RESET is given and non-nil, re-start from the beginning of the buffer.
-
-N specifies how many errors to move forwards. If negative, move backwards."
- (interactive "P")
- (when (consp n)
- ;; Universal prefix argument means reset
- (setq reset t n nil))
- (flycheck-next-error-function n reset))
-
-(defun flycheck-previous-error (&optional n)
- "Visit the N-th previous error.
-
-If given, N specifies the number of errors to move backwards. If
-N is negative, move forwards instead."
- (interactive "P")
- (flycheck-next-error (- (or n 1))))
-
-(defun flycheck-first-error (&optional n)
- "Visit the N-th error from beginning of the buffer.
-
-If given, N specifies the number of errors to move forward from
-the beginning of the buffer."
- (interactive "P")
- (flycheck-next-error n 'reset))
-
-\f
-;;; Listing errors in buffers
-(defconst flycheck-error-list-buffer "*Flycheck errors*"
- "The name of the buffer to show error lists.")
-
-(defvar flycheck-error-list-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map (kbd "n") #'flycheck-error-list-next-error)
- (define-key map (kbd "p") #'flycheck-error-list-previous-error)
- (define-key map (kbd "g") #'flycheck-error-list-check-source)
- (define-key map (kbd "RET") #'flycheck-error-list-goto-error)
- map)
- "The keymap of `flycheck-error-list-mode'.")
-
-(defconst flycheck-error-list-format
- [("Line" 4 flycheck-error-list-entry-< :right-align t)
- ("Col" 3 nil :right-align t)
- ("Level" 8 flycheck-error-list-entry-level-<)
- ("ID" 6 t)
- ("Message" 0 t)
- (" (Checker)" 8 t)]
- "Table format for the error list.")
-
-(define-derived-mode flycheck-error-list-mode tabulated-list-mode "Flycheck errors"
- "Major mode for listing Flycheck errors.
-
-\\{flycheck-error-list-mode-map}"
- (setq tabulated-list-format flycheck-error-list-format
- ;; Sort by location initially
- tabulated-list-sort-key (cons "Line" nil)
- tabulated-list-padding 1
- tabulated-list-entries #'flycheck-error-list-entries
- ;; `revert-buffer' updates the mode line for us, so all we need to do is
- ;; set the corresponding mode line construct.
- mode-line-buffer-identification flycheck-error-list-mode-line)
- (tabulated-list-init-header))
-
-(defvar-local flycheck-error-list-source-buffer nil
- "The current source buffer of the error list.")
-;; Needs to permanently local to preserve the source buffer across buffer
-;; reversions
-(put 'flycheck-error-list-source-buffer 'permanent-local t)
-
-(defun flycheck-error-list-set-source (buffer)
- "Set BUFFER as the source buffer of the error list."
- (when (get-buffer flycheck-error-list-buffer)
- (with-current-buffer flycheck-error-list-buffer
- ;; Only update the source when required
- (unless (eq buffer flycheck-error-list-source-buffer)
- (setq flycheck-error-list-source-buffer buffer)
- (flycheck-error-list-refresh)))))
-
-(defun flycheck-error-list-update-source ()
- "Update the source buffer of the error list."
- (when (not (eq (current-buffer) (get-buffer flycheck-error-list-buffer)))
- ;; We must not update the source buffer, if the current buffer is the error
- ;; list itself.
- (flycheck-error-list-set-source (current-buffer))))
-
-(defun flycheck-error-list-check-source ()
- "Trigger a syntax check in the source buffer of the error list."
- (interactive)
- (let ((buffer (get-buffer flycheck-error-list-source-buffer)))
- (when (buffer-live-p buffer)
- (with-current-buffer buffer
- (flycheck-buffer)))))
-
-(define-button-type 'flycheck-error-list
- 'action #'flycheck-error-list-button-goto-error
- 'help-echo "mouse-2, RET: goto error")
-
-(defun flycheck-error-list-button-goto-error (button)
- "Go to the error at BUTTON."
- (flycheck-error-list-goto-error (button-start button)))
-
-(defsubst flycheck-error-list-make-cell (text &optional face)
- "Make an error list cell with TEXT and FACE."
- (let ((face (or face 'default)))
- (list text 'type 'flycheck-error-list 'face face)))
-
-(defsubst flycheck-error-list-make-number-cell (number face)
- "Make a table cell for a NUMBER with FACE.
-
-Convert NUMBER to string, fontify it with FACE and return the
-string with attached text properties."
- (flycheck-error-list-make-cell
- (if (numberp number) (number-to-string number) "")
- face))
-
-(defun flycheck-error-list-make-entry (error)
- "Make a table cell for the given ERROR.
-
-Return a list with the contents of the table cell."
- (let* ((level (flycheck-error-level error))
- (level-face (flycheck-error-level-error-list-face level))
- (line (flycheck-error-line error))
- (column (flycheck-error-column error))
- (message (or (flycheck-error-message error)
- (format "Unknown %s" (symbol-name level))))
- (id (flycheck-error-id error))
- (checker (flycheck-error-checker error)))
- (list error
- (vector (flycheck-error-list-make-number-cell
- line 'flycheck-error-list-line-number)
- (flycheck-error-list-make-number-cell
- column 'flycheck-error-list-column-number)
- (flycheck-error-list-make-cell
- (symbol-name (flycheck-error-level error)) level-face)
- (flycheck-error-list-make-cell
- (if id (format "%s" id) "")
- 'flycheck-error-list-id)
- (flycheck-error-list-make-cell message)
- (flycheck-error-list-make-cell
- (format "(%s)" checker)
- 'flycheck-error-list-checker-name)))))
-
-(defun flycheck-error-list-entries ()
- "Create the entries for the error list."
- (when (buffer-live-p flycheck-error-list-source-buffer)
- (let ((errors (buffer-local-value 'flycheck-current-errors
- flycheck-error-list-source-buffer)))
- (mapcar #'flycheck-error-list-make-entry errors))))
-
-(defun flycheck-error-list-entry-< (entry1 entry2)
- "Determine whether ENTRY1 is before ENTRY2 by location.
-
-See `flycheck-error-<'."
- (flycheck-error-< (car entry1) (car entry2)))
-
-(defun flycheck-error-list-entry-level-< (entry1 entry2)
- "Determine whether ENTRY1 is before ENTRY2 by level.
-
-See `flycheck-error-level-<'."
- (not (flycheck-error-level-< (car entry1) (car entry2))))
-
-(defvar flycheck-error-list-mode-line-map
- (let ((map (make-sparse-keymap)))
- (define-key map [mode-line mouse-1]
- #'flycheck-error-list-mouse-switch-to-source)
- map)
- "Keymap for error list mode line.")
-
-(defun flycheck-error-list-propertized-source-name ()
- "Get the name of the current source buffer for the mode line.
-
-Propertize the name of the current source buffer for use in the
-mode line indication of `flycheck-error-list-mode'."
- (let ((name (replace-regexp-in-string
- (rx "%") "%%"
- (buffer-name flycheck-error-list-source-buffer)
- 'fixed-case 'literal)))
- (propertize name 'face 'mode-line-buffer-id
- 'mouse-face 'mode-line-highlight
- 'help-echo "mouse-1: switch to source"
- 'local-map flycheck-error-list-mode-line-map)))
-
-(defun flycheck-error-list-mouse-switch-to-source (event)
- "Switch to the error list source buffer of the EVENT window."
- (interactive "e")
- (save-selected-window
- (when (eventp event)
- (select-window (posn-window (event-start event))))
- (when (buffer-live-p flycheck-error-list-source-buffer)
- (switch-to-buffer flycheck-error-list-source-buffer))))
-
-(defun flycheck-get-error-list-window-list (&optional all-frames)
- "Get all windows displaying the error list.
-
-ALL-FRAMES specifies the frames to consider, as in
-`get-buffer-window-list'."
- (-when-let (buf (get-buffer flycheck-error-list-buffer))
- (get-buffer-window-list buf nil all-frames)))
-
-(defun flycheck-get-error-list-window (&optional all-frames)
- "Get a window displaying the error list, or nil if none.
-
-ALL-FRAMES specifies the frames to consider, as in
-`get-buffer-window'."
- (-when-let (buf (get-buffer flycheck-error-list-buffer))
- (get-buffer-window buf all-frames)))
-
-(defun flycheck-error-list-recenter-at (pos)
- "Recenter the error list at POS."
- (dolist (window (flycheck-get-error-list-window-list t))
- (with-selected-window window
- (goto-char pos)
- (recenter))))
-
-(defun flycheck-error-list-refresh ()
- "Refresh the current error list.
-
-Add all errors currently reported for the current
-`flycheck-error-list-source-buffer', and recenter the error
-list."
- ;; We only refresh the error list, when it is visible in a window, and we
- ;; select this window while reverting, because Tabulated List mode attempts to
- ;; recenter the error at the old location, so it must have the proper window
- ;; selected.
- (-when-let (window (flycheck-get-error-list-window t))
- (with-selected-window window
- (revert-buffer))
- (run-hooks 'flycheck-error-list-after-refresh-hook)
- (let ((preserve-pos (eq (current-buffer)
- (get-buffer flycheck-error-list-buffer))))
- ;; If the error list is the current buffer, don't recenter when
- ;; highlighting
- (flycheck-error-list-highlight-errors preserve-pos))))
-
-(defun flycheck-error-list-goto-error (&optional pos)
- "Go to the location of the error at POS in the error list.
-
-POS defaults to `point'."
- (interactive)
- (-when-let* ((error (tabulated-list-get-id pos))
- (buffer (flycheck-error-buffer error)))
- (when (buffer-live-p buffer)
- (if (eq (window-buffer) (get-buffer flycheck-error-list-buffer))
- ;; When called from within the error list, keep the error list,
- ;; otherwise replace the current buffer.
- (pop-to-buffer buffer 'other-window)
- (switch-to-buffer buffer))
- (let ((pos (flycheck-error-pos error)))
- (unless (eq (goto-char pos) (point))
- ;; If widening gets in the way of moving to the right place, remove it
- ;; and try again
- (widen)
- (goto-char pos)))
- ;; Re-highlight the errors
- (flycheck-error-list-highlight-errors 'preserve-pos))))
-
-(defun flycheck-error-list-next-error-pos (pos &optional n)
- "Get the N'th next error in the error list from POS.
-
-N defaults to 1. If N is negative, search for the previous error
-instead.
-
-Get the beginning position of the N'th next error from POS, or
-nil, if there is no next error."
- (let ((n (or n 1)))
- (if (>= n 0)
- ;; Search forward
- (while (and pos (/= n 0))
- (setq n (1- n))
- (setq pos (next-single-property-change pos 'tabulated-list-id)))
- ;; Search backwards
- (while (/= n 0)
- (setq n (1+ n))
- ;; We explicitly give the limit here to explicitly have the minimum
- ;; point returned, to be able to move to the first error (which starts
- ;; at `point-min')
- (setq pos (previous-single-property-change pos 'tabulated-list-id
- nil (point-min)))))
- pos))
-
-(defun flycheck-error-list-previous-error (n)
- "Go to the N'th previous error in the error list."
- (interactive "P")
- (flycheck-error-list-next-error (- (or n 1))))
-
-(defun flycheck-error-list-next-error (n)
- "Go to the N'th next error in the error list."
- (interactive "P")
- (let ((pos (flycheck-error-list-next-error-pos (point) n)))
- (when (and pos (/= pos (point)))
- (goto-char pos)
- (save-selected-window
- ;; Keep the error list selected, so that the user can navigate errors by
- ;; repeatedly pressing n/p, without having to re-select the error list
- ;; window.
- (flycheck-error-list-goto-error)))))
-
-(defvar-local flycheck-error-list-highlight-overlays nil
- "Error highlight overlays in the error list buffer.")
-(put 'flycheck-error-list-highlight-overlays 'permanent-local t)
-
-(defun flycheck-error-list-highlight-errors (&optional preserve-pos)
- "Highlight errors in the error list.
-
-Highlight all errors in the error lists that are at point in the
-source buffer, and on the same line as point. Then recenter the
-error list to the highlighted error, unless PRESERVE-POS is
-non-nil."
- (when (get-buffer flycheck-error-list-buffer)
- (let ((current-errors (flycheck-overlay-errors-in (line-beginning-position)
- (line-end-position))))
- (with-current-buffer flycheck-error-list-buffer
- (let ((old-overlays flycheck-error-list-highlight-overlays)
- (min-point (point-max))
- (max-point (point-min)))
- ;; Display the new overlays first, to avoid re-display flickering
- (setq flycheck-error-list-highlight-overlays nil)
- (when current-errors
- (let ((next-error-pos (point-min)))
- (while next-error-pos
- (let* ((beg next-error-pos)
- (end (flycheck-error-list-next-error-pos beg))
- (err (tabulated-list-get-id beg)))
- (when (member err current-errors)
- (setq min-point (min min-point beg)
- max-point (max max-point beg))
- (let ((ov (make-overlay beg
- ;; Extend overlay to the beginning of
- ;; the next line, to highlight the
- ;; whole line
- (or end (point-max)))))
- (push ov flycheck-error-list-highlight-overlays)
- (overlay-put ov 'flycheck-error-highlight-overlay t)
- (overlay-put ov 'face 'flycheck-error-list-highlight)))
- (setq next-error-pos end)))))
- ;; Delete the old overlays
- (mapc #'delete-overlay old-overlays)
- (when (and (not preserve-pos) current-errors)
- ;; Move point to the middle error
- (goto-char (+ min-point (/ (- max-point min-point) 2)))
- (beginning-of-line)
- ;; And recenter the error list at this position
- (flycheck-error-list-recenter-at (point))))))))
-
-(defun flycheck-list-errors ()
- "Show the error list for the current buffer."
- (interactive)
- (unless flycheck-mode
- (user-error "Flycheck mode not enabled"))
- ;; Create and initialize the error list
- (unless (get-buffer flycheck-error-list-buffer)
- (with-current-buffer (get-buffer-create flycheck-error-list-buffer)
- (flycheck-error-list-mode)))
- (flycheck-error-list-set-source (current-buffer))
- ;; Show the error list in a window, and re-select the old window
- (display-buffer flycheck-error-list-buffer)
- ;; Finally, refresh the error list to show the most recent errors
- (flycheck-error-list-refresh))
-
-(defalias 'list-flycheck-errors 'flycheck-list-errors)
-
-\f
-;;; Displaying errors in the current buffer
-(defun flycheck-display-errors (errors)
- "Display ERRORS using `flycheck-display-errors-function'."
- (when flycheck-display-errors-function
- (funcall flycheck-display-errors-function errors)))
-
-(defvar-local flycheck-display-error-at-point-timer nil
- "Timer to automatically show the error at point in minibuffer.")
-
-(defun flycheck-cancel-error-display-error-at-point-timer ()
- "Cancel the error display timer for the current buffer."
- (when flycheck-display-error-at-point-timer
- (cancel-timer flycheck-display-error-at-point-timer)
- (setq flycheck-display-error-at-point-timer nil)))
-
-(defun flycheck-display-error-at-point ()
- "Display the all error messages at point in minibuffer."
- ;; This function runs from a timer, so we must take care to not ignore any
- ;; errors
- (with-demoted-errors "Flycheck error display error: %s"
- (flycheck-cancel-error-display-error-at-point-timer)
- (when flycheck-mode
- (-when-let (errors (flycheck-overlay-errors-at (point)))
- (flycheck-display-errors errors)))))
-
-(defun flycheck-display-error-at-point-soon ()
- "Display the first error message at point in minibuffer delayed."
- (flycheck-cancel-error-display-error-at-point-timer)
- (when (flycheck-overlays-at (point))
- (setq flycheck-display-error-at-point-timer
- (run-at-time flycheck-display-errors-delay nil 'flycheck-display-error-at-point))))
-
-\f
-;;; Functions to display errors
-(defconst flycheck-error-message-buffer "*Flycheck error messages*"
- "The name of the buffer to show long error messages in.")
-
-(defun flycheck-error-message-buffer ()
- "Get the buffer object to show long error messages in.
-
-Get the buffer named by variable `flycheck-error-message-buffer',
-or nil if the buffer does not exist."
- (get-buffer flycheck-error-message-buffer))
-
-(defun flycheck-may-use-echo-area-p ()
- "Determine whether the echo area may be used.
-
-The echo area may be used if the cursor is not in the echo area,
-and if the echo area is not occupied by minibuffer input."
- (not (or cursor-in-echo-area (active-minibuffer-window))))
-
-(defun flycheck-display-error-messages (errors)
- "Display the messages of ERRORS.
-
-Concatenate all non-nil messages of ERRORS separated by empty
-lines, and display them with `display-message-or-buffer', which
-shows the messages either in the echo area or in a separate
-buffer, depending on the number of lines. See Info
-node `(elisp)Displaying Messages' for more information.
-
-In the latter case, show messages in
-`flycheck-error-message-buffer'."
- (when (and errors (flycheck-may-use-echo-area-p))
- (let ((messages (mapcar #'flycheck-error-format-message-and-id errors)))
- (display-message-or-buffer (string-join messages "\n\n")
- flycheck-error-message-buffer))))
-
-(defun flycheck-display-error-messages-unless-error-list (errors)
- "Show messages of ERRORS unless the error list is visible.
-
-Like `flycheck-display-error-messages', but only if the error
-list (see `flycheck-list-errors') is not visible in any window in
-the current frame."
- (unless (flycheck-get-error-list-window 'current-frame)
- (flycheck-display-error-messages errors)))
-
-(defun flycheck-hide-error-buffer ()
- "Hide the Flycheck error buffer if necessary.
-
-Hide the error buffer if there is no error under point."
- (-when-let* ((buffer (flycheck-error-message-buffer))
- (window (get-buffer-window buffer)))
- (unless (flycheck-overlays-at (point))
- (quit-window nil window))))
-
-\f
-;;; Working with errors
-(defun flycheck-copy-errors-as-kill (pos &optional formatter)
- "Copy each error at POS into kill ring, using FORMATTER.
-
-FORMATTER is a function to turn an error into a string,
-defaulting to `flycheck-error-message'.
-
-Interactively, use `flycheck-error-format-message-and-id' as
-FORMATTER with universal prefix arg, and `flycheck-error-id' with
-normal prefix arg, i.e. copy the message and the ID with
-universal prefix arg, and only the id with normal prefix arg."
- (interactive (list (point)
- (pcase current-prefix-arg
- ((pred not) #'flycheck-error-message)
- ((pred consp) #'flycheck-error-format-message-and-id)
- (_ #'flycheck-error-id))))
- (let ((messages (delq nil (mapcar (or formatter #'flycheck-error-message)
- (flycheck-overlay-errors-at pos)))))
- (when messages
- (mapc #'kill-new (reverse messages))
- (message (string-join messages "\n")))))
-
-(define-obsolete-function-alias 'flycheck-copy-messages-as-kill
- 'flycheck-copy-errors-as-kill "0.22")
-
-\f
-;;; Syntax checkers using external commands
-(defun flycheck-command-argument-p (arg)
- "Check whether ARG is a valid command argument."
- (pcase arg
- ((pred stringp) t)
- ((or `source `source-inplace `source-original) t)
- ((or `temporary-directory `temporary-file-name) t)
- (`null-device t)
- (`(config-file ,option-name ,config-file-var)
- (and (stringp option-name)
- (symbolp config-file-var)))
- (`(config-file ,option-name ,config-file-var ,prepender)
- (and (stringp option-name)
- (symbolp config-file-var)
- (symbolp prepender)))
- (`(,(or `option `option-list) ,option-name ,option-var)
- (and (stringp option-name)
- (symbolp option-var)))
- (`(,(or `option `option-list) ,option-name ,option-var ,prepender)
- (and (stringp option-name)
- (symbolp option-var)
- (symbolp prepender)))
- (`(,(or `option `option-list) ,option-name ,option-var ,prepender ,filter)
- (and (stringp option-name)
- (symbolp option-var)
- (symbolp prepender)
- (symbolp filter)))
- (`(option-flag ,option-name ,option-var)
- (and (stringp option-name)
- (symbolp option-var)))
- (`(eval ,_) t)
- (_ nil)))
-
-;;;###autoload
-(defun flycheck-define-command-checker (symbol docstring &rest properties)
- "Define SYMBOL as syntax checker which runs 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.
-
-Note that you may not give `:start', `:interrupt', and
-`:print-doc' for a command checker. You can give a custom
-`:verify' function, but you should take care to call
-`flycheck-verify-command-checker' in a custom `:verify'
-function."
- (declare (indent 1)
- (doc-string 2))
- (dolist (prop '(:start :interrupt :print-doc))
- (when (plist-get properties prop)
- (error "%s not allowed in definition of command syntax checker %s"
- prop symbol)))
-
- (unless (plist-get properties :error-filter)
- ;; Default to `flycheck-sanitize-errors' as error filter
- (setq properties (plist-put properties :error-filter
- #'flycheck-sanitize-errors)))
-
- (let ((command (plist-get properties :command))
- (patterns (plist-get properties :error-patterns))
- (parser (or (plist-get properties :error-parser)
- #'flycheck-parse-with-patterns))
- (predicate (plist-get properties :predicate)))
-
- (unless command
- (error "Missing :command in syntax checker %s" symbol))
- (unless (stringp (car command))
- (error "Command executable for syntax checker %s must be a string: %S"
- symbol (car command)))
- (dolist (arg (cdr command))
- (unless (flycheck-command-argument-p arg)
- (error "Invalid command argument %S in syntax checker %s" arg symbol)))
- (when (and (eq parser 'flycheck-parse-with-patterns)
- (not patterns))
- (error "Missing :error-patterns in syntax checker %s" symbol))
-
- (setq properties
- ;; Construct a predicate that checks whether the executable exists, to
- ;; guard against syntax checker tools which are not installed
- (plist-put properties :predicate
- (lambda ()
- (and (executable-find (flycheck-checker-executable symbol))
- (or (not predicate) (funcall predicate))))))
-
- (apply #'flycheck-define-generic-checker symbol docstring
- :start #'flycheck-start-command-checker
- :interrupt #'flycheck-interrupt-command-checker
- :print-doc #'flycheck-command-checker-print-doc
- :verify #'flycheck-verify-command-checker
- properties)
-
- ;; Pre-compile all errors patterns into strings, so that we don't need to do
- ;; that on each error parse
- (let ((patterns (mapcar (lambda (p)
- (cons (flycheck-rx-to-string `(and ,@(cdr p))
- 'no-group)
- (car p)))
- patterns)))
- (pcase-dolist (`(,prop . ,value)
- `((flycheck-command . ,command)
- (flycheck-error-parser . ,parser)
- (flycheck-error-patterns . ,patterns)))
- (put symbol prop value)))))
-
-(eval-and-compile
- ;; Make this function available during byte-compilation, since we need it
- ;; at macro expansion of `flycheck-def-executable-var'.
- (defun flycheck-checker-executable-variable (checker)
- "Get the executable variable of CHECKER.
-
-The executable variable is named `flycheck-CHECKER-executable'."
- (intern (format "flycheck-%s-executable" checker))))
-
-(defun flycheck-checker-default-executable (checker)
- "Get the default executable of CHECKER."
- (car (get checker 'flycheck-command)))
-
-(defun flycheck-checker-executable (checker)
- "Get the command executable of CHECKER.
-
-The executable is either the value of the variable
-`flycheck-CHECKER-executable', or the default executable given in
-the syntax checker definition, if the variable is nil."
- (let ((var (flycheck-checker-executable-variable checker)))
- (or (and (boundp var) (symbol-value var))
- (flycheck-checker-default-executable checker))))
-
-(defun flycheck-checker-arguments (checker)
- "Get the command arguments of CHECKER."
- (cdr (get checker 'flycheck-command)))
-
-(defun flycheck-checker-error-patterns (checker)
- "Get the error patterns of CHECKER.
-
-Each pattern has the form `(REGEXP . LEVEL)' where REGEXP is the
-regular expression, and LEVEL the corresponding level symbol."
- (get checker 'flycheck-error-patterns))
-
-(defun flycheck-checker-error-parser (checker)
- "Get the error parser of CHECKER."
- (get checker 'flycheck-error-parser))
-
-(defun flycheck-substitute-argument (arg checker)
- "Substitute ARG for CHECKER.
-
-Return a list of real arguments for the executable of CHECKER,
-substituted for the symbolic argument ARG. Single arguments,
-e.g. if ARG is a literal strings, are wrapped in a list.
-
-ARG may be one of the following forms:
-
-STRING
- Return ARG unchanged.
-
-`source', `source-inplace'
- Create a temporary file to check and return its path. With
- `source-inplace' create the temporary file in the same
- directory as the original file. The value of
- `flycheck-temp-prefix' is used as prefix of the file name.
-
- With `source', try to retain the non-directory component of
- the buffer's file name in the temporary file.
-
- `source' is the preferred way to pass the input file to a
- syntax checker. `source-inplace' should only be used if the
- syntax checker needs other files from the source directory,
- such as include files in C.
-
-`source-original'
- Return the path of the actual file to check, or an empty
- string if the buffer has no file name.
-
- Note that the contents of the file may not be up to date
- with the contents of the buffer to check. Do not use this
- as primary input to a checker, unless absolutely necessary.
-
- When using this symbol as primary input to the syntax
- checker, add `flycheck-buffer-saved-p' to the `:predicate'.
-
-`temporary-directory'
- Create a unique temporary directory and return its path.
-
-`temporary-file-name'
- Return a unique temporary filename. The file is *not*
- created.
-
- To ignore the output of syntax checkers, try `null-device'
- first.
-
-`null-device'
- Return the value of `null-device', i.e the system null
- device.
-
- Use this option to ignore the output of a syntax checker.
- If the syntax checker cannot handle the null device, or
- won't write to an existing file, try `temporary-file-name'
- instead.
-
-`(config-file OPTION VARIABLE [PREPEND-FN])'
- Search the configuration file bound to VARIABLE with
- `flycheck-locate-config-file' and return a list of arguments
- that pass this configuration file to the syntax checker, or
- nil if the configuration file was not found.
-
- PREPEND-FN is called with the OPTION and the located
- configuration file, and should return OPTION prepended
- before the file, either a string or as list. If omitted,
- PREPEND-FN defaults to `list'.
-
-`(option OPTION VARIABLE [PREPEND-FN [FILTER]])'
- Retrieve the value of VARIABLE and return a list of
- arguments that pass this value as value for OPTION to the
- syntax checker.
-
- PREPEND-FN is called with the OPTION and the value of
- VARIABLE, and should return OPTION prepended before the
- file, either a string or as list. If omitted, PREPEND-FN
- defaults to `list'.
-
- FILTER is an optional function to be applied to the value of
- VARIABLE before prepending. This function must return nil
- or a string. In the former case, return nil. In the latter
- case, return a list of arguments as described above.
-
-`(option-list OPTION VARIABLE [PREPEND-FN [FILTER]])'
- Retrieve the value of VARIABLE, which must be a list,
- and prepend OPTION before each item in this list, using
- PREPEND-FN.
-
- PREPEND-FN is called with the OPTION and each item of the
- list as second argument, and should return OPTION prepended
- before the item, either as string or as list. If omitted,
- PREPEND-FN defaults to `list'.
-
- FILTER is an optional function to be applied to each item in
- the list before prepending OPTION. It shall return the
- option value for each item as string, or nil, if the item is
- to be ignored.
-
-`(option-flag OPTION VARIABLE)'
- Retrieve the value of VARIABLE and return OPTION, if the
- value is non-nil. Otherwise return nil.
-
-`(eval FORM)'
- Return the result of evaluating FORM in the buffer to be
- checked. FORM must either return a string or a list of
- strings, or nil to indicate that nothing should be
- substituted for CELL. For all other return types, signal an
- error
-
- _No_ further substitutions are performed, neither in FORM
- before it is evaluated, nor in the result of evaluating
- FORM.
-
-In all other cases, signal an error.
-
-Note that substitution is *not* recursive. No symbols or cells
-are substituted within the body of cells!"
- (pcase arg
- ((pred stringp) (list arg))
- (`source
- (list (flycheck-save-buffer-to-temp #'flycheck-temp-file-system)))
- (`source-inplace
- (list (flycheck-save-buffer-to-temp #'flycheck-temp-file-inplace)))
- (`source-original (list (or (buffer-file-name) "")))
- (`temporary-directory (list (flycheck-temp-dir-system)))
- (`temporary-file-name
- (let ((directory (flycheck-temp-dir-system)))
- (list (make-temp-name (expand-file-name "flycheck" directory)))))
- (`null-device (list null-device))
- (`(config-file ,option-name ,file-name-var)
- (-when-let* ((value (symbol-value file-name-var))
- (file-name (flycheck-locate-config-file value checker)))
- (flycheck-prepend-with-option option-name (list file-name))))
- (`(config-file ,option-name ,file-name-var ,prepend-fn)
- (-when-let* ((value (symbol-value file-name-var))
- (file-name (flycheck-locate-config-file value checker)))
- (flycheck-prepend-with-option option-name (list file-name) prepend-fn)))
- (`(option ,option-name ,variable)
- (-when-let (value (symbol-value variable))
- (unless (stringp value)
- (error "Value %S of %S for option %s is not a string"
- value variable option-name))
- (flycheck-prepend-with-option option-name (list value))))
- (`(option ,option-name ,variable ,prepend-fn)
- (-when-let (value (symbol-value variable))
- (unless (stringp value)
- (error "Value %S of %S for option %s is not a string"
- value variable option-name))
- (flycheck-prepend-with-option option-name (list value) prepend-fn)))
- (`(option ,option-name ,variable ,prepend-fn ,filter)
- (-when-let (value (funcall filter (symbol-value variable)))
- (unless (stringp value)
- (error "Value %S of %S (filter: %S) for option %s is not a string"
- value variable filter option-name))
- (flycheck-prepend-with-option option-name (list value) prepend-fn)))
- (`(option-list ,option-name ,variable)
- (let ((value (symbol-value variable)))
- (unless (and (listp value) (-all? #'stringp value))
- (error "Value %S of %S for option %S is not a list of strings"
- value variable option-name))
- (flycheck-prepend-with-option option-name value)))
- (`(option-list ,option-name ,variable ,prepend-fn)
- (let ((value (symbol-value variable)))
- (unless (and (listp value) (-all? #'stringp value))
- (error "Value %S of %S for option %S is not a list of strings"
- value variable option-name))
- (flycheck-prepend-with-option option-name value prepend-fn)))
- (`(option-list ,option-name ,variable ,prepend-fn ,filter)
- (let ((value (delq nil (mapcar filter (symbol-value variable)))))
- (unless (and (listp value) (-all? #'stringp value))
- (error "Value %S of %S for option %S is not a list of strings"
- value variable option-name))
- (flycheck-prepend-with-option option-name value prepend-fn)))
- (`(option-flag ,option-name ,variable)
- (when (symbol-value variable)
- (list option-name)))
- (`(eval ,form)
- (let ((result (eval form)))
- (cond
- ((and (listp result) (-all? #'stringp result)) result)
- ((stringp result) (list result))
- (t (error "Invalid result from evaluation of %S: %S" form result)))))
- (_ (error "Unsupported argument %S" arg))))
-
-(defun flycheck-checker-substituted-arguments (checker)
- "Get the substituted arguments of a CHECKER.
-
-Substitute each argument of CHECKER using
-`flycheck-substitute-argument'. This replaces any special
-symbols in the command."
- (apply #'append
- (mapcar (lambda (arg) (flycheck-substitute-argument arg checker))
- (flycheck-checker-arguments checker))))
-
-(defun flycheck-start-command-checker (checker callback)
- "Start a command CHECKER with CALLBACK."
- (let (process)
- (condition-case err
- (let* ((program (flycheck-checker-executable checker))
- (args (flycheck-checker-substituted-arguments checker))
- ;; Use pipes to receive output from the syntax checker. They are
- ;; more efficient and more robust than PTYs, which Emacs uses by
- ;; default, and since we don't need any job control features, we
- ;; can easily use pipes.
- (process-connection-type nil))
- ;; We pass do not associate the process with any buffer, by
- ;; passing nil for the BUFFER argument of `start-process'.
- ;; Instead, we just remember the buffer being checked in a
- ;; process property (see below). This neatly avoids all
- ;; side-effects implied by attached a process to a buffer, which
- ;; may cause conflicts with other packages.
- ;;
- ;; See https://github.com/flycheck/flycheck/issues/298 for an
- ;; example for such a conflict.
- (setq process (apply 'start-process (format "flycheck-%s" checker)
- nil program args))
- (set-process-sentinel process 'flycheck-handle-signal)
- (set-process-filter process 'flycheck-receive-checker-output)
- (set-process-query-on-exit-flag process nil)
- ;; Remember the syntax checker, the buffer and the callback
- (process-put process 'flycheck-checker checker)
- (process-put process 'flycheck-callback callback)
- (process-put process 'flycheck-buffer (current-buffer))
- ;; Track the temporaries created by argument substitution in the
- ;; process itself, to get rid of the global state ASAP.
- (process-put process 'flycheck-temporaries flycheck-temporaries)
- (setq flycheck-temporaries nil)
- ;; Return the process
- process)
- (error
- ;; In case of error, clean up our resources, and report the error back to
- ;; Flycheck
- (flycheck-safe-delete-temporaries)
- (when process
- ;; No need to explicitly delete the temporary files of the process,
- ;; because deleting runs the sentinel, which will delete them anyway.
- (delete-process process))
- (signal (car err) (cdr err))))))
-
-(defun flycheck-interrupt-command-checker (_checker process)
- "Interrupt a PROCESS."
- ;; Deleting the process always triggers the sentinel, which does the cleanup
- (when process
- (delete-process process)))
-
-(defun flycheck-command-checker-print-doc (checker)
- "Print additional documentation for a command CHECKER."
- (let ((executable (flycheck-checker-default-executable checker))
- (config-file-var (flycheck-checker-config-file-var checker))
- (option-vars (-sort #'string<
- (flycheck-checker-option-vars checker))))
- (princ "\n")
-
- (let ((doc-start (with-current-buffer standard-output (point-max))))
- ;; Track the start of our documentation so that we can re-indent it
- ;; properly
- (princ " This syntax checker executes \"")
- (princ executable)
- (princ "\"")
- (when config-file-var
- (princ ", using a configuration file from `")
- (princ (symbol-name config-file-var))
- (princ "'"))
- (princ ". The executable can be overridden with `")
- (princ (symbol-name (flycheck-checker-executable-variable checker)))
- (princ "'.")
-
- (with-current-buffer standard-output
- (save-excursion
- (fill-region-as-paragraph doc-start (point-max)))))
- (princ "\n")
- (when option-vars
- (princ "\n This syntax checker can be configured with these options:\n\n")
- (dolist (var option-vars)
- (princ (format " * `%s'\n" var))))))
-
-(defun flycheck-verify-command-checker (checker)
- "Verify a command CHECKER in the current buffer.
-
-Return a list of `flycheck-verification-result' objects for
-CHECKER."
- (let ((executable (executable-find (flycheck-checker-executable checker))))
- (list
- (flycheck-verification-result-new
- :label "executable"
- :message (if executable (format "Found at %s" executable) "Not found")
- :face (if executable 'success '(bold error))))))
-
-\f
-;;; Process management for command syntax checkers
-(defun flycheck-receive-checker-output (process output)
- "Receive a syntax checking PROCESS OUTPUT."
- (push output (process-get process 'flycheck-pending-output)))
-
-(defun flycheck-get-output (process)
- "Get the complete output of PROCESS."
- (with-demoted-errors "Error while retrieving process output: %S"
- (let ((pending-output (process-get process 'flycheck-pending-output)))
- (apply #'concat (nreverse pending-output)))))
-
-(defun flycheck-handle-signal (process _event)
- "Handle a signal from the syntax checking PROCESS.
-
-_EVENT is ignored."
- (when (memq (process-status process) '(signal exit))
- (let ((files (process-get process 'flycheck-temporaries))
- (buffer (process-get process 'flycheck-buffer))
- (callback (process-get process 'flycheck-callback)))
- ;; Delete the temporary files
- (mapc #'flycheck-safe-delete files)
- (when (buffer-live-p buffer)
- (with-current-buffer buffer
- (condition-case err
- (pcase (process-status process)
- (`signal
- (funcall callback 'interrupted))
- (`exit
- (flycheck-finish-checker-process
- (process-get process 'flycheck-checker)
- (process-exit-status process)
- files
- (flycheck-get-output process) callback)))
- (error
- (funcall callback 'errored (error-message-string err)))))))))
-
-(defun flycheck-finish-checker-process
- (checker exit-status files output callback)
- "Finish a checker process from CHECKER with EXIT-STATUS.
-
-FILES is a list of files given as input to the checker. OUTPUT
-is the output of the syntax checker. CALLBACK is the status
-callback to use for reporting.
-
-Parse the OUTPUT and report an appropriate error status."
- (let ((errors (flycheck-parse-output output checker (current-buffer))))
- (when (and (/= exit-status 0) (not errors))
- ;; Warn about a suspicious result from the syntax checker. We do right
- ;; after parsing the errors, before filtering, because a syntax checker
- ;; might report errors from other files (e.g. includes) even if there
- ;; are no errors in the file being checked.
- (funcall callback 'suspicious
- (format "Checker %S returned non-zero exit code %s, but no errors from \
-output: %s\nChecker definition probably flawed." checker exit-status output)))
- (funcall callback 'finished
- ;; Fix error file names, by substituting them backwards from the
- ;; temporaries
- (mapcar (lambda (e) (flycheck-fix-error-filename e files))
- errors))))
-
-\f
-;;; Executables of command checkers.
-(defmacro flycheck-def-executable-var (checker default-executable)
- "Define the executable variable for CHECKER.
-
-DEFAULT-EXECUTABLE is the default executable. It is only used in
-the docstring of the variable.
-
-The variable is defined with `defcustom' in the
-`flycheck-executables' group. It's also defined to be risky as
-file-local variable, to avoid arbitrary executables being used
-for syntax checking."
- (let ((executable-var (flycheck-checker-executable-variable checker)))
- `(progn
- (defcustom ,executable-var nil
- ,(format "The executable of the %s syntax checker.
-
-Either a string containing the name or the path of the
-executable, or nil to use the default executable from the syntax
-checker declaration.
-
-The default executable is %S." checker default-executable)
- :type '(choice (const :tag "Default executable" nil)
- (string :tag "Name or path"))
- :group 'flycheck-executables
- :risky t))))
-
-(defun flycheck-set-checker-executable (checker &optional executable)
- "Set the EXECUTABLE of CHECKER in the current buffer.
-
-CHECKER is a syntax checker symbol. EXECUTABLE is a string with
-the name of a executable or the path to an executable file, which
-is to be used as executable for CHECKER. If omitted or nil,
-reset the executable of CHECKER.
-
-Interactively, prompt for a syntax checker and an executable
-file, and set the executable of the selected syntax checker.
-With prefix arg, prompt for a syntax checker only, and reset the
-executable of the select checker to the default.
-
-Set the executable variable of CHECKER, that is,
-`flycheck-CHECKER-executable' to EXECUTABLE. Signal
-`user-error', if EXECUTABLE does not denote a command or an
-executable file.
-
-This command is intended for interactive use only. In Lisp, just
-`let'-bind the corresponding variable, or set it directly. Use
-`flycheck-checker-executable-variable' to obtain the executable
-variable symbol for a syntax checker."
- (declare (interactive-only "Set the executable variable directly instead"))
- (interactive
- (let* ((checker (read-flycheck-checker "Syntax checker: "))
- (default-executable (flycheck-checker-default-executable checker))
- (executable (if current-prefix-arg
- nil
- (read-file-name "Executable: " nil default-executable
- nil nil #'executable-find))))
- (list checker executable)))
- (when (and executable (not (executable-find executable)))
- (user-error "%s is no executable" executable))
- (let ((variable (flycheck-checker-executable-variable checker)))
- (set (make-local-variable variable) executable)))
-
-\f
-;;; Configuration files and options for command checkers
-;;;###autoload
-(defmacro flycheck-def-config-file-var (symbol checker &optional file-name
- &rest custom-args)
- "Define SYMBOL as config file variable for CHECKER, with default FILE-NAME.
-
-SYMBOL is declared as customizable variable using `defcustom', to
-provide a configuration file 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.
-
-Use this together with the `config-file' form in the `:command'
-argument to `flycheck-define-checker'."
- (declare (indent 3))
- `(progn
- (put ',checker 'flycheck-config-file-var ',symbol)
- (defcustom ,symbol ,file-name
- ,(format "Configuration file for `%s'.
-
-If set to a string, locate the configuration file using the
-functions from `flycheck-locate-config-file-functions'. If the
-file is found pass it to the syntax checker as configuration
-file.
-
-If no configuration file is found, or if this variable is set to
-nil, invoke the syntax checker without a configuration file.
-
-Use this variable as file-local variable if you need a specific
-configuration file a buffer." checker)
- :type '(choice (const :tag "No configuration file" nil)
- (string :tag "File name or path"))
- :group 'flycheck-config-files
- ,@custom-args)))
-
-(defun flycheck-checker-config-file-var (checker)
- "Get the associated configuration file variable of CHECKER.
-
-Return nil if CHECKER has no associated configuration file
-variable."
- (get checker 'flycheck-config-file-var))
-
-(defun flycheck-checker-option-vars (checker)
- "Get the associated option variables of CHECKER.
-
-Return a (possibly empty) list of variable symbols."
- (get checker 'flycheck-option-vars))
-
-(defun flycheck-locate-config-file (filename checker)
- "Locate the configuration file FILENAME for CHECKER.
-
-Locate the configuration file using
-`flycheck-locate-config-file-functions'.
-
-Return the absolute path of the configuration file, or nil if no
-configuration file was found."
- (-when-let (filepath (run-hook-with-args-until-success
- 'flycheck-locate-config-file-functions
- filename checker))
- (when (file-exists-p filepath)
- filepath)))
-
-(defun flycheck-locate-config-file-absolute-path (filepath _checker)
- "Locate a configuration file by a FILEPATH.
-
-If FILEPATH is a contains a path separator, expand it against the
-default directory and return it. Otherwise return nil.
-
-_CHECKER is ignored."
- ;; If the path is just a plain file name, skip it.
- (unless (string= (file-name-nondirectory filepath) filepath)
- (expand-file-name filepath)))
-
-(defun flycheck-locate-config-file-ancestor-directories (filename _checker)
- "Locate a configuration FILENAME in ancestor directories.
-
-If the current buffer has a file name, search FILENAME in the
-directory of the current buffer and all ancestors thereof (see
-`locate-dominating-file'). If the file is found, return its
-absolute path. Otherwise return nil.
-
-_CHECKER is ignored."
- (-when-let* ((basefile (buffer-file-name))
- (directory (locate-dominating-file basefile filename)))
- (expand-file-name filename directory)))
-
-(defun flycheck-locate-config-file-home (filename _checker)
- "Locate a configuration FILENAME in the home directory.
-
-Return the absolute path, if FILENAME exists in the user's home
-directory, or nil otherwise."
- (let ((path (expand-file-name filename "~")))
- (when (file-exists-p path)
- path)))
-
-(mapc (apply-partially #'custom-add-frequent-value
- 'flycheck-locate-config-file-functions)
- '(flycheck-locate-config-file-absolute-path
- flycheck-locate-config-file-ancestor-directories
- flycheck-locate-config-file-home))
-
-;;;###autoload
-(defmacro flycheck-def-option-var (symbol init-value checker docstring
- &rest custom-args)
- "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 CHECKER. 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'."
- (declare (indent 3)
- (doc-string 4))
- `(progn
- (let ((options (flycheck-checker-option-vars ',checker)))
- (unless (memq ',symbol options)
- (put ',checker 'flycheck-option-vars (cons ',symbol options))))
- (defcustom ,symbol ,init-value
- ,(format "%s
-
-This variable is an option for the syntax checker `%s'." docstring checker)
- :group 'flycheck-options
- ,@custom-args)))
-
-(defun flycheck-option-int (value)
- "Convert an integral option VALUE to a string.
-
-If VALUE is nil, return nil. Otherwise return VALUE converted to
-a string."
- (when value
- (number-to-string value)))
-
-(defun flycheck-option-comma-separated-list (value &optional separator filter)
- "Convert VALUE into a list separated by SEPARATOR.
-
-SEPARATOR is a string to separate items in VALUE, defaulting to
-\",\". FILTER is an optional function, which takes a single
-argument and returns either a string or nil.
-
-If VALUE is a list, apply FILTER to each item in VALUE, remove
-all nil items, and return a single string of all remaining items
-separated by SEPARATOR.
-
-Otherwise, apply FILTER to VALUE and return the result.
-SEPARATOR is ignored in this case."
- (let ((filter (or filter #'identity))
- (separator (or separator ",")))
- (if (listp value)
- (-when-let (value (delq nil (mapcar filter value)))
- (string-join value separator))
- (funcall filter value))))
-
-(defmacro flycheck-def-args-var (symbol checker &rest custom-args)
- "Define SYMBOL as argument variable for CHECKER.
-
-SYMBOL is declared as customizable, risky and buffer-local
-variable using `defcustom' to provide an option for arbitrary
-arguments for the given syntax CHECKER. CUSTOM-ARGS is forwarded
-to `defcustom'.
-
-Use the `eval' form to splice this variable into the
-`:command'."
- (declare (indent 2))
- `(flycheck-def-option-var ,symbol nil ,checker
- ,(format "A list of additional arguments for `%s'.
-
-The value of this variable is a list of strings with additional
-command line arguments." checker)
- :risky t
- :type '(repeat (string :tag "Argument"))
- ,@custom-args))
-
-\f
-;;; Command syntax checkers as compile commands
-(defun flycheck-checker-pattern-to-error-regexp (pattern)
- "Convert PATTERN into an error regexp for compile.el.
-
-Return a list representing PATTERN, suitable as element in
-`compilation-error-regexp-alist'."
- (let* ((regexp (car pattern))
- (level (cdr pattern))
- (level-no (pcase level
- (`error 2)
- (`warning 1)
- (`info 0))))
- (list regexp 1 2 3 level-no)))
-
-(defun flycheck-checker-compilation-error-regexp-alist (checker)
- "Convert error patterns of CHECKER for use with compile.el.
-
-Return an alist of all error patterns of CHECKER, suitable for
-use with `compilation-error-regexp-alist'."
- (mapcar #'flycheck-checker-pattern-to-error-regexp
- (flycheck-checker-error-patterns checker)))
-
-(defun flycheck-checker-shell-command (checker)
- "Get a shell command for CHECKER.
-
-Perform substitution in the arguments of CHECKER, but with
-`flycheck-substitute-shell-argument'.
-
-Return the command of CHECKER as single string, suitable for
-shell execution."
- ;; Note: Do NOT use `combine-and-quote-strings' here. Despite it's name it
- ;; does not properly quote shell arguments, and actually breaks for special
- ;; characters. See https://github.com/flycheck/flycheck/pull/522
- (mapconcat
- #'shell-quote-argument
- (cons (flycheck-checker-executable checker)
- (apply #'append
- (mapcar (lambda (arg)
- (if (memq arg '(source source-inplace source-original))
- (list (or (buffer-file-name) ""))
- (flycheck-substitute-argument arg checker)))
- (flycheck-checker-arguments checker)))) " "))
-
-(defun flycheck-compile-name (_name)
- "Get a name for a Flycheck compilation buffer.
-
-_NAME is ignored."
- (format "*Flycheck %s*" (buffer-file-name)))
-
-(defun flycheck-compile (checker)
- "Run CHECKER via `compile'.
-
-CHECKER must be a valid syntax checker. Interactively, prompt
-for a syntax checker to run.
-
-Instead of highlighting errors in the buffer, this command pops
-up a separate buffer with the entire output of the syntax checker
-tool, just like `compile' (\\[compile])."
- (interactive
- (let ((default (flycheck-get-checker-for-buffer)))
- (list (read-flycheck-checker "Run syntax checker as compile command: "
- (when (get default 'flycheck-command) default)
- 'flycheck-command))))
- (unless (flycheck-valid-checker-p checker)
- (user-error "%S is not a valid syntax checker" checker))
- (unless (buffer-file-name)
- (user-error "Cannot compile buffers without backing file"))
- (unless (flycheck-may-use-checker checker)
- (user-error "Cannot use syntax checker %S in this buffer" checker))
- (unless (flycheck-checker-executable checker)
- (user-error "Cannot run checker %S as shell command" checker))
- (let* ((command (flycheck-checker-shell-command checker))
- (buffer (compilation-start command nil #'flycheck-compile-name)))
- (with-current-buffer buffer
- (set (make-local-variable 'compilation-error-regexp-alist)
- (flycheck-checker-compilation-error-regexp-alist checker)))))
-
-\f
-;;; General error parsing for command checkers
-(defun flycheck-parse-output (output checker buffer)
- "Parse OUTPUT from CHECKER in BUFFER.
-
-OUTPUT is a string with the output from the checker symbol
-CHECKER. BUFFER is the buffer which was checked.
-
-Return the errors parsed with the error patterns of CHECKER."
- (funcall (flycheck-checker-error-parser checker) output checker buffer))
-
-(defun flycheck-fix-error-filename (err buffer-files)
- "Fix the file name of ERR from BUFFER-FILES.
-
-Make the file name of ERR absolute. If the absolute file name of
-ERR is in BUFFER-FILES, replace it with the return value of the
-function `buffer-file-name'."
- (flycheck-error-with-buffer err
- (-when-let (filename (flycheck-error-filename err))
- (setq filename (expand-file-name filename))
- (when (-any? (apply-partially #'flycheck-same-files-p filename)
- buffer-files)
- (setq filename (buffer-file-name)))
- (setf (flycheck-error-filename err) filename)))
- err)
-
-\f
-;;; Error parsers for command syntax checkers
-(defun flycheck-parse-xml-region (beg end)
- "Parse the xml region between BEG and END.
-
-Wrapper around `xml-parse-region' which transforms the return
-value of this function into one compatible to
-`libxml-parse-xml-region' by simply returning the first element
-from the node list."
- (car (xml-parse-region beg end)))
-
-(defvar flycheck-xml-parser
- (if (fboundp 'libxml-parse-xml-region)
- 'libxml-parse-xml-region 'flycheck-parse-xml-region)
- "Parse an xml string from a region.
-
-Use libxml if Emacs is built with libxml support. Otherwise fall
-back to `xml-parse-region', via `flycheck-parse-xml-region'.")
-
-(defun flycheck-parse-xml-string (xml)
- "Parse an XML string.
-
-Return the document tree parsed from XML in the form `(ROOT ATTRS
-BODY...)'. ROOT is a symbol identifying the name of the root
-element. ATTRS is an alist of the attributes of the root node.
-BODY is zero or more body elements, either as strings (in case of
-text nodes) or as XML nodes, in the same for as the root node."
- (with-temp-buffer
- (insert xml)
- (funcall flycheck-xml-parser (point-min) (point-max))))
-
-(defun flycheck-parse-checkstyle (output checker buffer)
- "Parse Checkstyle errors from OUTPUT.
-
-Parse Checkstyle-like XML output. Use this error parser for
-checkers that have an option to output errors in this format.
-
-See URL `http://checkstyle.sourceforge.net/' for information
-about Checkstyle."
- (pcase (flycheck-parse-xml-string output)
- (`(checkstyle ,_ . ,file-nodes)
- (let (errors)
- (dolist (node file-nodes)
- (pcase node
- (`(file ,file-attrs . ,error-nodes)
- (dolist (node error-nodes)
- (pcase node
- (`(error ,error-attrs . ,_)
- (let-alist error-attrs
- (push (flycheck-error-new-at
- (flycheck-string-to-number-safe .line)
- (flycheck-string-to-number-safe .column)
- (pcase .severity
- (`"error" 'error)
- (`"warning" 'warning)
- (`"info" 'info)
- ;; Default to error for unknown .severity
- (_ 'error))
- .message
- :checker checker :id .source
- :buffer buffer
- :filename (cdr (assq 'name file-attrs)))
- errors))))))))
- (nreverse errors)))))
-
-(defun flycheck-parse-cppcheck (output checker buffer)
- "Parse Cppcheck errors from OUTPUT.
-
-Parse Cppcheck XML v2 output.
-
-See URL `http://cppcheck.sourceforge.net/' for more information
-about Cppcheck."
- (pcase (flycheck-parse-xml-string output)
- (`(results ,_ . ,body)
- (let (errors)
- (dolist (node body)
- (pcase node
- (`(errors ,_ . ,error-nodes)
- (dolist (node error-nodes)
- (pcase node
- (`(error ,error-attrs . ,loc-nodes)
- (let ((id (cdr (assq 'id error-attrs)))
- (message (cdr (assq 'verbose error-attrs)))
- (level (pcase (cdr (assq 'severity error-attrs))
- (`"error" 'error)
- (`"style" 'info)
- (`"information" 'info)
- (_ 'warning))))
- (dolist (node loc-nodes)
- (pcase node
- (`(location ,loc-attrs . ,_)
- (let-alist loc-attrs
- (push (flycheck-error-new-at
- (flycheck-string-to-number-safe .line)
- nil
- level message
- :id id
- :checker checker
- :buffer buffer
- :filename .file)
- errors))))))))))))
- (nreverse errors)))))
-
-(defun flycheck-parse-phpmd (output checker buffer)
- "Parse phpmd errors from OUTPUT.
-
-See URL `http://phpmd.org/' for more information about phpmd."
- (pcase (flycheck-parse-xml-string output)
- (`(pmd ,_ . ,body)
- (let (errors)
- (dolist (node body)
- (pcase node
- (`(file ,file-attrs . ,violation-nodes)
- (let ((filename (cdr (assq 'name file-attrs))))
- (dolist (node violation-nodes)
- (pcase node
- (`(violation ,vio-attrs ,(and message (pred stringp)))
- (let-alist vio-attrs
- ;; TODO: Map priority to an error level?
- ;; TODO: Respect endline
- (push
- (flycheck-error-new-at
- (flycheck-string-to-number-safe .beginline)
- nil
- 'warning (string-trim message)
- :id .rule
- :checker checker
- :buffer buffer
- :filename filename)
- errors)))))))))
- (nreverse errors)))))
-
-\f
-;;; Error parsing with regular expressions
-(defun flycheck-get-regexp (patterns)
- "Create a single regular expression from PATTERNS."
- (rx-to-string `(or ,@(mapcar (lambda (p) (list 'regexp (car p))) patterns))
- 'no-group))
-
-(defun flycheck-tokenize-output-with-patterns (output patterns)
- "Tokenize OUTPUT with PATTERNS.
-
-Split the output into error tokens, using all regular expressions
-from the error PATTERNS. An error token is simply a string
-containing a single error from OUTPUT. Such a token can then be
-parsed into a structured error by applying the PATTERNS again,
-see `flycheck-parse-errors-with-patterns'.
-
-Return a list of error tokens."
- (let ((regexp (flycheck-get-regexp patterns))
- (last-match 0)
- errors)
- (while (string-match regexp output last-match)
- (push (match-string 0 output) errors)
- (setq last-match (match-end 0)))
- (reverse errors)))
-
-(defun flycheck-try-parse-error-with-pattern (err pattern checker)
- "Try to parse a single ERR with a PATTERN for CHECKER.
-
-Return the parsed error if PATTERN matched ERR, or nil
-otherwise."
- (let ((regexp (car pattern))
- (level (cdr pattern)))
- (when (string-match regexp err)
- (let ((filename (match-string 1 err))
- (line (match-string 2 err))
- (column (match-string 3 err))
- (message (match-string 4 err))
- (id (match-string 5 err)))
- (flycheck-error-new-at
- (flycheck-string-to-number-safe line)
- (flycheck-string-to-number-safe column)
- level
- (unless (string-empty-p message) message)
- :id (unless (string-empty-p id) id)
- :checker checker
- :filename (if (or (null filename) (string-empty-p filename))
- (buffer-file-name)
- filename))))))
-
-(defun flycheck-parse-error-with-patterns (err patterns checker)
- "Parse a gle ERR with error PATTERNS for CHECKER.
-
-Apply each pattern in PATTERNS to ERR, in the given order, and
-return the first parsed error."
- ;; Try to parse patterns in the order of declaration to make sure that the
- ;; first match wins.
- (let (parsed-error)
- (while (and patterns
- (not (setq parsed-error
- (flycheck-try-parse-error-with-pattern
- err (car patterns) checker))))
- (setq patterns (cdr patterns)))
- parsed-error))
-
-(defun flycheck-parse-with-patterns (output checker buffer)
- "Parse OUTPUT from CHECKER with error patterns.
-
-Uses the error patterns of CHECKER to tokenize the output and
-tries to parse each error token with all patterns, in the order
-of declaration. Hence an error is never matched twice by two
-different patterns. The pattern declared first always wins.
-
-_BUFFER is ignored.
-
-Return a list of parsed errors and warnings (as `flycheck-error'
-objects)."
- (with-current-buffer buffer
- (let ((patterns (flycheck-checker-error-patterns checker)))
- (mapcar (lambda (err)
- (flycheck-parse-error-with-patterns err patterns checker))
- (flycheck-tokenize-output-with-patterns output patterns)))))
-
-\f
-;;; Convenience definition of command-syntax checkers
-(defmacro flycheck-define-checker (symbol docstring &rest properties)
- "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'."
- (declare (indent 1)
- (doc-string 2))
- (let ((command (plist-get properties :command))
- (parser (plist-get properties :error-parser))
- (filter (plist-get properties :error-filter))
- (predicate (plist-get properties :predicate)))
-
- `(progn
- (flycheck-def-executable-var ,symbol ,(car command))
-
- (flycheck-define-command-checker ',symbol
- ,docstring
- :command ',command
- ,@(when parser
- `(:error-parser #',parser))
- :error-patterns ',(plist-get properties :error-patterns)
- ,@(when filter
- `(:error-filter #',filter))
- :modes ',(plist-get properties :modes)
- ,@(when predicate
- `(:predicate #',predicate))
- :next-checkers ',(plist-get properties :next-checkers)))))
-
-\f
-;;; Built-in checkers
-(flycheck-def-args-var flycheck-gnat-args ada-gnat
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gnat-include-path nil ada-gnat
- "A list of include directories for GNAT.
-
-The value of this variable is a list of strings, where each
-string is a directory to add to the include path of gcc.
-Relative paths are relative to the file being checked."
- :type '(repeat (directory :tag "Include directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gnat-language-standard "2012" ada-gnat
- "The language standard to use in GNAT.
-
-The value of this variable is either a string denoting a language
-standard, or nil, to use the default standard. When non-nil, pass
-the language standard via the `-std' option."
- :type '(choice (const :tag "Default standard" nil)
- (string :tag "Language standard"))
- :safe #'stringp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gnat-warnings
- '("wa") ada-gnat
- "A list of additional Ada warnings to enable in GNAT.
-
-The value of this variable is a list of strings, where each
-string is the name of a warning category to enable. By default,
-most optional warnings are recommended, as in `-gnata'.
-
-Refer to Info Node `(gnat_ugn_unw)Warning Message Control' for
-more information about GNAT warnings."
- :type '(repeat :tag "Warnings" (string :tag "Warning name"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.20"))
-
-(flycheck-define-checker ada-gnat
- "An Ada syntax checker using GNAT.
-
-Uses the GNAT compiler from GCC. See URL
-`https://gcc.gnu.org/onlinedocs/gnat_ugn_unw/'."
- :command ("gnatmake"
- "-c" ; Just compile, don't bind
- "-f" ; Force re-compilation
- "-u" ; Compile the main file only
- "-gnatf" ; Full error information
- "-gnatef" ; Full source file name
- "-D" temporary-directory
- (option-list "-gnat" flycheck-gnat-warnings concat)
- (option-list "-I" flycheck-gnat-include-path concat)
- (option "-gnat" flycheck-gnat-language-standard concat)
- (eval flycheck-gnat-args)
- source)
- :error-patterns
- ((error line-start
- (message "In file included from") " " (file-name) ":" line ":"
- column ":"
- line-end)
- (info line-start (file-name) ":" line ":" column
- ": note: " (message) line-end)
- (warning line-start (file-name) ":" line ":" column
- ": warning: " (message) line-end)
- (error line-start (file-name) ":" line ":" column ;no specific error prefix in Ada
- ": " (message) line-end))
- :modes ada-mode)
-
-(flycheck-define-checker asciidoc
- "A AsciiDoc syntax checker using the AsciiDoc compiler.
-
-See URL `http://www.methods.co.nz/asciidoc'."
- :command ("asciidoc" source)
- :error-patterns
- ((error line-start "asciidoc: ERROR: " (file-name)
- ": Line " line ": " (message) line-end)
- (warning line-start "asciidoc: " (or "WARNING" "DEPRECATED") ": " (file-name)
- ": Line " line ": " (message) line-end))
- :modes adoc-mode)
-
-(flycheck-def-args-var flycheck-clang-args c/c++-clang
- :package-version '(flycheck . "0.22"))
-
-(flycheck-def-option-var flycheck-clang-blocks nil c/c++-clang
- "Enable blocks in Clang.
-
-When non-nil, enable blocks in Clang with `-fblocks'. See URL
-`http://clang.llvm.org/docs/BlockLanguageSpec.html' for more
-information about blocks."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-clang-definitions nil c/c++-clang
- "Additional preprocessor definitions for Clang.
-
-The value of this variable is a list of strings, where each
-string is an additional definition to pass to Clang, via the `-D'
-option."
- :type '(repeat (string :tag "Definition"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.15"))
-
-(flycheck-def-option-var flycheck-clang-include-path nil c/c++-clang
- "A list of include directories for Clang.
-
-The value of this variable is a list of strings, where each
-string is a directory to add to the include path of Clang.
-Relative paths are relative to the file being checked."
- :type '(repeat (directory :tag "Include directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.14"))
-
-(flycheck-def-option-var flycheck-clang-includes nil c/c++-clang
- "A list of additional include files for Clang.
-
-The value of this variable is a list of strings, where each
-string is a file to include before syntax checking. Relative
-paths are relative to the file being checked."
- :type '(repeat (file :tag "Include file"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.15"))
-
-(flycheck-def-option-var flycheck-clang-language-standard nil c/c++-clang
- "The language standard to use in Clang.
-
-The value of this variable is either a string denoting a language
-standard, or nil, to use the default standard. When non-nil,
-pass the language standard via the `-std' option."
- :type '(choice (const :tag "Default standard" nil)
- (string :tag "Language standard"))
- :safe #'stringp
- :package-version '(flycheck . "0.15"))
-(make-variable-buffer-local 'flycheck-clang-language-standard)
-
-(flycheck-def-option-var flycheck-clang-ms-extensions nil c/c++-clang
- "Whether to enable Microsoft extensions to C/C++ in Clang.
-
-When non-nil, enable Microsoft extensions to C/C++ via
-`-fms-extensions'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.16"))
-
-(flycheck-def-option-var flycheck-clang-no-exceptions nil c/c++-clang
- "Whether to disable exceptions in Clang.
-
-When non-nil, disable exceptions for syntax checks, via
-`-fno-exceptions'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-clang-no-rtti nil c/c++-clang
- "Whether to disable RTTI in Clang.
-
-When non-nil, disable RTTI for syntax checks, via `-fno-rtti'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.15"))
-
-(flycheck-def-option-var flycheck-clang-pedantic nil c/c++-clang
- "Whether to warn about language extensions in Clang.
-
-For ISO C, follows the version specified by any -std option used.
-When non-nil, disable non-ISO extensions to C/C++ via
-`-pedantic'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.23"))
-
-(flycheck-def-option-var flycheck-clang-pedantic-errors nil c/c++-clang
- "Whether to error on language extensions in Clang.
-
-For ISO C, follows the version specified by any -std option used.
-When non-nil, disable non-ISO extensions to C/C++ via
-`-pedantic-errors'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.23"))
-
-(flycheck-def-option-var flycheck-clang-standard-library nil c/c++-clang
- "The standard library to use for Clang.
-
-The value of this variable is the name of a standard library as
-string, or nil to use the default standard library.
-
-Refer to the Clang manual at URL
-`http://clang.llvm.org/docs/UsersManual.html' for more
-information about the standard library."
- :type '(choice (const "libc++")
- (const :tag "GNU libstdc++" "libstdc++")
- (string :tag "Library name"))
- :safe #'stringp
- :package-version '(flycheck . "0.15"))
-
-(flycheck-def-option-var flycheck-clang-warnings '("all" "extra") c/c++-clang
- "A list of additional warnings to enable in Clang.
-
-The value of this variable is a list of strings, where each string
-is the name of a warning category to enable. By default, all
-recommended warnings and some extra warnings are enabled (as by
-`-Wall' and `-Wextra' respectively).
-
-Refer to the Clang manual at URL
-`http://clang.llvm.org/docs/UsersManual.html' for more
-information about warnings."
- :type '(choice (const :tag "No additional warnings" nil)
- (repeat :tag "Additional warnings"
- (string :tag "Warning name")))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.14"))
-
-(defun flycheck-c/c++-quoted-include-directory ()
- "Get the directory for quoted includes.
-
-C/C++ compiles typicall look up includes with quotation marks in
-the directory of the file being compiled. However, since
-Flycheck uses temporary copies for syntax checking, it needs to
-explicitly determine the directory for quoted includes.
-
-This function determines the directory by looking at
-`buffer-file-name', or if that is nil, at `default-directory'."
- (-if-let (fn (buffer-file-name))
- (file-name-directory fn)
- ;; If the buffer has no file name, fall back to its default directory
- default-directory))
-
-(flycheck-define-checker c/c++-clang
- "A C/C++ syntax checker using Clang.
-
-See URL `http://clang.llvm.org/'."
- :command ("clang"
- "-fsyntax-only"
- "-fno-color-diagnostics" ; Do not include color codes in output
- "-fno-caret-diagnostics" ; Do not visually indicate the source
- ; location
- "-fno-diagnostics-show-option" ; Do not show the corresponding
- ; warning group
- "-iquote" (eval (flycheck-c/c++-quoted-include-directory))
- (option "-std=" flycheck-clang-language-standard concat)
- (option-flag "-pedantic" flycheck-clang-pedantic)
- (option-flag "-pedantic-errors" flycheck-clang-pedantic-errors)
- (option "-stdlib=" flycheck-clang-standard-library concat)
- (option-flag "-fms-extensions" flycheck-clang-ms-extensions)
- (option-flag "-fno-exceptions" flycheck-clang-no-exceptions)
- (option-flag "-fno-rtti" flycheck-clang-no-rtti)
- (option-flag "-fblocks" flycheck-clang-blocks)
- (option-list "-include" flycheck-clang-includes)
- (option-list "-W" flycheck-clang-warnings concat)
- (option-list "-D" flycheck-clang-definitions concat)
- (option-list "-I" flycheck-clang-include-path)
- (eval flycheck-clang-args)
- "-x" (eval
- (pcase major-mode
- (`c++-mode "c++")
- (`c-mode "c")))
- source)
- :error-patterns
- ((error line-start
- (message "In file included from") " " (file-name) ":" line ":"
- line-end)
- (info line-start (file-name) ":" line ":" column
- ": note: " (optional (message)) line-end)
- (warning line-start (file-name) ":" line ":" column
- ": warning: " (optional (message)) line-end)
- (error line-start (file-name) ":" line ":" column
- ": " (or "fatal error" "error") ": " (optional (message)) line-end))
- :error-filter
- (lambda (errors)
- (let ((errors (flycheck-sanitize-errors errors)))
- (dolist (err errors)
- ;; Clang will output empty messages for #error/#warning pragmas without
- ;; messages. We fill these empty errors with a dummy message to get
- ;; them past our error filtering
- (setf (flycheck-error-message err)
- (or (flycheck-error-message err) "no message")))
- (flycheck-fold-include-levels errors "In file included from")))
- :modes (c-mode c++-mode)
- :next-checkers ((warning . c/c++-cppcheck)))
-
-(flycheck-def-args-var flycheck-gcc-args c/c++-gcc
- :package-version '(flycheck . "0.22"))
-
-(flycheck-def-option-var flycheck-gcc-definitions nil c/c++-gcc
- "Additional preprocessor definitions for GCC.
-
-The value of this variable is a list of strings, where each
-string is an additional definition to pass to GCC, via the `-D'
-option."
- :type '(repeat (string :tag "Definition"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gcc-include-path nil c/c++-gcc
- "A list of include directories for GCC.
-
-The value of this variable is a list of strings, where each
-string is a directory to add to the include path of gcc.
-Relative paths are relative to the file being checked."
- :type '(repeat (directory :tag "Include directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gcc-includes nil c/c++-gcc
- "A list of additional include files for GCC.
-
-The value of this variable is a list of strings, where each
-string is a file to include before syntax checking. Relative
-paths are relative to the file being checked."
- :type '(repeat (file :tag "Include file"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gcc-language-standard nil c/c++-gcc
- "The language standard to use in GCC.
-
-The value of this variable is either a string denoting a language
-standard, or nil, to use the default standard. When non-nil,
-pass the language standard via the `-std' option."
- :type '(choice (const :tag "Default standard" nil)
- (string :tag "Language standard"))
- :safe #'stringp
- :package-version '(flycheck . "0.20"))
-(make-variable-buffer-local 'flycheck-gcc-language-standard)
-
-(flycheck-def-option-var flycheck-gcc-no-exceptions nil c/c++-gcc
- "Whether to disable exceptions in GCC.
-
-When non-nil, disable exceptions for syntax checks, via
-`-fno-exceptions'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gcc-no-rtti nil c/c++-gcc
- "Whether to disable RTTI in GCC.
-
-When non-nil, disable RTTI for syntax checks, via `-fno-rtti'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gcc-openmp nil c/c++-gcc
- "Whether to enable OpenMP in GCC.
-
-When non-nil, enable OpenMP for syntax checkers, via
-`-fopenmp'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.21"))
-
-(flycheck-def-option-var flycheck-gcc-pedantic nil c/c++-clang
- "Whether to warn about language extensions in GCC.
-
-For ISO C, follows the version specified by any -std option used.
-When non-nil, disable non-ISO extensions to C/C++ via
-`-pedantic'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.23"))
-
-(flycheck-def-option-var flycheck-gcc-pedantic-errors nil c/c++-clang
- "Whether to error on language extensions in GCC.
-
-For ISO C, follows the version specified by any -std option used.
-When non-nil, disable non-ISO extensions to C/C++ via
-`-pedantic-errors'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.23"))
-
-(flycheck-def-option-var flycheck-gcc-warnings '("all" "extra") c/c++-gcc
- "A list of additional warnings to enable in GCC.
-
-The value of this variable is a list of strings, where each string
-is the name of a warning category to enable. By default, all
-recommended warnings and some extra warnings are enabled (as by
-`-Wall' and `-Wextra' respectively).
-
-Refer to the gcc manual at URL
-`https://gcc.gnu.org/onlinedocs/gcc/' for more information about
-warnings."
- :type '(choice (const :tag "No additional warnings" nil)
- (repeat :tag "Additional warnings"
- (string :tag "Warning name")))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.20"))
-
-(flycheck-define-checker c/c++-gcc
- "A C/C++ syntax checker using GCC.
-
-Requires GCC 4.8 or newer. See URL `https://gcc.gnu.org/'."
- :command ("gcc"
- "-fshow-column"
- "-fno-diagnostics-show-caret" ; Do not visually indicate the source location
- "-fno-diagnostics-show-option" ; Do not show the corresponding
- ; warning group
- "-iquote" (eval (flycheck-c/c++-quoted-include-directory))
- (option "-std=" flycheck-gcc-language-standard concat)
- (option-flag "-pedantic" flycheck-gcc-pedantic)
- (option-flag "-pedantic-errors" flycheck-gcc-pedantic-errors)
- (option-flag "-fno-exceptions" flycheck-gcc-no-exceptions)
- (option-flag "-fno-rtti" flycheck-gcc-no-rtti)
- (option-flag "-fopenmp" flycheck-gcc-openmp)
- (option-list "-include" flycheck-gcc-includes)
- (option-list "-W" flycheck-gcc-warnings concat)
- (option-list "-D" flycheck-gcc-definitions concat)
- (option-list "-I" flycheck-gcc-include-path)
- (eval flycheck-gcc-args)
- "-x" (eval
- (pcase major-mode
- (`c++-mode "c++")
- (`c-mode "c")))
- source
- ;; GCC performs full checking only when actually compiling, so
- ;; `-fsyntax-only' is not enough. Just let it generate assembly
- ;; code.
- "-S" "-o" null-device)
- :error-patterns
- ((error line-start
- (message "In file included from") " " (file-name) ":" line ":"
- column ":"
- line-end)
- (info line-start (file-name) ":" line ":" column
- ": note: " (message) line-end)
- (warning line-start (file-name) ":" line ":" column
- ": warning: " (message) line-end)
- (error line-start (file-name) ":" line ":" column
- ": " (or "fatal error" "error") ": " (message) line-end))
- :error-filter
- (lambda (errors)
- (flycheck-fold-include-levels (flycheck-sanitize-errors errors)
- "In file included from"))
- :modes (c-mode c++-mode)
- :next-checkers ((warning . c/c++-cppcheck)))
-
-(flycheck-def-option-var flycheck-cppcheck-checks '("style") c/c++-cppcheck
- "Enabled checks for Cppcheck.
-
-The value of this variable is a list of strings, where each
-string is the name of an additional check to enable. By default,
-all coding style checks are enabled.
-
-See section \"Enable message\" in the Cppcheck manual at URL
-`http://cppcheck.sourceforge.net/manual.pdf', and the
-documentation of the `--enable' option for more information,
-including a list of supported checks."
- :type '(repeat :tag "Additional checks"
- (string :tag "Check name"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.14"))
-
-(flycheck-def-option-var flycheck-cppcheck-inconclusive nil c/c++-cppcheck
- "Whether to enable Cppcheck inconclusive checks.
-
-When non-nil, enable Cppcheck inconclusive checks. This allows Cppcheck to
-report warnings it's not certain of, but it may result in false positives.
-
-This will have no effect when using Cppcheck 1.53 and older."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.19"))
-
-(flycheck-define-checker c/c++-cppcheck
- "A C/C++ checker using cppcheck.
-
-See URL `http://cppcheck.sourceforge.net/'."
- :command ("cppcheck" "--quiet" "--xml-version=2" "--inline-suppr"
- (option "--enable=" flycheck-cppcheck-checks concat
- flycheck-option-comma-separated-list)
- (option-flag "--inconclusive" flycheck-cppcheck-inconclusive)
- source)
- :error-parser flycheck-parse-cppcheck
- :modes (c-mode c++-mode))
-
-(flycheck-define-checker cfengine
- "A CFEngine syntax checker using cf-promises.
-
-See URL `http://cfengine.com/'."
- :command ("cf-promises" "-Wall" "-f"
- ;; We must stay in the same directory to resolve @include
- source-inplace)
- :error-patterns
- ((warning line-start (file-name) ":" line ":" column
- ": warning: " (message) line-end)
- (error line-start (file-name) ":" line ":" column
- ": error: " (message) line-end))
- :modes (cfengine-mode cfengine3-mode))
-
-(flycheck-def-option-var flycheck-foodcritic-tags nil chef-foodcritic
- "A list of tags to select for Foodcritic.
-
-The value of this variable is a list of strings where each string
-is a tag expression describing Foodcritic rules to enable or
-disable, via the `--tags' option. To disable a tag, prefix it
-with `~'."
- :type '(repeat :tag "Tags" (string :tag "Tag expression"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.23"))
-
-(flycheck-define-checker chef-foodcritic
- "A Chef cookbooks syntax checker using Foodcritic.
-
-See URL `http://acrmp.github.io/foodcritic/'."
- ;; Use `source-inplace' to allow resource discovery with relative paths.
- ;; foodcritic interprets these as relative to the source file, so we need to
- ;; stay within the source tree. See
- ;; https://github.com/flycheck/flycheck/pull/556
- :command ("foodcritic"
- (option-list "--tags" flycheck-foodcritic-tags)
- source-inplace)
- :error-patterns
- ((error line-start (message) ": " (file-name) ":" line line-end))
- :modes (enh-ruby-mode ruby-mode)
- :predicate
- (lambda ()
- (let ((parent-dir (file-name-directory
- (directory-file-name
- (expand-file-name default-directory)))))
- (or
- ;; Chef CookBook
- ;; http://docs.opscode.com/chef/knife.html#id38
- (locate-dominating-file parent-dir "recipes")
- ;; Knife Solo
- ;; http://matschaffer.github.io/knife-solo/#label-Init+command
- (locate-dominating-file parent-dir "cookbooks")))))
-
-(flycheck-define-checker coffee
- "A CoffeeScript syntax checker using coffee.
-
-See URL `http://coffeescript.org/'."
- ;; --print suppresses generation of compiled .js files
- :command ("coffee" "--compile" "--print" source)
- :error-patterns
- ((error line-start (file-name) ":" line ":" column
- ": error: " (message) line-end))
- :modes coffee-mode
- :next-checkers ((warning . coffee-coffeelint)))
-
-(flycheck-def-config-file-var flycheck-coffeelintrc coffee-coffeelint
- ".coffeelint.json"
- :safe #'stringp)
-
-(flycheck-define-checker coffee-coffeelint
- "A CoffeeScript style checker using coffeelint.
-
-This syntax checker requires coffeelint 1.0 or newer.
-
-See URL `http://www.coffeelint.org/'."
- :command
- ("coffeelint"
- (config-file "--file" flycheck-coffeelintrc)
- "--reporter" "checkstyle" source)
- :error-parser flycheck-parse-checkstyle
- :error-filter (lambda (errors)
- (flycheck-remove-error-ids
- (flycheck-sanitize-errors errors)))
- :modes coffee-mode)
-
-(flycheck-define-checker coq
- "A Coq syntax checker using the Coq compiler.
-
-See URL `http://coq.inria.fr/'."
- ;; We use coqtop in batch mode, because coqc is picky about file names.
- :command ("coqtop" "-batch" "-load-vernac-source" source)
- :error-patterns
- ((error line-start "File \"" (file-name) "\", line " line
- ;; TODO: Parse the end column, once Flycheck supports that
- ", characters " column "-" (one-or-more digit) ":\n"
- (or "Syntax error: " "Error: ")
- ;; Most Coq error messages span multiple lines, and end with a dot.
- ;; There are simple one-line messages, too, though.
- (message (or (and (one-or-more (or not-newline "\n")) ".")
- (one-or-more not-newline)))
- line-end))
- :error-filter
- (lambda (errors)
- (dolist (err errors)
- (setf (flycheck-error-message err)
- (replace-regexp-in-string (rx (1+ (syntax whitespace)) line-end)
- "" (flycheck-error-message err)
- 'fixedcase 'literal)))
- (flycheck-increment-error-columns errors))
- :modes coq-mode)
-
-(flycheck-define-checker css-csslint
- "A CSS syntax and style checker using csslint.
-
-See URL `https://github.com/CSSLint/csslint'."
- :command ("csslint" "--format=checkstyle-xml" source)
- :error-parser flycheck-parse-checkstyle
- :error-filter flycheck-dequalify-error-ids
- :modes css-mode)
-
-(defconst flycheck-d-module-re
- (rx "module" (one-or-more (syntax whitespace))
- (group (one-or-more (not (syntax whitespace))))
- (zero-or-more (syntax whitespace))
- ";")
- "Regular expression to match a D module declaration.")
-
-(defun flycheck-d-base-directory ()
- "Get the relative base directory path for this module."
- (let* ((file-name (buffer-file-name))
- (module-file (if (string= (file-name-nondirectory file-name)
- "package.d")
- (directory-file-name (file-name-directory file-name))
- file-name)))
- (flycheck-module-root-directory
- (flycheck-find-in-buffer flycheck-d-module-re)
- module-file)))
-
-(flycheck-def-option-var flycheck-dmd-include-path nil d-dmd
- "A list of include directories for dmd.
-
-The value of this variable is a list of strings, where each
-string is a directory to add to the include path of dmd.
-Relative paths are relative to the file being checked."
- :type '(repeat (directory :tag "Include directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.18"))
-
-(flycheck-def-args-var flycheck-dmd-args d-dmd
- :package-version '(flycheck . "0.24"))
-
-(flycheck-define-checker d-dmd
- "A D syntax checker using the DMD compiler.
-
-Requires DMD 2.066 or newer. See URL `http://dlang.org/'."
- :command ("dmd"
- "-debug" ; Compile in debug mode
- "-o-" ; Don't generate an object file
- "-vcolumns" ; Add columns in output
- "-wi" ; Compilation will continue even if there are warnings
- (eval (concat "-I" (flycheck-d-base-directory)))
- (option-list "-I" flycheck-dmd-include-path concat)
- (eval flycheck-dmd-args)
- source)
- :error-patterns
- ((error line-start
- (file-name) "(" line "," column "): Error: " (message)
- line-end)
- (warning line-start (file-name) "(" line "," column "): "
- (or "Warning" "Deprecation") ": " (message) line-end))
- :modes d-mode)
-
-(defconst flycheck-this-emacs-executable
- (concat invocation-directory invocation-name)
- "The path to the currently running Emacs executable.")
-
-(defconst flycheck-emacs-args '("-Q" "--batch")
- "Common arguments to Emacs invocations.")
-
-(defmacro flycheck-prepare-emacs-lisp-form (&rest body)
- "Prepare BODY for use as check form in a subprocess."
- (declare (indent 0))
- `(flycheck-sexp-to-string
- '(progn
- (defvar jka-compr-inhibit)
- (unwind-protect
- ;; Flycheck inhibits compression of temporary files, thus we
- ;; must not attempt to decompress.
- (let ((jka-compr-inhibit t))
- ;; Strip option-argument separator from arguments, if present
- (when (equal (car command-line-args-left) "--")
- (setq command-line-args-left (cdr command-line-args-left)))
- ,@body)
- ;; Prevent Emacs from processing the arguments on its own, see
- ;; https://github.com/flycheck/flycheck/issues/319
- (setq command-line-args-left nil)))))
-
-(defconst flycheck-emacs-lisp-check-form
- (flycheck-prepare-emacs-lisp-form
- ;; Keep track of the generated bytecode files, to delete them after byte
- ;; compilation.
- (defvar flycheck-byte-compiled-files nil)
- (let ((byte-compile-dest-file-function
- (lambda (source)
- (let ((temp-file (make-temp-file (file-name-nondirectory source))))
- (push temp-file flycheck-byte-compiled-files)
- temp-file))))
- (unwind-protect
- (byte-compile-file (car command-line-args-left))
- (mapc (lambda (f) (ignore-errors (delete-file f)))
- flycheck-byte-compiled-files)))))
-
-(flycheck-def-option-var flycheck-emacs-lisp-load-path nil emacs-lisp
- "Load path to use in the Emacs Lisp syntax checker.
-
-When set to `inherit', use the `load-path' of the current Emacs
-session during syntax checking.
-
-When set to a list of strings, add each directory in this list to
-the `load-path' before invoking the byte compiler. Relative
-paths in this list are expanded against the `default-directory'
-of the buffer to check.
-
-When nil, do not explicitly set the `load-path' during syntax
-checking. The syntax check only uses the built-in `load-path' of
-Emacs in this case.
-
-Note that changing this variable can lead to wrong results of the
-syntax check, e.g. if an unexpected version of a required library
-is used."
- :type '(choice (const :tag "Inherit current `load-path'" inherit)
- (repeat :tag "Load path" directory))
- :risky t
- :package-version '(flycheck . "0.14"))
-
-(flycheck-def-option-var flycheck-emacs-lisp-initialize-packages
- 'auto emacs-lisp
- "Whether to initialize packages in the Emacs Lisp syntax checker.
-
-To initialize packages, call `package-initialize' before
-byte-compiling the file to check.
-
-When nil, never initialize packages. When `auto', initialize
-packages only when checking `user-init-file' or files from
-`user-emacs-directory'. For any other non-nil value, always
-initialize packages."
- :type '(choice (const :tag "Do not initialize packages" nil)
- (const :tag "Initialize packages for configuration only" auto)
- (const :tag "Always initialize packages" t))
- :risky t
- :package-version '(flycheck . "0.14"))
-
-(defconst flycheck-emacs-lisp-package-initialize-form
- (flycheck-sexp-to-string
- '(with-demoted-errors "Error during package initialization: %S"
- (package-initialize)))
- "Form used to initialize packages.")
-
-(defun flycheck-option-emacs-lisp-package-initialize (value)
- "Option VALUE filter for `flycheck-emacs-lisp-initialize-packages'."
- (let ((shall-initialize
- (if (eq value 'auto)
- (or (flycheck-in-user-emacs-directory-p (buffer-file-name))
- ;; `user-init-file' is nil in non-interactive sessions. Now,
- ;; no user would possibly use Flycheck in a non-interactive
- ;; session, but our unit tests run non-interactively, so we
- ;; have to handle this case anyway
- (and user-init-file
- (flycheck-same-files-p (buffer-file-name)
- user-init-file)))
- value)))
- (when shall-initialize
- ;; If packages shall be initialized, return the corresponding form,
- ;; otherwise make Flycheck ignore the option by returning nil.
- flycheck-emacs-lisp-package-initialize-form)))
-
-(flycheck-def-option-var flycheck-emacs-lisp-package-user-dir nil emacs-lisp
- "Package directory for the Emacs Lisp syntax checker.
-
-When set to a string, set `package-user-dir' to the value of this
-variable before initializing packages.
-
-This variable has no effect, if
-`flycheck-emacs-lisp-initialize-packages' is nil."
- :type '(choice (const :tag "Default package directory" nil)
- (directory :tag "Custom package directory"))
- :risky t
- :package-version '(flycheck . "0.14"))
-
-(defun flycheck-option-emacs-lisp-package-user-dir (value)
- "Option VALUE filter for `flycheck-emacs-lisp-package-user-dir'."
- (unless value
- ;; Inherit the package directory from our Emacs session
- (setq value (and (boundp 'package-user-dir) package-user-dir)))
- (when value
- (flycheck-sexp-to-string `(setq package-user-dir ,value))))
-
-(flycheck-define-checker emacs-lisp
- "An Emacs Lisp syntax checker using the Emacs Lisp Byte compiler.
-
-See Info Node `(elisp)Byte Compilation'."
- :command ("emacs" (eval flycheck-emacs-args)
- (eval
- (let ((path (pcase flycheck-emacs-lisp-load-path
- (`inherit load-path)
- (p (mapcar #'expand-file-name p)))))
- (flycheck-prepend-with-option "--directory" path)))
- (option "--eval" flycheck-emacs-lisp-package-user-dir nil
- flycheck-option-emacs-lisp-package-user-dir)
- (option "--eval" flycheck-emacs-lisp-initialize-packages nil
- flycheck-option-emacs-lisp-package-initialize)
- "--eval" (eval flycheck-emacs-lisp-check-form)
- "--"
- source-inplace)
- :error-patterns
- ((error line-start (file-name) ":" line ":" column ":Error:"
- (message (zero-or-more not-newline)
- (zero-or-more "\n " (zero-or-more not-newline)))
- line-end)
- (warning line-start (file-name) ":" line ":" column ":Warning:"
- (message (zero-or-more not-newline)
- (zero-or-more "\n " (zero-or-more not-newline)))
- line-end))
- :error-filter
- (lambda (errors)
- (flycheck-collapse-error-message-whitespace
- (flycheck-sanitize-errors errors)))
- :modes (emacs-lisp-mode lisp-interaction-mode)
- :predicate
- (lambda ()
- (and
- ;; Ensure that we only check buffers with a backing file. For buffers
- ;; without a backing file we cannot guarantee that file names in error
- ;; messages are properly resolved, because `byte-compile-file' emits file
- ;; names *relative to the directory of the checked file* instead of the
- ;; working directory. Hence our backwards-substitution will fail, because
- ;; the checker process has a different base directory to resolve relative
- ;; file names than the Flycheck code working on the buffer to check.
- (buffer-file-name)
- ;; Do not check buffers which should not be byte-compiled. The checker
- ;; process will refuse to compile these, which would confuse Flycheck
- (not (bound-and-true-p no-byte-compile))
- ;; Do not check buffers used for autoloads generation during package
- ;; installation. These buffers are too short-lived for being checked, and
- ;; doing so causes spurious errors. See
- ;; https://github.com/flycheck/flycheck/issues/45 and
- ;; https://github.com/bbatsov/prelude/issues/248. We must also not check
- ;; compilation buffers, but as these are ephemeral, Flycheck won't check
- ;; them anyway.
- (not (flycheck-autoloads-file-p))))
- :next-checkers (emacs-lisp-checkdoc))
-
-(defconst flycheck-emacs-lisp-checkdoc-form
- (flycheck-prepare-emacs-lisp-form
- (require 'checkdoc)
-
- (let ((source (car command-line-args-left))
- ;; Remember the default directory of the process
- (process-default-directory default-directory))
- (with-temp-buffer
- (insert-file-contents source 'visit)
- (setq buffer-file-name source)
- ;; And change back to the process default directory to make file-name
- ;; back-substutition work
- (setq default-directory process-default-directory)
- (with-demoted-errors "Error in checkdoc: %S"
- ;; If we have `checkdoc-file' (in Emacs 25) use it, otherwise fall
- ;; back to printing the result buffer of checkdoc.
- (if (fboundp 'checkdoc-file)
- (checkdoc-file source)
- (checkdoc-current-buffer t)
- (with-current-buffer checkdoc-diagnostic-buffer
- (princ (buffer-substring-no-properties (point-min) (point-max)))
- (kill-buffer))))))))
-
-(flycheck-define-checker emacs-lisp-checkdoc
- "An Emacs Lisp style checker using CheckDoc.
-
-The checker runs `checkdoc-current-buffer'."
- :command ("emacs" (eval flycheck-emacs-args)
- "--eval" (eval flycheck-emacs-lisp-checkdoc-form)
- "--" source)
- :error-patterns
- ((warning line-start (file-name) ":" line ": " (message) line-end))
- :modes (emacs-lisp-mode)
- :predicate
- (lambda ()
- ;; Do not check Autoloads, Cask/Carton and dir-locals files. These files
- ;; really don't need to follow Checkdoc conventions.
- (not (or (flycheck-autoloads-file-p)
- (and (buffer-file-name)
- (member (file-name-nondirectory (buffer-file-name))
- '("Cask" "Carton" ".dir-locals.el")))))))
-
-(progn
- ;; Use the currently running Emacs by default.
- (setcar (get 'emacs-lisp 'flycheck-command) flycheck-this-emacs-executable)
- (setcar (get 'emacs-lisp-checkdoc 'flycheck-command)
- flycheck-this-emacs-executable))
-
-(flycheck-def-option-var flycheck-erlang-include-path nil erlang
- "A list of include directories for Erlang.
-
-The value of this variable is a list of strings, where each
-string is a directory to add to the include path of erlc.
-Relative paths are relative to the file being checked."
- :type '(repeat (directory :tag "Include directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.24"))
-
-(flycheck-define-checker erlang
- "An Erlang syntax checker using the Erlang interpreter.
-
-See URL `http://www.erlang.org/'."
- :command ("erlc"
- "-o" temporary-directory
- (option-list "-I" flycheck-erlang-include-path)
- "-Wall"
- source)
- :error-patterns
- ((warning line-start (file-name) ":" line ": Warning:" (message) line-end)
- (error line-start (file-name) ":" line ": " (message) line-end))
- :modes erlang-mode)
-
-(flycheck-define-checker eruby-erubis
- "A eRuby syntax checker using the `erubis' command.
-
-See URL `http://www.kuwata-lab.com/erubis/'."
- :command ("erubis" "-z" source)
- :error-patterns
- ((error line-start (file-name) ":" line ": " (message) line-end))
- :modes (html-erb-mode rhtml-mode))
-
-(flycheck-def-args-var flycheck-gfortran-args fortran-gfortran
- :package-version '(flycheck . "0.22"))
-
-(flycheck-def-option-var flycheck-gfortran-include-path nil fortran-gfortran
- "A list of include directories for GCC Fortran.
-
-The value of this variable is a list of strings, where each
-string is a directory to add to the include path of gcc.
-Relative paths are relative to the file being checked."
- :type '(repeat (directory :tag "Include directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gfortran-language-standard "f95" fortran-gfortran
- "The language standard to use in GFortran.
-
-The value of this variable is either a string denoting a language
-standard, or nil, to use the default standard. When non-nil,
-pass the language standard via the `-std' option."
- :type '(choice (const :tag "Default standard" nil)
- (string :tag "Language standard"))
- :safe #'stringp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-gfortran-layout nil fortran-gfortran
- "The source code layout to use in GFortran.
-
-The value of this variable is one of the following symbols:
-
-nil
- Let gfortran determine the layout from the extension
-
-`free'
- Use free form layout
-
-
-`fixed'
- Use fixed form layout
-
-In any other case, an error is signaled.")
-
-(defun flycheck-option-gfortran-layout (value)
- "Option VALUE filter for `flycheck-gfortran-layout'."
- (pcase value
- (`nil nil)
- (`free "free-form")
- (`fixed "fixed-form")
- (_ (error "Invalid value for flycheck-gfortran-layout: %S" value))))
-
-(flycheck-def-option-var flycheck-gfortran-warnings '("all" "extra")
- fortran-gfortran
- "A list of warnings for GCC Fortran.
-
-The value of this variable is a list of strings, where each string
-is the name of a warning category to enable. By default, all
-recommended warnings and some extra warnings are enabled (as by
-`-Wall' and `-Wextra' respectively).
-
-Refer to the gfortran manual at URL
-`https://gcc.gnu.org/onlinedocs/gfortran/' for more information
-about warnings")
-
-(flycheck-define-checker fortran-gfortran
- "An Fortran syntax checker using GCC.
-
-Uses GCC's Fortran compiler gfortran. See URL
-`https://gcc.gnu.org/onlinedocs/gfortran/'."
- :command ("gfortran"
- "-fsyntax-only"
- "-fshow-column"
- "-fno-diagnostics-show-caret" ; Do not visually indicate the source location
- "-fno-diagnostics-show-option" ; Do not show the corresponding
- ; warning group
- ;; Fortran has similar include processing as C/C++
- "-iquote" (eval (flycheck-c/c++-quoted-include-directory))
- (option "-std=" flycheck-gfortran-language-standard concat)
- (option "-f" flycheck-gfortran-layout concat
- flycheck-option-gfortran-layout)
- (option-list "-W" flycheck-gfortran-warnings concat)
- (option-list "-I" flycheck-gfortran-include-path concat)
- (eval flycheck-gfortran-args)
- source)
- :error-patterns
- ((error line-start (file-name) ":" line "." column ":\n"
- (= 3 (zero-or-more not-newline) "\n")
- (or "Error" "Fatal Error") ": " (message) line-end)
- (warning line-start (file-name) ":" line "." column ":\n"
- (= 3 (zero-or-more not-newline) "\n")
- "Warning: " (message) line-end))
- :modes (fortran-mode f90-mode))
-
-(flycheck-define-checker go-gofmt
- "A Go syntax and style checker using the gofmt utility.
-
-See URL `http://golang.org/cmd/gofmt/'."
- :command ("gofmt" source)
- :error-patterns
- ((error line-start (file-name) ":" line ":" column ": " (message) line-end))
- :modes go-mode
- :next-checkers ((warning . go-golint)
- ;; Fall back, if go-golint doesn't exist
- (warning . go-vet)
- ;; Fall back, if go-vet doesn't exist
- (warning . go-build) (warning . go-test)
- (warning . go-errcheck)))
-
-(flycheck-define-checker go-golint
- "A Go style checker using Golint.
-
-See URL `https://github.com/golang/lint'."
- :command ("golint" source)
- :error-patterns
- ((warning line-start (file-name) ":" line ":" column ": " (message) line-end))
- :modes go-mode
- :next-checkers (go-vet
- ;; Fall back, if go-vet doesn't exist
- go-build go-test go-errcheck))
-
-(flycheck-def-option-var flycheck-go-vet-print-functions nil go-vet
- "A list of print-like functions for `go tool vet'.
-
-Go vet will check these functions for format string problems and
-issues, such as a mismatch between the number of formats used,
-and the number of arguments given.
-
-Each entry is in the form Name:N where N is the zero-based
-argument position of the first argument involved in the print:
-either the format or the first print argument for non-formatted
-prints. For example, if you have Warn and Warnf functions that
-take an io.Writer as their first argument, like Fprintf,
--printfuncs=Warn:1,Warnf:1 "
- :type '(repeat :tag "print-like functions"
- (string :tag "function"))
- :safe #'flycheck-string-list-p)
-
-(flycheck-define-checker go-vet
- "A Go syntax checker using the `go tool vet' command.
-
-See URL `http://golang.org/cmd/go/' and URL
-`http://godoc.org/golang.org/x/tools/cmd/vet'."
- :command ("go" "tool" "vet"
- (option "-printfuncs=" flycheck-go-vet-print-functions concat
- flycheck-option-comma-separated-list)
- source)
- :error-patterns
- ((warning line-start (file-name) ":" line ": " (message) line-end))
- :modes go-mode
- ;; We must explicitly check whether the "vet" tool is available
- :predicate (lambda ()
- (let ((go (flycheck-checker-executable 'go-vet)))
- (member "vet" (ignore-errors (process-lines go "tool")))))
- :next-checkers (go-build
- go-test
- ;; Fall back if `go build' or `go test' can be used
- go-errcheck))
-
-(flycheck-define-checker go-build
- "A Go syntax and type checker using the `go build' command.
-
-See URL `http://golang.org/cmd/go'."
- ;; We need to use `temporary-file-name' instead of `null-device', because Go
- ;; can't write to the null device. It's “too magic”. See
- ;; https://code.google.com/p/go/issues/detail?id=4851 for details.
- :command ("go" "build" "-o" temporary-file-name)
- :error-patterns
- ((error line-start (file-name) ":" line ":"
- (optional column ":") " "
- (message (one-or-more not-newline)
- (zero-or-more "\n\t" (one-or-more not-newline)))
- line-end))
- :modes go-mode
- :predicate (lambda ()
- (and (flycheck-buffer-saved-p)
- (not (string-suffix-p "_test.go" (buffer-file-name)))))
- :next-checkers ((warning . go-errcheck)))
-
-(flycheck-define-checker go-test
- "A Go syntax and type checker using the `go test' command.
-
-See URL `http://golang.org/cmd/go'."
- ;; This command builds the test executable and leaves it in the current
- ;; directory. Unfortunately 'go test -c' does not have the '-o' option.
- :command ("go" "test" "-c")
- :error-patterns
- ((error line-start (file-name) ":" line ": "
- (message (one-or-more not-newline)
- (zero-or-more "\n\t" (one-or-more not-newline)))
- line-end))
- :modes go-mode
- :predicate
- (lambda () (and (flycheck-buffer-saved-p)
- (string-suffix-p "_test.go" (buffer-file-name))))
- :next-checkers ((warning . go-errcheck)))
-
-(defun flycheck-go-package-name (&optional file-name gopath)
- "Determine the package name for FILE-NAME and GOPATH.
-
-FILE-NAME defaults to `buffer-file-name'. GOPATH defaults to
-$GOPATH.
-
-Return the package name for FILE-NAME, or nil if FILE-NAME is not
-part of any package or if GOPATH is nil."
- (-when-let* ((gopath (or gopath (getenv "GOPATH")))
- (file-name (or file-name (buffer-file-name))))
- (let ((gosrc (file-name-as-directory (expand-file-name "src/" gopath)))
- (file-name (expand-file-name file-name)))
- (when (string-prefix-p gosrc file-name)
- ;; The file is part of a package, so determine the package name, as
- ;; relative file name to the GO source directory
- (directory-file-name ; Remove trailing /
- (file-relative-name (file-name-directory file-name) gosrc))))))
-
-(flycheck-define-checker go-errcheck
- "A Go checker for unchecked errors.
-
-See URL `https://github.com/kisielk/errcheck'."
- :command ("errcheck" (eval (flycheck-go-package-name)))
- :error-patterns
- ((warning line-start
- (file-name) ":" line ":" column (one-or-more "\t")
- (message)
- line-end))
- :error-filter
- (lambda (errors)
- (let ((errors (flycheck-sanitize-errors errors))
- (gosrc (expand-file-name "src/" (getenv "GOPATH"))))
- (dolist (err errors)
- ;; File names are relative to the Go source directory, so we need to
- ;; unexpand and re-expand them
- (setf (flycheck-error-filename err)
- (expand-file-name
- ;; Get the relative name back, since Flycheck has already
- ;; expanded the name for us
- (file-relative-name (flycheck-error-filename err))
- ;; And expand it against the Go source directory
- gosrc))
- (-when-let (message (flycheck-error-message err))
- ;; Improve the messages reported by errcheck to make them more clear.
- (setf (flycheck-error-message err)
- (format "Ignored `error` returned from `%s`" message)))))
- errors)
- :modes go-mode
- :predicate
- (lambda ()
- ;; We need a valid package name, since errcheck only works on entire
- ;; packages, and can't check individual Go files.
- (and (flycheck-buffer-saved-p) (flycheck-go-package-name))))
-
-(flycheck-define-checker haml
- "A Haml syntax checker using the Haml compiler.
-
-See URL `http://haml.info'."
- :command ("haml" "-c" source)
- :error-patterns
- ((error line-start "Syntax error on line " line ": " (message) line-end))
- :modes haml-mode)
-
-(flycheck-define-checker handlebars
- "A Handlebars syntax checker using the Handlebars compiler.
-
-See URL `http://handlebarsjs.com/'."
- :command ("handlebars" source)
- :error-patterns
- ((error line-start
- "Error: Parse error on line " line ":" (optional "\r") "\n"
- (zero-or-more not-newline) "\n" (zero-or-more not-newline) "\n"
- (message) line-end))
- :modes (handlebars-mode handlebars-sgml-mode web-mode)
- :predicate
- (lambda ()
- (if (eq major-mode 'web-mode)
- ;; Check if this is a handlebars file since web-mode does not store the
- ;; non-canonical engine name
- (let* ((regexp-alist (bound-and-true-p web-mode-engine-file-regexps))
- (pattern (cdr (assoc "handlebars" regexp-alist))))
- (and pattern (buffer-file-name)
- (string-match-p pattern (buffer-file-name))))
- t)))
-
-(defconst flycheck-haskell-module-re
- (rx line-start (zero-or-more (or "\n" (any space)))
- "module" (one-or-more (or "\n" (any space)))
- (group (one-or-more (not (any space "\n")))))
- "Regular expression for a Haskell module name.")
-
-(flycheck-def-args-var flycheck-ghc-args haskell-ghc
- :package-version '(flycheck . "0.22"))
-
-(flycheck-def-option-var flycheck-ghc-no-user-package-database nil haskell-ghc
- "Whether to disable the user package database in GHC.
-
-When non-nil, disable the user package database in GHC, via
-`-no-user-package-db'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.16"))
-
-(flycheck-def-option-var flycheck-ghc-package-databases nil haskell-ghc
- "Additional module databases for GHC.
-
-The value of this variable is a list of strings, where each
-string is a directory of a package database. Each package
-database is given to GHC via `-package-db'."
- :type '(repeat (directory :tag "Package database"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.16"))
-
-(flycheck-def-option-var flycheck-ghc-search-path nil haskell-ghc
- "Module search path for GHC.
-
-The value of this variable is a list of strings, where each
-string is a directory containing Haskell modules. Each directory
-is added to the GHC search path via `-i'."
- :type '(repeat (directory :tag "Module directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.16"))
-
-(flycheck-def-option-var flycheck-ghc-language-extensions nil haskell-ghc
- "Language extensions for GHC.
-
-The value of this variable is a list of strings, where each
-string is a Haskell language extension, as in the LANGUAGE
-pragma. Each extension is enabled via `-X'."
- :type '(repeat (string :tag "Language extension"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.19"))
-
-(flycheck-define-checker haskell-ghc
- "A Haskell syntax and type checker using ghc.
-
-See URL `http://www.haskell.org/ghc/'."
- :command ("ghc" "-Wall" "-fno-code"
- (option-flag "-no-user-package-db"
- flycheck-ghc-no-user-package-database)
- (option-list "-package-db" flycheck-ghc-package-databases)
- (option-list "-i" flycheck-ghc-search-path concat)
- ;; Include the parent directory of the current module tree, to
- ;; properly resolve local imports
- (eval (concat
- "-i"
- (flycheck-module-root-directory
- (flycheck-find-in-buffer flycheck-haskell-module-re))))
- (option-list "-X" flycheck-ghc-language-extensions concat)
- (eval flycheck-ghc-args)
- "-x" (eval
- (pcase major-mode
- (`haskell-mode "hs")
- (`literate-haskell-mode "lhs")))
- source)
- :error-patterns
- ((warning line-start (file-name) ":" line ":" column ":"
- (or " " "\n ") "Warning:" (optional "\n")
- (message
- (one-or-more " ") (one-or-more not-newline)
- (zero-or-more "\n"
- (one-or-more " ")
- (one-or-more not-newline)))
- line-end)
- (error line-start (file-name) ":" line ":" column ":"
- (or (message (one-or-more not-newline))
- (and "\n"
- (message
- (one-or-more " ") (one-or-more not-newline)
- (zero-or-more "\n"
- (one-or-more " ")
- (one-or-more not-newline)))))
- line-end))
- :error-filter
- (lambda (errors)
- (flycheck-sanitize-errors (flycheck-dedent-error-messages errors)))
- :modes (haskell-mode literate-haskell-mode)
- :next-checkers ((warning . haskell-hlint)))
-
-(flycheck-define-checker haskell-hlint
- "A Haskell style checker using hlint.
-
-See URL `https://github.com/ndmitchell/hlint'."
- :command ("hlint" source-inplace)
- :error-patterns
- ((warning line-start
- (file-name) ":" line ":" column
- ": Warning: "
- (message (one-or-more not-newline)
- (one-or-more "\n" (one-or-more not-newline)))
- line-end)
- (error line-start
- (file-name) ":" line ":" column
- ": Error: "
- (message (one-or-more not-newline)
- (one-or-more "\n" (one-or-more not-newline)))
- line-end))
- :modes (haskell-mode literate-haskell-mode))
-
-(flycheck-def-config-file-var flycheck-tidyrc html-tidy ".tidyrc"
- :safe #'stringp)
-
-(flycheck-define-checker html-tidy
- "A HTML syntax and style checker using Tidy.
-
-See URL `https://github.com/w3c/tidy-html5'."
- :command ("tidy" (config-file "-config" flycheck-tidyrc) "-e" "-q" source)
- :error-patterns
- ((error line-start
- "line " line
- " column " column
- " - Error: " (message) line-end)
- (warning line-start
- "line " line
- " column " column
- " - Warning: " (message) line-end))
- :modes (html-mode nxhtml-mode))
-
-(flycheck-def-config-file-var flycheck-jshintrc javascript-jshint ".jshintrc"
- :safe #'stringp)
-
-(flycheck-define-checker javascript-jshint
- "A Javascript syntax and style checker using jshint.
-
-See URL `http://www.jshint.com'."
- :command ("jshint" "--checkstyle-reporter"
- (config-file "--config" flycheck-jshintrc)
- source)
- :error-parser flycheck-parse-checkstyle
- :error-filter flycheck-dequalify-error-ids
- :modes (js-mode js2-mode js3-mode)
- :next-checkers ((warning . javascript-jscs)))
-
-(flycheck-def-option-var flycheck-eslint-rulesdir nil javascript-eslint
- "The directory of custom rules for ESLint.
-
-The value of this variable is either a string containing the path
-to a directory with custom rules, or nil, to not give any custom
-rules to ESLint.
-
-Refer to the ESLint manual at URL
-`https://github.com/eslint/eslint/tree/master/docs/command-line-interface#--rulesdir'
-for more information about the custom directory."
- :type '(choice (const :tag "No custom rules directory" nil)
- (directory :tag "Custom rules directory"))
- :safe #'stringp
- :package-version '(flycheck . "0.16"))
-
-(flycheck-def-config-file-var flycheck-eslintrc javascript-eslint nil
- :safe #'stringp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-define-checker javascript-eslint
- "A Javascript syntax and style checker using eslint.
-
-See URL `https://github.com/eslint/eslint'."
- :command ("eslint" "--format=checkstyle"
- (config-file "--config" flycheck-eslintrc)
- (option "--rulesdir" flycheck-eslint-rulesdir)
- ;; We need to use source-inplace because eslint looks for
- ;; configuration files in the directory of the file being checked.
- ;; See https://github.com/flycheck/flycheck/issues/447
- source-inplace)
- :error-parser flycheck-parse-checkstyle
- :error-filter (lambda (errors)
- (mapc (lambda (err)
- ;; Parse error ID from the error message
- (setf (flycheck-error-message err)
- (replace-regexp-in-string
- (rx " ("
- (group (one-or-more (not (any ")"))))
- ")" string-end)
- (lambda (s)
- (setf (flycheck-error-id err)
- (match-string 1 s))
- "")
- (flycheck-error-message err))))
- (flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
- errors)
- :modes (js-mode js2-mode js3-mode)
- :next-checkers ((warning . javascript-jscs)))
-
-(flycheck-def-config-file-var flycheck-gjslintrc javascript-gjslint ".gjslintrc"
- :safe #'stringp)
-
-(flycheck-define-checker javascript-gjslint
- "A Javascript syntax and style checker using Closure Linter.
-
-See URL `https://developers.google.com/closure/utilities'."
- :command ("gjslint" "--unix_mode"
- (config-file "--flagfile" flycheck-gjslintrc)
- source)
- :error-patterns ((warning
- line-start (file-name) ":" line ":("
- (id (one-or-more digit)) ") " (message) line-end))
- :modes (js-mode js2-mode js3-mode)
- :next-checkers ((warning . javascript-jscs)))
-
-(defun flycheck-parse-jscs (output checker buffer)
- "Parse JSCS OUTPUT from CHECKER and BUFFER.
-
-Like `flycheck-parse-checkstyle', but catches errors about no
-configuration found and prevents to be reported as a suspicious
-error."
- (if (string-match-p (rx string-start "No configuration found") output)
- (let ((message "No JSCS configuration found. Set `flycheck-jscsrc' for JSCS"))
- (list (flycheck-error-new-at 1 nil 'warning message
- :checker checker
- :buffer buffer
- :filename (buffer-file-name buffer))))
- (flycheck-parse-checkstyle output checker buffer)))
-
-(flycheck-def-config-file-var flycheck-jscsrc javascript-jscs ".jscsrc"
- :safe #'stringp
- :package-version '(flycheck . "0.24"))
-
-(flycheck-define-checker javascript-jscs
- "A Javascript style checker using JSCS.
-
-See URL `http://www.jscs.info'."
- :command ("jscs" "--reporter=checkstyle"
- (config-file "--config" flycheck-jscsrc)
- source)
- :error-parser flycheck-parse-jscs
- :error-filter (lambda (errors)
- (flycheck-remove-error-ids
- (flycheck-sanitize-errors errors)))
- :modes (js-mode js2-mode js3-mode))
-
-(flycheck-define-checker javascript-standard
- "A Javascript code and style checker for the (Semi-)Standard Style.
-
-This checker works with `standard' and `semistandard', defaulting
-to the former. To use it with the latter, set
-`flycheck-javascript-standard-executable' to `semistandard'.
-
-See URL `https://github.com/feross/standard' and URL
-`https://github.com/Flet/semistandard'."
- :command ("standard" source)
- :error-patterns
- ((error line-start
- " " (file-name) ":" line ":" column ":" (message)
- line-end))
- :modes (js-mode js2-mode js3-mode))
-
-(flycheck-define-checker json-jsonlint
- "A JSON syntax and style checker using jsonlint.
-
-See URL `https://github.com/zaach/jsonlint'."
- :command ("jsonlint" "-c" "-q" source)
- :error-patterns
- ((error line-start
- (file-name)
- ": line " line
- ", col " column ", "
- (message) line-end))
- :predicate
- (lambda ()
- (or
- (eq major-mode 'json-mode)
- (and (buffer-file-name)
- (string= (file-name-extension (buffer-file-name)) "json")))))
-
-(flycheck-define-checker less
- "A LESS syntax checker using lessc.
-
-At least version 1.4 of lessc is required.
-
-See URL `http://lesscss.org'."
- :command ("lessc" "--lint" "--no-color"
- ;; We need `source-inplace' to resolve relative `data-uri' paths,
- ;; see https://github.com/flycheck/flycheck/issues/471
- source-inplace)
- :error-patterns
- ((error line-start (one-or-more word) ":"
- (message)
- " in "
- (file-name)
-
- " on line " line
- ", column " column ":"
- line-end))
- :modes less-css-mode)
-
-(flycheck-def-config-file-var flycheck-luacheckrc luacheck ".luacheckrc"
- :safe #'stringp
- :package-version '(flycheck . "0.23"))
-
-(flycheck-define-checker luacheck
- "A Lua syntax checker using luacheck.
-
-See URL `https://github.com/mpeterv/luacheck'."
- :command ("luacheck"
- (config-file "--config" flycheck-luacheckrc)
- "--formatter" "plain"
- "--codes" ; Show warning codes
- "--no-color"
- source)
- :error-patterns
- ((warning line-start (file-name)
- ":" line ":" column ": (" (id (and "W" (one-or-more digit)))
- ") " (message) line-end)
- (error line-start (file-name)
- ":" line ":" column ":" (message) line-end))
- :modes lua-mode)
-
-(flycheck-define-checker lua
- "A Lua syntax checker using the Lua compiler.
-
-See URL `http://www.lua.org/'."
- :command ("luac" "-p" source)
- :error-patterns
- ((error line-start
- ;; Skip the name of the luac executable. We also skip the file name,
- ;; because luac is stupid enough as to abbreviate file names in its
- ;; output, which for obvious reasons breaks our file name
- ;; detection. See https://github.com/flycheck/flycheck/issues/251
- (minimal-match (zero-or-more not-newline))
- ":" line ": " (message) line-end))
- :modes lua-mode)
-
-(flycheck-def-option-var flycheck-perl-include-path nil perl
- "A list of include directories for Perl.
-
-The value of this variable is a list of strings, where each
-string is a directory to add to the include path of Perl.
-Relative paths are relative to the file being checked."
- :type '(repeat (directory :tag "Include directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.24"))
-
-(flycheck-define-checker perl
- "A Perl syntax checker using the Perl interpreter.
-
-See URL `http://www.perl.org'."
- :command ("perl" "-w" "-c"
- (option-list "-I" flycheck-perl-include-path)
- source)
- :error-patterns
- ((error line-start (minimal-match (message))
- " at " (file-name) " line " line
- (or "." (and ", " (zero-or-more not-newline))) line-end))
- :modes (perl-mode cperl-mode)
- :next-checkers (perl-perlcritic))
-
-(flycheck-def-option-var flycheck-perlcritic-severity nil perl-perlcritic
- "The message severity for Perl Critic.
-
-The value of this variable is a severity level as integer, for
-the `--severity' option to Perl Critic."
- :type '(integer :tag "Severity level")
- :safe #'integerp
- :package-version '(flycheck . "0.18"))
-
-(define-obsolete-variable-alias 'flycheck-perlcritic-verbosity
- 'flycheck-perlcritic-severity "0.22")
-
-(flycheck-define-checker perl-perlcritic
- "A Perl syntax checker using Perl::Critic.
-
-See URL `https://metacpan.org/pod/Perl::Critic'."
- :command ("perlcritic" "--no-color" "--verbose" "%f/%l/%c/%s/%p/%m (%e)\n"
- (option "--severity" flycheck-perlcritic-severity nil
- flycheck-option-int)
- source)
- :error-patterns
- ((info line-start
- (file-name) "/" line "/" column "/" (any "1") "/"
- (id (one-or-more (not (any "/")))) "/" (message)
- line-end)
- (warning line-start
- (file-name) "/" line "/" column "/" (any "234") "/"
- (id (one-or-more (not (any "/")))) "/" (message)
- line-end)
- (error line-start
- (file-name) "/" line "/" column "/" (any "5") "/"
- (id (one-or-more (not (any "/")))) "/" (message)
- line-end))
- :modes (cperl-mode perl-mode))
-
-(flycheck-define-checker php
- "A PHP syntax checker using the PHP command line interpreter.
-
-See URL `http://php.net/manual/en/features.commandline.php'."
- :command ("php" "-l" "-d" "error_reporting=E_ALL" "-d" "display_errors=1"
- "-d" "log_errors=0" source)
- :error-patterns
- ((error line-start (or "Parse" "Fatal" "syntax") " error" (any ":" ",") " "
- (message) " in " (file-name) " on line " line line-end))
- :modes (php-mode php+-mode)
- :next-checkers ((warning . php-phpmd)
- (warning . php-phpcs)))
-
-(flycheck-def-option-var flycheck-phpmd-rulesets
- '("cleancode" "codesize" "controversial" "design" "naming" "unusedcode")
- php-phpmd
- "The rule sets for PHP Mess Detector.
-
-Set default rule sets and custom rule set files.
-
-See section \"Using multiple rule sets\" in the PHP Mess Detector
-manual at URL `http://phpmd.org/documentation/index.html'."
- :type '(repeat :tag "rule sets"
- (string :tag "A filename or rule set"))
- :safe #'flycheck-string-list-p)
-
-(flycheck-define-checker php-phpmd
- "A PHP style checker using PHP Mess Detector.
-
-See URL `http://phpmd.org/'."
- :command ("phpmd" source "xml"
- (eval (flycheck-option-comma-separated-list
- flycheck-phpmd-rulesets)))
- :error-parser flycheck-parse-phpmd
- :modes (php-mode php+-mode)
- :next-checkers (php-phpcs))
-
-(flycheck-def-option-var flycheck-phpcs-standard nil php-phpcs
- "The coding standard for PHP CodeSniffer.
-
-When nil, use the default standard from the global PHP
-CodeSniffer configuration. When set to a string, pass the string
-to PHP CodeSniffer which will interpret it as name as a standard,
-or as path to a standard specification."
- :type '(choice (const :tag "Default standard" nil)
- (string :tag "Standard name or file"))
- :safe #'stringp)
-
-(flycheck-define-checker php-phpcs
- "A PHP style checker using PHP_CodeSniffer.
-
-See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
- :command ("phpcs" "--report=checkstyle"
- (option "--standard=" flycheck-phpcs-standard concat)
- source)
- :error-parser flycheck-parse-checkstyle
- :modes (php-mode php+-mode))
-
-(flycheck-define-checker puppet-parser
- "A Puppet DSL syntax checker using puppet's own parser.
-
-See URL `http://puppetlabs.com/'."
- :command ("puppet" "parser" "validate" "--color=false" source)
- :error-patterns
- (
- ;; Patterns for Puppet 4
- (error line-start "Error: Could not parse for environment "
- (one-or-more word) ":"
- (message) " at " (file-name) ":" line ":" column line-end)
- (error line-start "Error: Could not parse for environment "
- (one-or-more word) ":"
- (message) " in file " (file-name) " at line " line ":" column
- line-end)
- ;; Errors from Puppet < 4
- (error line-start
- ;; Skip over the path of the Puppet executable
- (minimal-match (zero-or-more not-newline))
- ": Could not parse for environment " (one-or-more word)
- ": " (message (minimal-match (zero-or-more anything)))
- " at " (file-name "/" (zero-or-more not-newline)) ":" line line-end))
- :modes puppet-mode
- :next-checkers ((warning . puppet-lint)))
-
-(flycheck-define-checker puppet-lint
- "A Puppet DSL style checker using puppet-lint.
-
-See URL `http://puppet-lint.com/'."
- ;; We must check the original file, because Puppetlint is quite picky on the
- ;; names of files and there place in the directory structure, to comply with
- ;; Puppet's autoload directory layout. For instance, a class foo::bar is
- ;; required to be in a file foo/bar.pp. Any other place, such as a Flycheck
- ;; temporary file will cause an error.
- :command ("puppet-lint"
- "--log-format" "%{path}:%{linenumber}:%{kind}: %{message} (%{check})"
- source-original)
- :error-patterns
- ((warning line-start (file-name) ":" line ":warning: " (message) line-end)
- (error line-start (file-name) ":" line ":error: " (message) line-end))
- :modes puppet-mode
- ;; Since we check the original file, we can only use this syntax checker if
- ;; the buffer is actually linked to a file, and if it is not modified.
- :predicate flycheck-buffer-saved-p)
-
-(flycheck-def-config-file-var flycheck-flake8rc python-flake8 ".flake8rc"
- :safe #'stringp)
-
-(flycheck-def-option-var flycheck-flake8-error-level-alist
- '(("^E9.*$" . error) ; Syntax errors from pep8
- ("^F82.*$" . error) ; undefined variables from pyflakes
- ("^F83.*$" . error) ; Duplicate arguments from flake8
- ("^N.*$" . info) ; Naming issues from naming
- )
- python-flake8
- "An alist mapping flake8 error IDs to Flycheck error levels.
-
-Each item in this list is a cons cell `(PATTERN . LEVEL)' where
-PATTERN is a regular expression matched against the error ID, and
-LEVEL is a Flycheck error level symbol.
-
-Each PATTERN is matched in the order of appearance in this list
-against the error ID. If it matches the ID, the level of the
-corresponding error is set to LEVEL. An error that is not
-matched by any PATTERN defaults to warning level.
-
-This option exists because flake8 categorises errors by the
-underlying tool that produced them (e.g. F for pyflakes messages,
-E for pep8 messages, etc.). These categorisations do not map
-directly to Flycheck error levels. Hence, this option exists to
-allow for a custom mapping. The default value handles all of the
-built-in tools of flake8, and naming errors from pep8-naming."
- :type '(repeat (cons (regexp :tag "Error ID pattern")
- (symbol :tag "Error level")))
- :package-version '(flycheck . "0.22"))
-
-(flycheck-def-option-var flycheck-flake8-maximum-complexity nil python-flake8
- "The maximum McCabe complexity of methods.
-
-If nil, do not check the complexity of methods. If set to an
-integer, report any complexity greater than the value of this
-variable as warning.
-
-If set to an integer, this variable overrules any similar setting
-in the configuration file denoted by `flycheck-flake8rc'."
- :type '(choice (const :tag "Do not check McCabe complexity" nil)
- (integer :tag "Maximum complexity"))
- :safe #'integerp)
-
-(flycheck-def-option-var flycheck-flake8-maximum-line-length nil python-flake8
- "The maximum length of lines.
-
-If set to an integer, the value of this variable denotes the
-maximum length of lines, overruling any similar setting in the
-configuration file denoted by `flycheck-flake8rc'. An error will
-be reported for any line longer than the value of this variable.
-
-If set to nil, use the maximum line length from the configuration
-file denoted by `flycheck-flake8rc', or the PEP 8 recommendation
-of 79 characters if there is no configuration with this setting."
- :type '(choice (const :tag "Default value")
- (integer :tag "Maximum line length in characters"))
- :safe #'integerp)
-
-(defun flycheck-flake8-fix-error-level (err)
- "Fix the error level of ERR.
-
-Update the error level of ERR according to
-`flycheck-flake8-error-level-alist'."
- (pcase-dolist (`(,pattern . ,level) flycheck-flake8-error-level-alist)
- (when (string-match-p pattern (flycheck-error-id err))
- (setf (flycheck-error-level err) level)))
- err)
-
-(flycheck-define-checker python-flake8
- "A Python syntax and style checker using Flake8.
-
-Requires Flake8 2.0 or newer. See URL
-`https://pypi.python.org/pypi/flake8'."
- :command ("flake8"
- (config-file "--config" flycheck-flake8rc)
- (option "--max-complexity" flycheck-flake8-maximum-complexity nil
- flycheck-option-int)
- (option "--max-line-length" flycheck-flake8-maximum-line-length nil
- flycheck-option-int)
- source)
- :error-filter (lambda (errors)
- (let ((errors (flycheck-sanitize-errors errors)))
- (mapc #'flycheck-flake8-fix-error-level errors)
- errors))
- :error-patterns
- ((warning line-start
- (file-name) ":" line ":" (optional column ":") " "
- (id (one-or-more (any alpha)) (one-or-more digit)) " "
- (message (one-or-more not-newline))
- line-end))
- :modes python-mode)
-
-(flycheck-def-config-file-var flycheck-pylintrc python-pylint
- ".pylintrc"
- :safe #'stringp)
-
-(flycheck-define-checker python-pylint
- "A Python syntax and style checker using Pylint.
-
-This syntax checker requires Pylint 1.0 or newer.
-
-See URL `http://www.pylint.org/'."
- ;; -r n disables the scoring report
- :command ("pylint" "-r" "n"
- "--msg-template" "{path}:{line}:{column}:{C}:{msg_id}:{msg}"
- (config-file "--rcfile" flycheck-pylintrc)
- ;; Need `source-inplace' for relative imports (e.g. `from .foo
- ;; import bar'), see https://github.com/flycheck/flycheck/issues/280
- source-inplace)
- :error-filter
- (lambda (errors)
- (flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
- :error-patterns
- ((error line-start (file-name) ":" line ":" column ":"
- (or "E" "F") ":"
- (id (one-or-more (not (any ":")))) ":"
- (message) line-end)
- (warning line-start (file-name) ":" line ":" column ":"
- (or "W" "R") ":"
- (id (one-or-more (not (any ":")))) ":"
- (message) line-end)
- (info line-start (file-name) ":" line ":" column ":"
- "C:" (id (one-or-more (not (any ":")))) ":"
- (message) line-end))
- :modes python-mode)
-
-(flycheck-define-checker python-pycompile
- "A Python syntax checker using Python's builtin compiler.
-
-See URL `https://docs.python.org/3.4/library/py_compile.html'."
- :command ("python" "-m" "py_compile" source)
- :error-patterns
- ;; Python 2.7
- ((error line-start " File \"" (file-name) "\", line " line "\n"
- (= 2 (zero-or-more not-newline) "\n")
- "SyntaxError: " (message) line-end)
- (error line-start "Sorry: IndentationError: "
- (message) "(" (file-name) ", line " line ")"
- line-end)
- ;; 2.6
- (error line-start "SyntaxError: ('" (message (one-or-more (not (any "'"))))
- "', ('" (file-name (one-or-more (not (any "'")))) "', "
- line ", " column ", " (one-or-more not-newline) line-end))
- :modes python-mode)
-
-(flycheck-def-option-var flycheck-lintr-caching t r-lintr
- "Whether to enable caching in lintr.
-
-By default, lintr caches all expressions in a file and re-checks
-only those that have changed. Setting this option to nil
-disables caching in case there are problems."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.23"))
-
-(flycheck-def-option-var flycheck-lintr-linters "default_linters" r-lintr
- "Linters to use with lintr.
-
-The value of this variable is a string containing an R
-expression, which selects linters for lintr."
- :type 'string
- :risky t
- :package-version '(flycheck . "0.23"))
-
-(flycheck-define-checker r-lintr
- "An R style and syntax checker using the lintr package.
-
-See URL `https://github.com/jimhester/lintr'."
- :command ("R" "--slave" "--restore" "--no-save" "-e"
- (eval (concat
- "library(lintr);"
- "try(lint(commandArgs(TRUE)"
- ", cache=" (if flycheck-lintr-caching "TRUE" "FALSE")
- ", " flycheck-lintr-linters
- "))"))
- "--args" source)
- :error-patterns
- ((info line-start (file-name) ":" line ":" column ": style: " (message)
- line-end)
- (warning line-start (file-name) ":" line ":" column ": warning: " (message)
- line-end)
- (error line-start (file-name) ":" line ":" column ": error: " (message)
- line-end))
- :modes ess-mode)
-
-(flycheck-define-checker racket
- "A Racket syntax checker using the Racket compiler.
-
-See URL `http://racket-lang.org/'."
- :command ("racket" "-f" source-inplace)
- :error-patterns
- ((error line-start (file-name) ":" line ":" column ":" (message) line-end))
- :modes racket-mode)
-
-(flycheck-define-checker rpm-rpmlint
- "A RPM SPEC file syntax checker using rpmlint.
-
-See URL `http://sourceforge.net/projects/rpmlint/'."
- :command ("rpmlint" source)
- :error-patterns
- ((error line-start
- (file-name) ":" (optional line ":") " E: " (message)
- line-end)
- (warning line-start
- (file-name) ":" (optional line ":") " W: " (message)
- line-end))
- :error-filter
- ;; Add fake line numbers if they are missing in the lint output
- (lambda (errors)
- (dolist (err errors)
- (unless (flycheck-error-line err)
- (setf (flycheck-error-line err) 1)))
- errors)
- :modes (sh-mode rpm-spec-mode)
- :predicate (lambda () (or (not (eq major-mode 'sh-mode))
- ;; In `sh-mode', we need the proper shell
- (eq sh-shell 'rpm))))
-
-(defun flycheck-locate-sphinx-source-directory ()
- "Locate the Sphinx source directory for the current buffer.
-
-Return the source directory, or nil, if the current buffer is not
-part of a Sphinx project."
- (-when-let* ((filename (buffer-file-name))
- (dir (locate-dominating-file filename "conf.py")))
- (expand-file-name dir)))
-
-(flycheck-define-checker rst
- "A ReStructuredText (RST) syntax checker using Docutils.
-
-See URL `http://docutils.sourceforge.net/'."
- ;; We need to use source-inplace to properly resolve relative paths in
- ;; include:: directives
- :command ("rst2pseudoxml.py" "--report=2" "--halt=5" source-inplace)
- :error-patterns
- ((warning line-start (file-name) ":" line ": (WARNING/2) " (message) line-end)
- (error line-start
- (file-name) ":" line
- ": (" (or "ERROR/3" "SEVERE/4") ") "
- (message) line-end))
- :modes rst-mode
- ;; Don't use the generic ReST checker in Sphinx projects, because it'll
- ;; produce a lot of false positives.
- :predicate (lambda () (not (flycheck-locate-sphinx-source-directory))))
-
-(flycheck-def-option-var flycheck-sphinx-warn-on-missing-references t rst-sphinx
- "Whether to warn about missing references in Sphinx.
-
-When non-nil (the default), warn about all missing references in
-Sphinx via `-n'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.17"))
-
-(flycheck-define-checker rst-sphinx
- "A ReStructuredText (RST) syntax checker using Sphinx.
-
-Requires Sphinx 1.2 or newer. See URL `http://sphinx-doc.org'."
- :command ("sphinx-build" "-b" "pseudoxml"
- "-q" "-N" ; Reduced output and no colors
- (option-flag "-n" flycheck-sphinx-warn-on-missing-references)
- (eval (flycheck-locate-sphinx-source-directory))
- temporary-directory ; Redirect the output to a temporary
- ; directory
- source-original) ; Sphinx needs the original document
- :error-patterns
- ((warning line-start (file-name) ":" line ": WARNING: " (message) line-end)
- (error line-start
- (file-name) ":" line
- ": " (or "ERROR" "SEVERE") ": "
- (message) line-end))
- :modes rst-mode
- :predicate (lambda () (and (flycheck-buffer-saved-p)
- (flycheck-locate-sphinx-source-directory))))
-
-(flycheck-def-config-file-var flycheck-rubocoprc ruby-rubocop ".rubocop.yml"
- :safe #'stringp)
-
-(flycheck-def-option-var flycheck-rubocop-lint-only nil ruby-rubocop
- "Whether to only report code issues in Rubocop.
-
-When non-nil, only report code issues in Rubocop, via `--lint'.
-Otherwise report style issues as well."
- :safe #'booleanp
- :type 'boolean
- :package-version '(flycheck . "0.16"))
-
-(flycheck-define-checker ruby-rubocop
- "A Ruby syntax and style checker using the RuboCop tool.
-
-See URL `http://batsov.com/rubocop/'."
- :command ("rubocop" "--display-cop-names" "--format" "emacs"
- (config-file "--config" flycheck-rubocoprc)
- (option-flag "--lint" flycheck-rubocop-lint-only)
- source)
- :error-patterns
- ((info line-start (file-name) ":" line ":" column ": C: "
- (optional (id (one-or-more (not (any ":")))) ": ") (message) line-end)
- (warning line-start (file-name) ":" line ":" column ": W: "
- (optional (id (one-or-more (not (any ":")))) ": ") (message)
- line-end)
- (error line-start (file-name) ":" line ":" column ": " (or "E" "F") ": "
- (optional (id (one-or-more (not (any ":")))) ": ") (message)
- line-end))
- :modes (enh-ruby-mode ruby-mode)
- :next-checkers ((warning . ruby-rubylint)))
-
-;; Default to `nil' to let Rubylint find its configuration file by itself, and
-;; to maintain backwards compatibility with older Rubylint and Flycheck releases
-(flycheck-def-config-file-var flycheck-rubylintrc ruby-rubylint nil
- :safe #'stringp)
-
-(flycheck-define-checker ruby-rubylint
- "A Ruby syntax and code analysis checker using ruby-lint.
-
-Requires ruby-lint 2.0 or newer. To use `flycheck-rubylintrc',
-ruby-lint 2.0.2 or newer is required. See URL
-`https://github.com/YorickPeterse/ruby-lint'."
- :command ("ruby-lint" "--presenter=syntastic"
- (config-file "--config" flycheck-rubylintrc)
- source)
- :error-patterns
- ((info line-start
- (file-name) ":I:" line ":" column ": " (message) line-end)
- (warning line-start
- (file-name) ":W:" line ":" column ": " (message) line-end)
- (error line-start
- (file-name) ":E:" line ":" column ": " (message) line-end))
- :modes (enh-ruby-mode ruby-mode))
-
-(flycheck-define-checker ruby
- "A Ruby syntax checker using the standard Ruby interpreter.
-
-Please note that the output of different Ruby versions and
-implementations varies wildly. This syntax checker supports
-current versions of MRI and JRuby, but may break when used with
-other implementations or future versions of these
-implementations.
-
-Please consider using `ruby-rubocop' or `ruby-rubylint' instead.
-
-See URL `https://www.ruby-lang.org/'."
- :command ("ruby" "-w" "-c" source)
- :error-patterns
- ;; These patterns support output from JRuby, too, to deal with RVM or Rbenv
- ((error line-start
- "SyntaxError in " (file-name) ":" line ": " (message)
- line-end)
- (warning line-start
- (file-name) ":" line ":" (optional column ":")
- " warning: " (message) line-end)
- (error line-start (file-name) ":" line ": " (message) line-end))
- :modes (enh-ruby-mode ruby-mode)
- :next-checkers ((warning . ruby-rubylint)))
-
-(flycheck-define-checker ruby-jruby
- "A Ruby syntax checker using the JRuby interpreter.
-
-This syntax checker is very primitive, and may break on future
-versions of JRuby.
-
-Please consider using `ruby-rubocop' or `ruby-rubylint' instead.
-
-See URL `http://jruby.org/'."
- :command ("jruby" "-w" "-c" source)
- :error-patterns
- ((error line-start
- "SyntaxError in " (file-name) ":" line ": " (message)
- line-end)
- (warning line-start (file-name) ":" line " warning: " (message) line-end)
- (error line-start (file-name) ":" line ": " (message) line-end))
- :modes (enh-ruby-mode ruby-mode)
- :next-checkers ((warning . ruby-rubylint)))
-
-(flycheck-def-args-var flycheck-rust-args rust
- :package-version '(flycheck . "0.24"))
-
-(flycheck-def-option-var flycheck-rust-check-tests t rust
- "Whether to check test code in Rust.
-
-When non-nil, `rustc' is passed the `--test' flag, which will
-check any code marked with the `#[cfg(test)]' attribute and any
-functions marked with `#[test]'. Otherwise, `rustc' is not passed
-`--test' and test code will not be checked. Skipping `--test' is
-necessary when using `#![no_std]', because compiling the test
-runner requires `std'."
- :type 'boolean
- :safe #'booleanp
- :package-version '("flycheck" . "0.19"))
-
-(flycheck-def-option-var flycheck-rust-crate-root nil rust
- "A path to the crate root for the current buffer.
-
-The value of this variable is either a string with the path to
-the crate root for the current buffer, or nil if the current buffer
-is a crate. A relative path is relative to the current buffer.
-
-If this variable is non nil the current buffer will only be checked
-if it is not modified, i.e. after it has been saved."
- :type 'string
- :package-version '(flycheck . "0.20")
- :safe #'stringp)
-(make-variable-buffer-local 'flycheck-rust-crate-root)
-
-(flycheck-def-option-var flycheck-rust-crate-type "lib" rust
- "The type of the Rust Crate to check.
-
-The value of this variable is a string denoting the crate type,
-for the `--crate-type' flag."
- :type 'string
- :safe #'stringp
- :package-version '("flycheck" . "0.20"))
-(make-variable-buffer-local 'flycheck-rust-crate-type)
-
-(flycheck-def-option-var flycheck-rust-library-path nil rust
- "A list of library directories for Rust.
-
-The value of this variable is a list of strings, where each
-string is a directory to add to the library path of Rust.
-Relative paths are relative to the file being checked."
- :type '(repeat (directory :tag "Library directory"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.18"))
-
-(flycheck-define-checker rust
- "A Rust syntax checker using Rust compiler.
-
-This syntax checker needs Rust 1.0.0 alpha or newer.
-
-See URL `http://www.rust-lang.org'."
- :command ("rustc" "-Z" "no-trans"
- (option "--crate-type" flycheck-rust-crate-type)
- (option-flag "--test" flycheck-rust-check-tests)
- (option-list "-L" flycheck-rust-library-path concat)
- (eval flycheck-rust-args)
- (eval (or flycheck-rust-crate-root
- (flycheck-substitute-argument 'source-inplace 'rust))))
- :error-patterns
- ((error line-start (file-name) ":" line ":" column ": "
- (one-or-more digit) ":" (one-or-more digit) " error: "
- (or
- ;; Multiline errors
- (and (message (minimal-match (one-or-more anything)))
- " [" (id "E" (one-or-more digit)) "]")
- (message))
- line-end)
- (warning line-start (file-name) ":" line ":" column ": "
- (one-or-more digit) ":" (one-or-more digit) " warning: "
- (message) line-end)
- (info line-start (file-name) ":" line ":" column ": "
- (one-or-more digit) ":" (one-or-more digit) " " (or "note" "help") ": "
- (message) line-end))
- :modes rust-mode
- :predicate (lambda ()
- (or (not flycheck-rust-crate-root) (flycheck-buffer-saved-p))))
-
-(defvar flycheck-sass-scss-cache-directory nil
- "The cache directory for `sass' and `scss'.")
-
-(defun flycheck-sass-scss-cache-location ()
- "Get the cache location for `sass' and `scss'.
-
-If no cache directory exists yet, create one and return it.
-Otherwise return the previously used cache directory."
- (setq flycheck-sass-scss-cache-directory
- (or flycheck-sass-scss-cache-directory
- (make-temp-file "flycheck-sass-scss-cache" 'directory))))
-
-(flycheck-def-option-var flycheck-sass-compass nil sass
- "Whether to enable the Compass CSS framework.
-
-When non-nil, enable the Compass CSS framework, via `--compass'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.16"))
-
-(flycheck-define-checker sass
- "A Sass syntax checker using the Sass compiler.
-
-See URL `http://sass-lang.com'."
- :command ("sass"
- "--cache-location" (eval (flycheck-sass-scss-cache-location))
- (option-flag "--compass" flycheck-sass-compass)
- "-c" source)
- :error-patterns
- ((error line-start "Syntax error on line " line ": " (message))
- (warning line-start "WARNING on line " line " of " (file-name)
- ":" (optional "\r") "\n" (message) line-end)
- (error line-start
- (or "Syntax error: " "Error: ")
- (message (one-or-more not-newline)
- (zero-or-more "\n"
- (one-or-more " ")
- (one-or-more not-newline)))
- (optional "\r") "\n on line " line " of " (file-name)
- line-end))
- :modes sass-mode)
-
-(flycheck-define-checker scala
- "A Scala syntax checker using the Scala compiler.
-
-See URL `http://www.scala-lang.org/'."
- :command ("scalac" "-Ystop-after:parser" source)
- :error-patterns
- ((error line-start (file-name) ":" line ": error: " (message) line-end))
- :modes scala-mode
- :next-checkers ((warning . scala-scalastyle)))
-
-(flycheck-def-config-file-var flycheck-scalastylerc scala-scalastyle nil
- :safe #'stringp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-def-option-var flycheck-scalastyle-jar nil scala-scalastyle
- "The path to the main JAR file of Scalastyle.
-
-If this option is nil, or points to a non-existing file,
-`scala-scalastyle' can not be used."
- :type '(file :must-match t)
- :safe #'stringp
- :package-version '(flycheck . "0.20"))
-
-(flycheck-define-checker scala-scalastyle
- "A Scala style checker using scalastyle.
-
-Note that this syntax checker is not used if
-`flycheck-scalastyle-jar' or `flycheck-scalastylerc' are nil or
-point to non-existing files.
-
-See URL `http://www.scalastyle.org'."
- :command ("java"
- (option "-jar" flycheck-scalastyle-jar)
- (config-file "-c" flycheck-scalastylerc)
- source)
- :error-patterns
- ((error line-start "error file=" (file-name) " message="
- (message) " line=" line (optional " column=" column) line-end)
- (warning line-start "warning file=" (file-name) " message="
- (message) " line=" line (optional " column=" column) line-end))
- :modes scala-mode
- :predicate
- ;; Inhibit this syntax checker if the JAR or the configuration are unset or
- ;; missing
- (lambda () (and flycheck-scalastyle-jar flycheck-scalastylerc
- (file-exists-p flycheck-scalastyle-jar)
- (file-exists-p (flycheck-locate-config-file
- flycheck-scalastylerc 'scala-scalastyle)))))
-
-(defconst flycheck-scss-lint-checkstyle-re
- (rx "cannot load such file" (1+ not-newline) "scss_lint_reporter_checkstyle")
- "Regular expression to parse missing checkstyle error.")
-
-(defun flycheck-parse-scss-lint (output checker buffer)
- "Parse SCSS-Lint OUTPUT from CHECKER and BUFFER.
-
-Like `flycheck-parse-checkstyle', but catches errors about
-missing checkstyle reporter from SCSS-Lint."
- (if (string-match-p flycheck-scss-lint-checkstyle-re output)
- (list (flycheck-error-new-at
- 1 nil 'error "Checkstyle reporter for SCSS-Lint missing.
-Please run gem install scss_lint_reporter_checkstyle"
- :checker checker
- :buffer buffer
- :filename (buffer-file-name buffer)))
- (flycheck-parse-checkstyle output checker buffer)))
-
-(flycheck-def-config-file-var flycheck-scss-lintrc scss-lint ".scss-lint.yml"
- :safe #'stringp
- :package-version '(flycheck . "0.23"))
-
-(flycheck-define-checker scss-lint
- "A SCSS syntax checker using SCSS-Lint.
-
-See URL `https://github.com/brigade/scss-lint'."
- :command ("scss-lint"
- "--require=scss_lint_reporter_checkstyle"
- "--format=Checkstyle"
- (config-file "--config" flycheck-scss-lintrc)
- source)
- ;; We cannot directly parse Checkstyle XML, since for some mysterious reason
- ;; SCSS-Lint doesn't have a built-in Checkstyle reporter, and instead ships it
- ;; as an addon which might not be installed. We use a custom error parser to
- ;; check whether the addon is missing and turn that into a special kind of
- ;; Flycheck error.
- :error-parser flycheck-parse-scss-lint
- :modes scss-mode)
-
-(flycheck-def-option-var flycheck-scss-compass nil scss
- "Whether to enable the Compass CSS framework.
-
-When non-nil, enable the Compass CSS framework, via `--compass'."
- :type 'boolean
- :safe #'booleanp
- :package-version '(flycheck . "0.16"))
-
-(flycheck-define-checker scss
- "A SCSS syntax checker using the SCSS compiler.
-
-See URL `http://sass-lang.com'."
- :command ("scss"
- "--cache-location" (eval (flycheck-sass-scss-cache-location))
- (option-flag "--compass" flycheck-scss-compass)
- "-c" source)
- :error-patterns
- ((error line-start "Syntax error on line " line ": " (message))
- (warning line-start "WARNING on line " line " of " (file-name)
- ":" (optional "\r") "\n" (message) line-end)
- (error line-start
- (or "Syntax error: " "Error: ")
- (message (one-or-more not-newline)
- (zero-or-more "\n"
- (one-or-more " ")
- (one-or-more not-newline)))
- (optional "\r") "\n" (one-or-more " ") "on line " line " of " (file-name)
- line-end))
- :modes scss-mode)
-
-(flycheck-define-checker sh-bash
- "A Bash syntax checker using the Bash shell.
-
-See URL `http://www.gnu.org/software/bash/'."
- :command ("bash" "--norc" "-n" "--" source)
- :error-patterns ((error line-start
- (file-name) ":" (one-or-more (not (any digit)))
- line (zero-or-more " ") ":" (zero-or-more " ")
- (message) line-end))
- :modes sh-mode
- :predicate (lambda () (eq sh-shell 'bash))
- :next-checkers ((warning . sh-shellcheck)))
-
-(flycheck-define-checker sh-posix-dash
- "A POSIX Shell syntax checker using the Dash shell.
-
-See URL `http://gondor.apana.org.au/~herbert/dash/'."
- :command ("dash" "-n" source)
- :error-patterns
- ((error line-start (file-name) ": " line ": " (backref 1) ": " (message)))
- :modes sh-mode
- :predicate (lambda () (eq sh-shell 'sh))
- :next-checkers ((warning . sh-shellcheck)))
-
-(flycheck-define-checker sh-posix-bash
- "A POSIX Shell syntax checker using the Bash shell.
-
-See URL `http://www.gnu.org/software/bash/'."
- :command ("bash" "--posix" "--norc" "-n" "--" source)
- :error-patterns
- ((error line-start
- (file-name) ":" (one-or-more (not (any digit)))
- line (zero-or-more " ") ":" (zero-or-more " ")
- (message) line-end))
- :modes sh-mode
- :predicate (lambda () (eq sh-shell 'sh))
- :next-checkers ((warning . sh-shellcheck)))
-
-(flycheck-define-checker sh-zsh
- "A Zsh syntax checker using the Zsh shell.
-
-See URL `http://www.zsh.org/'."
- :command ("zsh" "-n" "-d" "-f" source)
- :error-patterns
- ((error line-start (file-name) ":" line ": " (message) line-end))
- :modes sh-mode
- :predicate (lambda () (eq sh-shell 'zsh))
- :next-checkers ((warning . sh-shellcheck)))
-
-(defconst flycheck-shellcheck-supported-shells '(bash ksh88 sh)
- "Shells supported by ShellCheck.")
-
-(flycheck-def-option-var flycheck-shellcheck-excluded-warnings nil sh-shellcheck
- "A list of excluded warnings for ShellCheck.
-
-The value of this variable is a list of strings, where each
-string is a warning code to be excluded from ShellCheck reports.
-By default, no warnings are excluded."
- :type '(repeat :tag "Excluded warnings"
- (string :tag "Warning code"))
- :safe #'flycheck-string-list-p
- :package-version '(flycheck . "0.21"))
-
-(flycheck-define-checker sh-shellcheck
- "A shell script syntax and style checker using Shellcheck.
-
-See URL `https://github.com/koalaman/shellcheck/'."
- :command ("shellcheck"
- "--format" "checkstyle"
- "--shell" (eval (symbol-name sh-shell))
- (option "--exclude" flycheck-shellcheck-excluded-warnings list
- flycheck-option-comma-separated-list)
- source)
- :error-parser flycheck-parse-checkstyle
- :error-filter flycheck-dequalify-error-ids
- :modes sh-mode
- :predicate (lambda () (memq sh-shell flycheck-shellcheck-supported-shells)))
-
-(flycheck-define-checker slim
- "A Slim syntax checker using the Slim compiler.
-
-See URL `http://slim-lang.com'."
- :command ("slimrb" "-c" source)
- :error-patterns
- ((error line-start
- "Slim::Parser::SyntaxError:" (message) (optional "\r") "\n "
- (file-name) ", Line " line (optional ", Column " column)
- line-end))
- :modes slim-mode)
-
-(flycheck-def-config-file-var flycheck-chktexrc tex-chktex ".chktexrc"
- :safe #'stringp)
-
-(flycheck-define-checker tex-chktex
- "A TeX and LaTeX syntax and style checker using chktex.
-
-See URL `http://www.nongnu.org/chktex/'."
- :command ("chktex" (config-file "-l" flycheck-chktexrc) "-v0" "-q" "-I"
- source-inplace)
- :error-patterns
- ((warning line-start (file-name) ":" line ":" column ":"
- (id (one-or-more digit)) ":" (message) line-end))
- :error-filter
- (lambda (errors)
- (flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
- :modes (latex-mode plain-tex-mode))
-
-(flycheck-define-checker tex-lacheck
- "A LaTeX syntax and style checker using lacheck.
-
-See URL `http://www.ctan.org/pkg/lacheck'."
- :command ("lacheck" source-inplace)
- :error-patterns
- ((warning line-start
- "\"" (file-name) "\", line " line ": " (message)
- line-end))
- :modes latex-mode)
-
-(flycheck-define-checker texinfo
- "A Texinfo syntax checker using makeinfo.
-
-See URL `http://www.gnu.org/software/texinfo/'."
- :command ("makeinfo" "-o" null-device source-inplace)
- :error-patterns
- ((warning line-start (file-name) ":"
- line (optional ":" column) ": "
- "warning: " (message) line-end)
- (error line-start (file-name) ":"
- line (optional ":" column) ": "
- (message) line-end))
- :modes texinfo-mode)
-
-(flycheck-define-checker verilog-verilator
- "A Verilog syntax checker using the Verilator Verilog HDL simulator.
-
-See URL `http://www.veripool.org/wiki/verilator'."
- :command ("verilator" "--lint-only" "-Wall" source)
- :error-patterns
- ((warning line-start "%Warning-" (zero-or-more not-newline) ": "
- (file-name) ":" line ": " (message) line-end)
- (error line-start "%Error: " (file-name) ":"
- line ": " (message) line-end))
- :modes verilog-mode)
-
-(flycheck-define-checker xml-xmlstarlet
- "A XML syntax checker and validator using the xmlstarlet utility.
-
-See URL `http://xmlstar.sourceforge.net/'."
- :command ("xmlstarlet" "val" "-e" "-q" source)
- :error-patterns
- ((error line-start (file-name) ":" line "." column ": " (message) line-end))
- :modes (xml-mode nxml-mode))
-
-(flycheck-define-checker xml-xmllint
- "A XML syntax checker and validator using the xmllint utility.
-
-The xmllint is part of libxml2, see URL
-`http://www.xmlsoft.org/'."
- :command ("xmllint" "--noout" source)
- :error-patterns
- ((error line-start (file-name) ":" line ": " (message) line-end))
- :modes (xml-mode nxml-mode))
-
-(flycheck-define-checker yaml-jsyaml
- "A YAML syntax checker using JS-YAML.
-
-See URL `https://github.com/nodeca/js-yaml'."
- :command ("js-yaml" source)
- :error-patterns
- ((error line-start
- "JS-YAML: " (message) " at line " line ", column " column ":"
- line-end))
- :modes yaml-mode)
-
-(flycheck-define-checker yaml-ruby
- "A YAML syntax checker using Ruby's YAML parser.
-
-This syntax checker uses the YAML parser from Ruby's standard
-library.
-
-See URL `http://www.ruby-doc.org/stdlib-2.0.0/libdoc/yaml/rdoc/YAML.html'."
- :command ("ruby" "-ryaml" "-e" "begin;
- file_name = ARGV[0]; \
- YAML.load(ARGF); \
- rescue Exception => e; \
- STDERR.puts \"#{file_name}:#{e}\"; \
- end" source)
- :error-patterns
- (;; Syck (Ruby <= 1.9.2, unmaintained)
- (error line-start (file-name)
- ":syntax error on line " line ", col " column ": `" (message) "'" line-end)
- ;; Psych (Ruby >= 1.9.3)
- (error line-start (file-name) ":" (zero-or-more not-newline) ":" (message)
- "at line " line " column " column line-end))
- :modes yaml-mode)
-
-(provide 'flycheck)
-
-;; Local Variables:
-;; coding: utf-8
-;; indent-tabs-mode: nil
-;; End:
-
-;;; flycheck.el ends here
+++ /dev/null
-This is flycheck.info, produced by makeinfo version 5.2 from
-flycheck.texi.
-
-Modern on-the-fly syntax checking for GNU Emacs 24.
-
- Copyright © 2014–2015 Sebastian Wiesner
-
- Permission is granted to copy, distribute and/or modify this
- document under the terms of the GNU Free Documentation License,
- Version 1.3 or any later version published by the Free Software
- Foundation; with no Invariant Sections, no Front-Cover Texts, and
- no Back-Cover Texts. A copy of the license is included in the
- section entitled “GNU Free Documentation License”.
-
- A copy of the license is also available from the Free Software
- Foundation Web site at <http://www.gnu.org/licenses/fdl.html>.
-
- Alternatively, you may copy, distribute and/or modify this
- documentation under the terms of the Creative Commons
- Attribution-ShareAlike 4.0 International Public License. A copy of
- the license can be obtained at
- <https://creativecommons.org/licenses/by-sa/4.0/legalcode>.
-INFO-DIR-SECTION Emacs
-START-INFO-DIR-ENTRY
-* Flycheck: (flycheck). Modern on-the-fly syntax checking
-END-INFO-DIR-ENTRY
-
-\1f
-File: flycheck.info, Node: Top, Next: Introduction, Up: (dir)
-
-Flycheck
-********
-
-Modern on-the-fly syntax checking for GNU Emacs 24.
-
- Copyright © 2014–2015 Sebastian Wiesner
-
- Permission is granted to copy, distribute and/or modify this
- document under the terms of the GNU Free Documentation License,
- Version 1.3 or any later version published by the Free Software
- Foundation; with no Invariant Sections, no Front-Cover Texts, and
- no Back-Cover Texts. A copy of the license is included in the
- section entitled “GNU Free Documentation License”.
-
- A copy of the license is also available from the Free Software
- Foundation Web site at <http://www.gnu.org/licenses/fdl.html>.
-
- Alternatively, you may copy, distribute and/or modify this
- documentation under the terms of the Creative Commons
- Attribution-ShareAlike 4.0 International Public License. A copy of
- the license can be obtained at
- <https://creativecommons.org/licenses/by-sa/4.0/legalcode>.
-
- Flycheck is a modern GNU Emacs package that provides on-the-fly
-syntax checking for buffers. It is intended as replacement for the
-older Flymake package which is built into Emacs.
-
- *Note Introduction::, for more information about Flycheck. For
-installations instructions and a quick tutorial, *note Installation::
-and *note Quickstart:: respectively. *Note Usage::, for a detailed user
-guide.
-
-* Menu:
-
-* Introduction:: An introduction to Flycheck
-* Installation:: How to install Flycheck
-* Quickstart:: A quick Flycheck tutorial
-* Usage:: How to use Flycheck
-* Syntax checker definitions:: How to add new syntax checkers to Flycheck
-* Flycheck hooks:: How to hook into Flycheck
-* Flycheck API:: API documentation
-* Supported languages:: A list of supported languages
-* Issues:: How to report issues in Flycheck
-* GNU Free Documentation License:: How to copy this manual
-* Main Index:: Index of Flycheck concepts
-* Key Index:: Index of all keybindings
-* Function and Variable Index:: Index of commands, options and types
-
-\1f
-File: flycheck.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top
-
-1 Introduction
-**************
-
-Flycheck provides modern on-the-fly syntax checking extension for GNU
-Emacs 24, intended as replacement for the older Flymake extension which
-is part of GNU Emacs.
-
- Flycheck runs various linting tools and services to automatically
-check the contents of buffers while you are typing, and reports warnings
-and errors directly in the buffer, in the mode line and in an optional
-error list. You can navigate errors and warnings in the current buffer,
-show the corresponding messages, and copy errors to the kill ring.
-
- • Over 40 languages with more than 70 checkers. *Note Supported
- languages::.
- • Fully automatic, fail-safe, on-the-fly syntax checking in buffers
- • In-buffer error highlighting, with fringe indicators
- • Error navigation
- • Auto-updating error list
- • Many customisation options
- • A comprehensive manual
- • A simple API to add support for new languages and tools
- • A “doesn’t get in your way guarantee”
-
-\1f
-File: flycheck.info, Node: Installation, Next: Quickstart, Prev: Introduction, Up: Top
-
-2 Installation
-**************
-
-2.1 Prerequisites
-=================
-
-Flycheck needs GNU Emacs 24. Older releases of GNU Emacs or other
-flavours of Emacs (e.g. XEmacs, Aquamacs, etc.) are _not_ supported.
-
- Flycheck works best on Unix-like operating systems. It is
-extensively tested on Linux and OS X.
-
- *Warning:* Flycheck tries to maintain compatibility with Windows as
-well, and generally works well on Windows. Pull requests which fix or
-improve Windows compatibility are _very_ welcome. However, Flycheck
-does not explicitly support Windows. If there are issues or problems on
-Windows, _you are on your own_. The Flycheck developers cannot answer
-questions about Windows, or fix Windows-specific issues.
-
-2.2 Syntax checking tools
-=========================
-
-Flycheck does _not_ check buffers itself. It relies on _external_
-programs to check buffers, which need to be installed separately. *Note
-Supported languages::, for a list of required programs for each language
-supported by Flycheck.
-
- Most of these programs are available in the package repositories of
-Linux distributions, or with the standard package managers of specific
-programming languages (e.g. Rubygems, NPM, Cabal, etc.)
-
-2.3 Installation
-================
-
-Install Flycheck via Emacs’ built-in package manager, from the MELPA
-Stable (http://stable.melpa.org) repository:
-
- M-x package-install RET flycheck
-
- Alternatively, you may use the MELPA (http://melpa.org) repository,
-which hosts the most recent development version. Note that these
-repositories are not included in GNU Emacs by default.
-
- You need to enable them explicitly, by adding the following to your
-init file:
-
- (require 'package)
- (add-to-list 'package-archives
- '("melpa" . "http://melpa.org/packages/") t)
- (package-initialize)
-
- *Warning:* Flycheck is available from Marmalade
-(https://marmalade-repo.org/), but due to frequent outages of this
-repository we recommend against it.
-
-2.4 Cask
-========
-
-If you use Cask (https://github.com/cask/cask) to manage your packages,
-add the following to your ‘Cask’ file:
-
- (source gnu)
- (source melpa-stable)
-
- (depends-on "flycheck")
-
-\1f
-File: flycheck.info, Node: Quickstart, Next: Usage, Prev: Installation, Up: Top
-
-3 Quickstart
-************
-
-3.1 Install and enable Flycheck
-===============================
-
-To get started with Flycheck, enable it by adding the following to your
-init file:
-
- (add-hook 'after-init-hook #'global-flycheck-mode)
-
- If you don’t know where your init file is take a look at the value of
-the variable ‘user-init-file’ with ‘C-h v user-init-file’.
-
-3.2 Install syntax checker tools
-================================
-
-Next you need to install syntax checking tools for the major modes you
-are using. For instance, for Python you may want to install Pylint
-(http://pylint.org):
-
- $ pip install pylint
-
- For Ruby, you might want to use Rubocop
-(https://github.com/bbatsov/rubocop) and ruby-lint
-(https://github.com/YorickPeterse/ruby-lint):
-
- $ gem install rubocop ruby-lint
-
- *Note Supported languages::, for a complete list of all languages
-that Flycheck supports.
-
-3.3 Check syntax in a buffer
-============================
-
-Now switch to a Python or Ruby Mode buffer and run ‘M-x
-flycheck-verify-setup’ to check whether Flycheck is correctly setup.
-
- If everything is fine Flycheck will now check syntax using these
-tools, when you visit a buffer in any of these languages. Syntax
-checking happens _automatically_ when you save the buffer or make any
-changes. Flycheck highlights errors and warnings in the buffer,
-indicates them in the fringe, and reports their numbers in the mode
-line.
-
- You can also manually check a buffer with ‘C-c ! c’
-(‘flycheck-buffer’).
-
-3.4 Navigate and list errors
-============================
-
-Use ‘C-c ! n’ (‘flycheck-next-error’) and ‘C-c ! p’
-(‘flycheck-previous-error’) to navigate between error locations. If you
-keep the point at an error location, Flycheck will show the error
-message in the echo area after a short delay. You can also hover error
-locations with the mouse and see the error message in a tooltip.
-
- To get an overview of all errors and warnings in the current buffer,
-type ‘C-c ! l’ (‘flycheck-list-errors’) to pop up a list of all errors
-in your current buffer. The error list updates automatically when you
-fix errors or introduce new ones, or when you switch to another buffer.
-
-3.5 More features
-=================
-
-All Flycheck commands are available in the Emacs menu at ‘Syntax
-checking’ in the ‘Tools’ menu.
-
- The same menu is also available by clicking on the mode line lighter
-of Flycheck.
-
-\1f
-File: flycheck.info, Node: Usage, Next: Syntax checker definitions, Prev: Quickstart, Up: Top
-
-4 Usage
-*******
-
-This chapter explains the usage of Flycheck in-depth.
-
- *Note:* All commands in this chapter are documented with their
-default key prefix ‘C-c !’. You can customise this prefix with
-‘flycheck-keymap-prefix’, but remember your custom prefix while reading
-this chapter.
-
-* Menu:
-
-* Checking buffers:: How buffers are checked
-* Syntax checkers:: Tools used to check a buffer
-* Reporting results:: How results of checks are reported
-* Navigating errors:: How to navigate to Flycheck errors
-* Displaying errors:: How to display error messages
-* Killing errors:: How to put error messages into the kill ring
-* Listing errors:: How to show a list of all errors
-* Mode line display:: How to interpret Flycheck’s mode line
-* Configuring checkers:: How to configure syntax checkers
-
-\1f
-File: flycheck.info, Node: Checking buffers, Next: Syntax checkers, Up: Usage
-
-4.1 Checking buffers
-====================
-
-The minor mode ‘flycheck-mode’ enables syntax checking in a single
-buffer. ‘global-flycheck-mode’ automatically enables ‘flycheck-mode’
-all buffers whenever possible. You can exclude specific major modes
-from ‘global-flycheck-mode’ with ‘flycheck-global-modes’.
-
- *Note:* ‘global-flycheck-mode’ does not enable ‘flycheck-mode’ for
-remote or encrypted files. The former is flaky and might be very slow,
-and the latter would leak confidential data to temporary directories.
-You may still check syntax in these buffers by manually enabling
-‘flycheck-mode’ with ‘M-x flycheck-mode’. However, this is _not_
-recommended for said reasons.
-
- Add the following code to your init file to enable syntax checking
-permanently:
-
- (add-hook 'after-init-hook #'global-flycheck-mode)
-
- When ‘flycheck-mode’ is enabled, Flycheck automatically checks a
-buffer whenever
-
- • the buffer is saved,
- • new lines are inserted,
- • or a short time after you stopped to make changes to the buffer.
-
- You can customise this behaviour by changing
-‘flycheck-check-syntax-automatically’:
-
- -- User Option: flycheck-check-syntax-automatically
- A list of events that trigger a new syntax check in the current
- buffer:
-
- ‘save’
- Check the buffer immediately after it was saved.
- ‘idle-change’
- Check the buffer a short time after the last change to the
- buffer. The delay is customisable with
- ‘flycheck-idle-change-delay’.
- ‘new-line’
- Check the buffer immediately after a new line was inserted.
- ‘mode-enabled’
- Check the buffer immediately after Flycheck Mode was enabled.
-
- For instance, with the following code in your init file Flycheck
- will only check the buffer when it is saved, but never while you
- are making changes to the buffer:
-
- (setq flycheck-check-syntax-automatically '(mode-enabled save))
-
- In addition to automatic syntax checking you can always check the
-current buffer manually:
-
-‘C-c ! c’
-‘M-x flycheck-buffer’
- Check syntax in the current buffer.
-
-*Note:* If syntax checking does not work, please check your setup:
-
-‘C-c ! v’
-‘M-x flycheck-verify-setup’
- Popup a buffer with information about the Flycheck setup for the
- current buffer.
-
- Lists the syntax checkers available for the current buffer,
- together with potential problems in their setup.
-
- During syntax checks Flycheck creates temporary files to feed to
-contents of the current buffer to external programs. You can change the
-prefix used for the names of these temporary files with
-‘flycheck-temp-prefix’.
-
-\1f
-File: flycheck.info, Node: Syntax checkers, Next: Reporting results, Prev: Checking buffers, Up: Usage
-
-4.2 Syntax checkers
-===================
-
-Flycheck does not check buffers by itself, but relies on external
-_syntax checkers_. When checking a buffer Flycheck automatically
-selects the best syntax checker from ‘flycheck-checkers’:
-
- -- User Option: flycheck-checkers
- A list of all syntax checkers available for syntax checking.
-
- A syntax checker in this list is a _registered_ syntax checker.
-
- Flycheck may apply further syntax checkers to the current buffer, if
-the selected syntax checker _chains_ to other syntax checkers. For
-instance, the ‘emacs-lisp’ syntax checker, which checks Emacs Lisp with
-Emacs’ byte compiler, _chains_ to the ‘emacs-lisp-checkdoc’ syntax
-checker, which checks Emacs Lisp for violations of documentation
-conventions, *note (elisp)Documentation Tips::. In Emacs Lisp buffers,
-Flycheck will first use ‘emacs-lisp’, and then ‘emacs-lisp-checkdoc’.
-
- Flycheck ignores chained checkers which are not contained in
-‘flycheck-checkers’.
-
- Like everything else in GNU Emacs, syntax checkers have online
-documentation as well. If you are interested what major modes a
-particular syntax checker in ‘flycheck-checkers’ supports, or what tool
-it uses, type <C-c ! ?>:
-
-‘C-c ! ?’
-‘M-x flycheck-describe-checker’
- Prompt for a syntax checker and show its documentation.
-
- The documentation includes the name of the program or service used
- by the syntax checker, a list of major modes in which the checker
- will be used, and a list of its options.
-
- Instead of letting Flycheck select a syntax checker automatically you
-can also explicitly tell Flycheck which checker to use for the current
-buffer, by manually selecting a specific syntax checker:
-
-‘C-c ! s’
-‘M-x flycheck-select-checker’
- Prompt for a syntax checker and select this syntax checker for the
- current buffer.
-
-‘C-u C-c ! s’
-‘C-u M-x flycheck-select-checker’ Remove any manual
- syntax checker selection for the current buffer, and let Flycheck
- automatically select a syntax checker from ‘flycheck-checkers’
- again.
-
- You can also select a syntax checker via the variable
-‘flycheck-checker’. In fact, ‘flycheck-select-checker’ just sets this
-variable accordingly:
-
- -- Variable: flycheck-checker
- A syntax checker to use for the current buffer.
-
- If nil (the default), Flycheck will automatically select the best
- checker from ‘flycheck-checkers’.
-
- If set to a syntax checker, Flycheck will use this syntax checker
- for the current buffer, and never automatically select any other.
- Flycheck still runs chained checkers, though.
-
- If the syntax checker selected by this variable does not work in
- the current buffer, Flycheck signals an error.
-
- You can set this variable locally. For instance, if your Python
- project mandates Flake8 (http://flake8.readthedocs.org/en/2.2.3/)
- as a syntax checker, you can tell Flycheck to only use the
- corresponding checker ‘python-flake8’ in Python files of your
- project by setting ‘flycheck-checker’ as a directory-local variable
- in the top-level directory of your project with ‘M-x
- add-dir-local-variable RET python-mode RET flycheck-checker RET
- python-flake8’. *Note (emacs)Directory Variables::, for more
- information about directory variables.
-
- Occasionally you may want to disable specific syntax checkers
-completely, so that they can never be used at all, neither via automatic
-nor via manual selection:
-
-‘C-c ! x’
-‘M-x flycheck-disable-checker’
- Prompt for a syntax checker to disable in the current buffer.
-
-‘C-u C-c ! x’
-‘C-u M-x flycheck-disable-checker’
- Prompt for a syntax checker to re-enable in the current buffer.
-
- This is particularly useful if you want to disable syntax checkers
-that are chained after others. For instance, if you do not care for
-documentation conventions of Emacs Lisp you may not need for the
-‘emacs-lisp-checkdoc’ checker, so you can disable it for the current
-buffer with <M-x flycheck-disable-checker RET emacs-lisp-checkdoc>.
-
- ‘flycheck-disable-checker’ acutally sets the buffer-local value of
-the ‘flycheck-disabled-checkers’ option:
-
- -- User Option: flycheck-disabled-checkers
- A list of disabled syntax checkers. Flycheck will _never_ use
- disabled syntax checkers to check a buffer.
-
- You can customise this variable with <M-x customize-variable RET
- flycheck-disabled-checkers> or set its default value in your init
- file to permanently disable specific checkers. For instance, to
- permanently disable Clang for all C/C++ buffers:
-
- (setq-default flycheck-disabled-checkers '(c/c++-clang))
-
- You can also disable checkers via local variables. For instance,
- to disable ‘emacs-lisp-checkdoc’ for your entire project, add it to
- ‘flycheck-disabled-checkers’ in the ‘.dir-locals.el’ file of your
- project:
-
- ((emacs-lisp-mode (flycheck-disabled-checkers emacs-lisp-checkdoc)))
-
- *Note (emacs)Directory Variables::, for more information about
- directory variables.
-
- You can change the completion system used by the commands of this
-section with ‘flycheck-completion-system’.
-
-\1f
-File: flycheck.info, Node: Reporting results, Next: Navigating errors, Prev: Syntax checkers, Up: Usage
-
-4.3 Reporting results of syntax checking
-========================================
-
-When a syntax check in the current buffer has finished, Flycheck reports
-the results of the syntax checkers used by the check in the current
-buffer:
-
- • It highlights errors and warnings reported by a syntax checking in
- the buffer according to ‘flycheck-highlighting-mode’,
- • and indicates these locations in the fringe according to
- ‘flycheck-indication-mode’.
-
- -- User Option: flycheck-highlighting-mode
- How Flycheck highlights errors and warnings in the buffer:
-
- ‘columns’
- Highlight the column of the error, if the error has a column,
- otherwise behave as ‘lines’.
- ‘symbols’
- Highlight the symbol at the error column, if any, otherwise
- behave like ‘columns’. This is default
- ‘sexps’
- Highlight the expression at the error column, if any,
- otherwise behave like ‘columns’. *Warning:* ‘sexps’ can be
- _very_ slow in some major modes, notably the built-in
- ‘python-mode’.
- ‘nil’
- Do not highlight errors at all.
-
- Flycheck uses the ‘flycheck-error’, ‘flycheck-warning’ and
- ‘flycheck-info’ faces to highlight errors, warnings and info
- messages respectively.
-
- -- User Option: flycheck-indication-mode
- How Flycheck indicates errors and warnings:
-
- ‘left-fringe’
- ‘right-fringe’
- Indicate errors in the left or right fringe respectively.
- *Note (emacs)Fringes::, for more information about fringes.
-
- Flycheck uses the ‘flycheck-fringe-error’,
- ‘flycheck-fringe-warning’, and ‘flycheck-fringe-info’ faces
- for the indicators for the corresponding error levels.
- ‘nil’
- Do not indicate errors and warnings.
-
- To avoid flooding a buffer with excessive reports, Flycheck discards
-any reports and _disables_ the corresponding syntax checker
-subsequently, if the total number of reported errors of any level
-exceeds the value of ‘flycheck-checker-error-threshold’.
-
- You can explicitly clear with the ‘flycheck-clear’ command.
-
-\1f
-File: flycheck.info, Node: Navigating errors, Next: Displaying errors, Prev: Reporting results, Up: Usage
-
-4.4 Navigating errors
-=====================
-
-By default, Flycheck integrates into standard error navigation commands
-of Emacs: ‘M-g n’ (‘next-error’) and ‘M-g p’ (‘previous-error’) will
-navigate between Flycheck warnings and errors in the current buffer.
-*Note (emacs)Compilation Mode::, for more information about these
-commands. You can disable this integration by setting
-‘flycheck-standard-error-navigation’ to nil, and re-enabling
-‘flycheck-mode’ afterwards.
-
- *Note:* With standard error navigation _visible_ compilation buffers
-(e.g. from M-x compile, M-x grep, M-x occur, etc.) take precedence
-over Flycheck errors.
-
- Flycheck provides an independent set of navigation commands which
-will always navigate Flycheck errors in the current buffer, regardless
-of visible compilation buffers and ‘flycheck-standard-error-navigation’:
-
-‘C-c ! n’
-‘M-x flycheck-next-error’
- Jump to the next error.
-
- With prefix argument, jump forwards by as many errors as specified
- by the prefix argument, e.g. ‘M-3 C-c ! n’ will move to the 3rd
- error from the current point. With negative prefix argument, move
- to previous errors instead. Signal an error, if there are no more
- Flycheck errors.
-
-‘C-c ! p’
-‘M-x flycheck-previous-error’
- Jump to the previous Flycheck error.
-
- With prefix argument, jump backwards by as many errors as specified
- by the prefix argument, e.g. ‘M-3 C-c ! p’ will move to the 3rd
- error before the current point. With negative prefix argument,
- move to next errors instead. Signal an error, if there are no more
- Flycheck errors.
-
-‘M-x flycheck-first-error’
- Jump to the first Flycheck error.
-
- With prefix argument, jump forwards to by as many errors as
- specified by the prefix argument, e.g. ‘M-3 M-x
- flycheck-first-error’ moves to the 3rd error from the beginning of
- the buffer. With negative prefix argument, move to the last error
- instead.
-
- By default, these commands consider all errors in the current buffer.
-With ‘flycheck-navigation-minimum-level’ you can restrict them to errors
-above certain levels:
-
- -- User Option: flycheck-navigation-minimum-level
- The minimum levels of errors to consider for navigation.
-
- If set to an error level, only navigate to errors whose level is as
- least as severe as this one. If nil, navigate to all errors.
-
-\1f
-File: flycheck.info, Node: Displaying errors, Next: Killing errors, Prev: Navigating errors, Up: Usage
-
-4.5 Displaying errors
-=====================
-
-If the point is on a Flycheck error, Flycheck will display the message
-and ID of the error at point in the echo area after a short delay.
-
- -- User Option: flycheck-display-errors-delay
- The number of seconds to wait before displaying the error at point.
- Floating point numbers can express fractions of seconds.
-
- You can set ‘flycheck-display-errors-function’ to change how Flycheck
-displays error, and what information it displays:
-
- -- User Option: flycheck-display-errors-function
- A function to display errors. The function is called with a list
- of Flycheck error objects to display. *Note Errors::, for more
- information about these objects.
-
- Flycheck provides some built-in display functions:
-
- -- Function: flycheck-display-error-messages
- Show error messages and IDs in the echo area.
-
- -- Function: flycheck-display-error-messages-unless-error-list
- Like ‘flycheck-display-error-messages’, but does not show anything
- if the error list is visible. *Note Listing errors::, for more
- information about the error list.
-
- The flycheck-pos-tip (https://github.com/flycheck/flycheck-pos-tip)
-extension provides an alternative display function, which shows error
-messages in a graphical popup.
-
-\1f
-File: flycheck.info, Node: Killing errors, Next: Listing errors, Prev: Displaying errors, Up: Usage
-
-4.6 Killing errors
-==================
-
-You can also put error messages into the kill ring:
-
-‘C-c ! C-w’
-‘M-x flycheck-copy-errors-as-kill’
- Copy all Flycheck error messages at point into the kill ring.
-
- Each error message is killed _separately_, so ‘C-y’ (‘yank’) only
- yanks a single error message. You can use ‘M-y’ (‘yank-pop’) to
- cycle between the killed messages after yanking the first one.
-
-‘C-u C-c ! C-w’
-‘C-u M-x flycheck-copy-errors-as-kill’
- Copy all Flycheck error messages at point, including their IDs.
-
-‘M-0 C-c ! C-w’
-‘M-0 M-x flycheck-copy-errors-as-kill’
- Copy the IDs of the errors at point.
-
-\1f
-File: flycheck.info, Node: Listing errors, Next: Mode line display, Prev: Killing errors, Up: Usage
-
-4.7 Listing errors
-==================
-
-To get an overview of all errors in the current buffer you can popup an
-error list:
-
-‘C-c ! l’
-‘M-x flycheck-list-errors’
-‘M-x list-flycheck-errors’
- List all errors in the current buffer.
-
- The error list automatically refreshes itself after a syntax check.
- It also follows the current buffer and window, and automatically
- updates to show the errors of the new buffer if you switch to
- another buffer or window. After each refresh the hook
- ‘flycheck-error-list-after-refresh-hook’.
-
- In the error list window the following keybindings are available:
-
-‘n’
- Move to the next error.
-‘p’
- Move to the previous error.
-‘q’
- Hide the error list window.
-‘RET’
- Jump to the location of the error at point.
-‘g’
- Refresh the error list, by triggering a new syntax check in the
- associated buffer.
-‘S’
- Sort the error list by the column at point. Press repeatedly to
- inverse the sorting order.
-
- For instance, you can sort errors by their level by moving the
- point onto the text of the ‘Level’ column, and then pressing ‘S’.
- You can achieve the same effect by clicking on the column header.
-
- When you move the point in the current buffer while the error list is
-visible, all errors on the current line are highlighted in the error
-list with the ‘flycheck-error-list-highlight’ face.
-
-\1f
-File: flycheck.info, Node: Mode line display, Next: Configuring checkers, Prev: Listing errors, Up: Usage
-
-4.8 Mode line display
-=====================
-
-Flycheck always indicates its current state in the mode line, with one
-of the following strings:
-
-‘FlyC’
- There are no errors in the current buffer.
-‘FlyC*’
- Flycheck currently checks the current buffer.
-‘FlyC:3/5’
- There are three errors and five warnings in the current buffer.
-‘FlyC-’
- Flycheck did not find any syntax checker for the current buffer.
- Try ‘C-c ! v’ (‘flycheck-verify-setup’) to find out why.
-‘FlyC!’
- The syntax check failed. Inspect the ‘*Messages*’ buffer for more
- information about the failure.
-‘FlyC?’
- The syntax check had a dubious result. The definition of the
- syntax checker may be flawed. Inspect the ‘*Messages*’ buffer for
- details.
-
- This indicator should *never* appear for built-in syntax checkers.
-If it does, please consider reporting an issue to the Flycheck
-developers. *Note Issues::, for more information.
-
- The 3rd party extension flycheck-color-mode-line
-(https://github.com/flycheck/flycheck-color-mode-line) automatically
-changes the background colour of the mode line according to the results
-of the last syntax check.
-
-\1f
-File: flycheck.info, Node: Configuring checkers, Prev: Mode line display, Up: Usage
-
-4.9 Configuring syntax checkers
-===============================
-
-Flycheck provides a rich interface to configure syntax checkers. There
-are three different kinds of options for syntax checkers:
-
- • _Syntax checker options_ which directly change specific settings of
- syntax checkers,
- • _syntax checker configuration files_ which point syntax checkers to
- configuration files which can comprehensively configure a syntax
- checker, and
- • _syntax checker executables_ which change the executables that
- Flycheck runs for syntax checkers.
-
-4.9.1 Syntax checker options
-----------------------------
-
-Man syntax checkers can be configured via individual options. For
-instance, the ‘flycheck-flake8-maximum-line-length’ tells the
-‘python-flake8’ syntax checker about the maximum number of characters
-allowed on a line. Use the command ‘flycheck-describe-checker’ to see
-what options a syntax checker provides. Type ‘M-x customize-group RET
-flycheck-options’ to get a list of all available options.
-
- Options are mainly intended to be set per file or per project via
-file or directory variables. *Note (emacs)File Variables::, and *note
-(emacs)Directory Variables:: respectively, for more information.
-
- For instance, if you the following file variables section at the end
-of a Python file, the ‘python-flake8’ syntax checker will warn about
-lines longer than 100 characters, rather than the default limit of 80
-characters:
-
- # Local Variables:
- # flycheck-flake8-maximum-line-length: 100
- # End:
-
-4.9.2 Syntax checker configuration files
-----------------------------------------
-
-Some syntax checkers also read configuration files. These syntax
-checkers have an associated _configuration file variable_ which
-specifies the path to the configuration file. All configuration file
-variables are customisable via ‘M-x customize-group RET
-flycheck-config-files’.
-
- If the value of a configuration file variable is nil, Flycheck will
-not use any configuration file for the corresponding syntax checker. If
-it is a string, however, Flycheck tries to locate an appropriate
-configuration file, with the following procedure:
-
- 1. If the value contains a directory separator, expand the path
- against the ‘default-directory’ of the current buffer.
- 2. If the buffer has a file name, search the buffer’s directory and
- any ancestor directories up to the root directory for the
- configuration file.
- 3. Eventually try to find the configuration file in the user’s home
- directory.
-
- If any of these steps returns an existing file, this file is given to
-the syntax checker. For instance, assume you edit the file
-‘foo/bar/hello.py’ in the following project layout:
-
- .
- ├── .pylintrc
- ├── README.rst
- ├── foo
- │ ├── __init__.py
- │ └── bar
- │ ├── __init__.py
- │ └── hello.py
- └── setup.py
-
- When using the ‘python-pylint’ syntax checker, Flycheck would find
-the file ‘.pylintrc’ and pass it to ‘pylint’. This file could then
-contain project-wide style settings for your Python code.
-
- You can change the default procedure for locating configuration files
-by adding or replacing functions in
-‘flycheck-locate-config-file-functions’:
-
- -- User Option: flycheck-locate-config-file-functions
- Functions to locate configuration files.
-
- Each function accepts two arguments VALUE and CHECKER. VALUE is
- the value of the configuration file variable, and CHECKER is the
- syntax checker to locate a configuration file for. The function
- shall either return a string with the absolute path to an existing
- configuration file, or nil if it could not locate the file.
-
- Flycheck calls the functions in order of appearance, until the
- first function returns nil. If all functions return nil, no
- configuration file is given to the syntax checker.
-
- *Note:* The formats of configuration files are specific to each
-syntax checker. Please consult the documentation of the corresponding
-checker tool for information about the configuration file format
-understood by the tool.
-
- Like syntax checker options (*note Syntax checker options::) you can
-set these variables with file or directory variables. *Note (emacs)File
-Variables::, and *note (emacs)Directory Variables:: respectively, for
-more information.
-
-4.9.3 Syntax checker executables
---------------------------------
-
-Occasionally, you need to point Flycheck to a different executable when
-running a syntax checker. For instance, you might want to use ‘gcc-4.9’
-to check your C code, or use ‘pylint’ from a specific virtualenv.
-
- For these situations, each syntax checker has a buffer-local,
-customizable variable named ‘flycheck-CHECKER-executable’, where CHECKER
-is the name of the syntax checker. The value of this variable is either
-nil, or a string. In the former case, Flycheck uses the default
-executable from the syntax checker definition when executing the syntax
-checker. In the latter case, it uses the value of the variable as
-executable.
-
- You can either set these variables directly in your init file, or
-change them interactively:
-
-‘C-c ! e’
-‘M-x flycheck-set-checker-executable’
- Set the executable of a syntax checker in the current buffer.
-
- Prompt for a syntax checker and an executable file, and set the
- executable variable of the syntax checker.
-‘C-u C-c ! e’
-‘C-u M-x flycheck-set-checker-executable’
- Reset the executable of a syntax checker in the current buffer.
-
- Prompt for a syntax checker and reset its executable to the
- default.
-
-\1f
-File: flycheck.info, Node: Syntax checker definitions, Next: Flycheck hooks, Prev: Usage, Up: Top
-
-5 Syntax checker definitions
-****************************
-
-This chapter explains how to add new syntax checkers and how to extend
-built-in syntax checkers, by example. *Note Flycheck API::, for a
-detailed reference on the involved types, functions and macros.
-
- If you define a new syntax checker or have an extension to a built-in
-syntax checker, please report it to Flycheck (*note Issues::), so that
-we can consider it for inclusion to make it available to all other users
-of Flycheck.
-
-* Menu:
-
-* Defining syntax checkers:: How to define new syntax checkers
-* Finding error patterns:: How to find error patterns for a checker
-* Trying new checkers:: How to try a new syntax checker
-* Registering new checkers:: How to register for automatic selection
-* Parsing structured output:: How to parse structured output like XML
-* Passing configuration to checkers:: How to make syntax checkers configurable
-* Controlling use of checkers:: How to control when checkers are used
-* Applying multiple checkers:: How to use more than one checker per buffer
-
-\1f
-File: flycheck.info, Node: Defining syntax checkers, Next: Finding error patterns, Up: Syntax checker definitions
-
-5.1 Defining syntax checkers
-============================
-
-Flycheck provides the macro ‘flycheck-define-checker’ to define a new
-syntax checker. The following example defines a simple syntax checker
-for the popular Pylint (http://www.pylint.org/) tool for Python:
-
- (flycheck-define-checker python-pylint
- "A Python syntax and style checker using Pylint.
-
- See URL `http://www.pylint.org/'."
- :command ("pylint"
- "--msg-template" "{path}:{line}:{column}:{C}:{msg} ({msg_id})"
- source)
- :error-patterns
- ((error line-start (file-name) ":" line ":" column ":"
- (or "E" "F") ":" (message) line-end)
- (warning line-start (file-name) ":" line ":" column ":"
- (or "W" "R") ":" (message) line-end)
- (info line-start (file-name) ":" line ":" column ":"
- "C:" (message) line-end))
- :modes python-mode)
-
- The first argument to ‘flycheck-define-checker’ is the _name_ of a
-syntax checker, by which we can refer to this particular syntax checker.
-
- Next comes the _docstring_, which should provide a bit of information
-about the syntax checker. It’s a good idea to provide a link to the
-homepage of the syntax checker tool here. You can view this docstring
-in Emacs with ‘flycheck-describe-checker’ at ‘C-c ! ?’, e.g. ‘C-c ! ?
-python-pylint’.
-
- Eventually we specify the _properties_ of the new syntax checker.
-These properties tell Flycheck when to use your new syntax checker, how
-to run it, and how to parse its output:
-
- • The ‘:command’ specifies the command Flycheck should run to check
- the buffer. It’s a simple list containing the executable and its
- arguments.
-
- In our example we first the ‘--msg-template’ option to ‘pylint’ to
- configure a comprehensive and parseable output format.
-
- Then we use the “special” ‘source’ argument to pass the contents of
- the buffer as input file to ‘pylint’. Whenever it sees the
- ‘source’ argument, Flycheck creates a temporary file, fills it with
- the current contents of the buffer and passes that file to the
- syntax checker. This allows to check the real contents of a buffer
- even if the buffer is not saved to disk.
-
- Refer to the function ‘flycheck-substitute-argument’ for a complete
- list of all special symbols.
-
- • The ‘:error-patterns’ tell Flycheck how to parse the output of the
- command in order to obtain error locations. Each pattern has a
- _level_, followed by ‘rx’ forms which specify a regular expression
- to find an error in the output of the command.
-
- Flycheck understands three error levels by default: ‘error’ is for
- critical errors that absolutely require the user’s attention (e.g.
- syntax errors), ‘warning’ is for issues that can be ignored, but
- should not (e.g. unused variables), and ‘info’ is for other
- messages that provide information about the buffer, but do not
- immediately require action from the user.
- ‘flycheck-define-error-level’ lets you define custom error levels.
-
- Flycheck provides special ‘rx’ forms to extract the relevant
- information from each error:
-
- • The ‘(file-name)’ and ‘(message)’ forms match a sequence of
- any character save new line as file name and message of the
- error. Both optionally accept further ‘rx’ forms, to specify
- an alternative regular expression to match the file name or
- the message, for instance to parse multi-line error messages.
- • The ‘line’ and ‘column’ forms match a sequence of one or more
- digits as line and column respectively of the error.
-
- Refer to the function ‘flycheck-rx-to-string’ for a complete list
- of supported forms.
-
- • The ‘:modes’ property denotes the major modes, in which Flycheck
- may use this syntax checker. ‘pylint’ checks Javascript, so the
- ‘:modes’ of our example specify ‘python-mode’.
-
-\1f
-File: flycheck.info, Node: Finding error patterns, Next: Trying new checkers, Prev: Defining syntax checkers, Up: Syntax checker definitions
-
-5.2 Finding the right error patterns
-====================================
-
-Finding the right error patterns is the hardest part of a syntax checker
-definition. For a first version, you just run the tool on a file, look
-at its output and write a regular expression to match it. ‘M-x shell’
-comes handy here.
-
- However, as you start to debug and refine your patterns, this quickly
-becomes cumbersome. Flycheck provides an easier way to test a syntax
-checker: Evaluate the syntax checker definition with ‘C-M-x’ and run
-‘flycheck-compile’.
-
-‘C-c ! C-c’
-‘M-x flycheck-compile’
- Run a syntax checker on the current buffer in a fresh Compilation
- Mode buffer. Prompt for a syntax checker to run.
-
- This command runs the command like a normal syntax check would do,
-but instead of highlighting errors within the buffer it shows a new
-buffer in Compilation Mode, which contains the entire output of the
-command and highlights everything that matches a pattern.
-
- Sometimes however an output format doesn’t lend itself to error
-patterns. In this case, you need to write a more sophisticated parser
-yourself. *Note Parsing structured output::, for more information.
-
-\1f
-File: flycheck.info, Node: Trying new checkers, Next: Registering new checkers, Prev: Finding error patterns, Up: Syntax checker definitions
-
-5.3 Trying a new syntax checker
-===============================
-
-After evaluating a syntax checker definition you can try whether it
-works for normal syntax checks by selecting it manually with ‘C-c ! s’
-or ‘M-x flycheck-select-checker’. If anything breaks, you can unselect
-the syntax checker again with ‘C-u C-c ! s’ and fix the error without
-further affecting Flycheck.
-
- Once you have confirmed that your new syntax checker works
-flawlessly, you can make it available for automatic syntax checking by
-registering it.
-
-\1f
-File: flycheck.info, Node: Registering new checkers, Next: Parsing structured output, Prev: Trying new checkers, Up: Syntax checker definitions
-
-5.4 Registering new syntax checkers
-===================================
-
-To register a new syntax checker for automatic syntax checking, just add
-it to ‘flycheck-checkers’:
-
- (add-to-list 'flycheck-checkers 'python-pylint)
-
- Flycheck will try all syntax checkers in this variable when checking
-a buffer automatically, and check the buffer with the first syntax
-checker in this list whose ‘:modes’ contains the current major mode.
-
- *Note*: Do _not_ use ‘flycheck-checker’ and ‘flycheck-select-checker’
-to enable your own syntax checker in Flycheck extensions. They are
-reserved for _user customization_.
-
- Specifically, please do _not_ provide a hook function which selects
-the syntax checker explicitly by assigning to ‘flycheck-checker’ or by
-calling ‘flycheck-select-checker’. In other words, this is *bad*:
-
- (defun enable-my-new-syntax-checker ()
- (setq flycheck-checker 'my-new-syntax-checker)
- (flycheck-buffer))
-
- (add-hook 'my-major-mode-hook #'enable-my-new-syntax-checker)
-
- This circumvents the entire automatic selection of Flycheck, and
-prevents the user from effectively customizing Flycheck.
-
- Instead, just register your syntax checker in ‘flycheck-checkers’ and
-let Flycheck automatically pick the best syntax checker. In other
-words, this is *good*:
-
- (add-to-list 'flycheck-checkers 'my-new-syntax-checker)
-
-\1f
-File: flycheck.info, Node: Parsing structured output, Next: Passing configuration to checkers, Prev: Registering new checkers, Up: Syntax checker definitions
-
-5.5 Parsing structured output
-=============================
-
-If your syntax checker tool offers some structured output format as
-alternative to human-readable free text, you can use an ‘:error-parser’
-function instead of writing an error pattern. For instance, JSHint
-(http://www.jshint.com/) offers the widely spread Checkstyle XML output
-format which Flycheck supports out of the box:
-
- (flycheck-define-checker javascript-jshint
- "A JavaScript syntax and style checker using jshint.
-
- See URL `http://www.jshint.com'."
- :command ("jshint" "--checkstyle-reporter" source)
- :error-parser flycheck-parse-checkstyle
- :modes (js-mode js2-mode js3-mode))
-
- As you can see, there are no patterns in this definition. Instead
-Flycheck calls the function ‘flycheck-parse-checkstyle’ to parse the
-output. This function parses the XML to extract the errors. It’s
-built-in into Flycheck, so if your tool supports Checkstyle XML, error
-parsing comes _for free_ in Flycheck. *Note Error parsers::, for more
-information about error parsers.
-
-\1f
-File: flycheck.info, Node: Passing configuration to checkers, Next: Controlling use of checkers, Prev: Parsing structured output, Up: Syntax checker definitions
-
-5.6 Passing options and configuration files to syntax checkers
-==============================================================
-
-Many linting tools provide a rich set of options to configure their
-analysis. Flycheck makes it to define proper Emacs options and map them
-to options of commands.
-
- For instance, the Rubocop (bbatsov/rubocop) tool checks Ruby for
-semantic and stylistic issues. Since style is mainly a matter of taste,
-it has a special linting mode in which all stylistic checks are disabled
-(error patterns omitted for readability):
-
- (flycheck-define-checker ruby-rubocop
- "A Ruby syntax and style checker using the RuboCop tool.
-
- See URL `http://batsov.com/rubocop/'."
- :command ("rubocop" "--format" "emacs"
- (option-flag "--lint" flycheck-rubocop-lint-only)
- source)
- :error-patterns ...
- :modes (ruby-mode))
-
- Note the special ‘option-flag’ argument, which splices the value of
-the boolean Emacs option ‘flycheck-rubocop-lint-only’ into the command:
-If the variable is non-nil, Flycheck adds the ‘--lint’ option to the
-final command line, other Flycheck omits the entire argument.
-
- Flycheck also supports other special ‘option-’ arguments for plain
-values or lists of values. *Note Argument Substitution::, for a list of
-all special arguments.
-
- Flycheck also provides a convenience macro ‘flycheck-def-option-var’
-to declare these options:
-
- (flycheck-def-option-var flycheck-rubocop-lint-only nil ruby-rubocop
- "Whether to only report code issues in Rubocop.
-
- When non-nil, only report code issues in Rubocop, via `--lint'.
- Otherwise report style issues as well."
- :safe #'booleanp
- :type 'boolean)
-
- Essentially, this macro is just a wrapper around the built-in
-‘defcustom’, which additionally keeps track of the syntax checker the
-option belongs to, and adds the option to the appropriate custom group.
-You can pass arbitrary custom keywords to this macro as we did in this
-example: ‘:type’ marks this option as boolean flag, and ‘:safe’ allows
-the use as file-local variable, if the value is boolean. *Note Syntax
-checker options::, for more information about syntax checker
-configuration, and *note Checker configuration::, for the corresponding
-API reference.
-
- By a similar mechanism you can also pass paths to configuration files
-to a syntax checker tool. The aforementioned Pylint
-(http://www.pylint.org/) reads a configuration file for instance:
-
- (flycheck-define-checker python-pylint
- "A Python syntax and style checker using Pylint.
-
- This syntax checker requires Pylint 1.0 or newer.
-
- See URL `http://www.pylint.org/'."
- ;; -r n disables the scoring report
- :command ("pylint" "-r" "n"
- "--msg-template" "{path}:{line}:{column}:{C}:{msg} ({msg_id})"
- (config-file "--rcfile" flycheck-pylintrc)
- source)
- :error-patterns ...
- :modes python-mode)
-
- The special ‘config-file’ argument passes a configuration file from
-‘flycheck-pylintrc’ to ‘pylint’, if the value of the variable is
-non-nil.
-
- Flycheck provides a sophisticated logic to find an appropriate
-configuration file. *Note Syntax checker configuration files::, for
-more information about syntax checker configuration, and *note Checker
-configuration::, for the corresponding API reference.
-
-\1f
-File: flycheck.info, Node: Controlling use of checkers, Next: Applying multiple checkers, Prev: Passing configuration to checkers, Up: Syntax checker definitions
-
-5.7 Controlling the use of a syntax checker
-===========================================
-
-If you need more control about when a syntax checker is used for syntax
-checking, you can supply a custom ‘:predicate’ function. Consider the
-following syntax checker for Zsh scripts in Sh Mode:
-
- (flycheck-define-checker sh-zsh
- "A Zsh syntax checker using the Zsh shell.
-
- See URL `http://www.zsh.org/'."
- :command ("zsh" "-n" "-d" "-f" source)
- :error-patterns
- ((error line-start (file-name) ":" line ": " (message) line-end))
- :modes sh-mode
- :predicate (lambda () (eq sh-shell 'zsh)))
-
- Sh Mode also supports Bash and other shells besides Zsh, so we
-additionally provide a ‘:predicate’ that checks whether the current
-buffer has the right shell.
-
- You can even omit ‘:modes’ and only use a predicate to determine
-whether a syntax checker is applicable for the current buffer.
-
-\1f
-File: flycheck.info, Node: Applying multiple checkers, Prev: Controlling use of checkers, Up: Syntax checker definitions
-
-5.8 Applying multiple syntax checkers
-=====================================
-
-Frequently, we would like to use multiple syntax checkers in a buffer.
-For instance, we might want to check the syntax of a script with
-‘sh-zsh’ from the previous section, and then use Shellcheck
-(koalaman/shellcheck/) to check for questionable code such as unquoted
-variable expansions, if there are no syntax errors. Flycheck supports
-this scenario by _chaining_ syntax checkers.
-
- Suppose we defined a syntax checker for Shellcheck called
-SH-SHELLCHECK as follows:
-
- (flycheck-define-checker sh-shellcheck
- "A shell script syntax and style checker using Shellcheck.
-
- See URL `https://github.com/koalaman/shellcheck/'."
- :command ("shellcheck" "-f" "checkstyle"
- "-s" (eval (symbol-name sh-shell))
- source)
- :modes sh-mode
- :error-parser flycheck-parse-checkstyle)
-
- Note how we use the special ‘eval’ argument to put the result of an
-arbitrary Emacs Lisp expression into the command line of ‘shellcheck’,
-in order to tell Shellcheck what shell the script is written for.
-
- We can now arrange for this syntax checker to be used after ‘sh-zsh’
-with ‘flycheck-add-next-checker’:
-
- (flycheck-add-next-checker 'sh-zsh '(warning . sh-shellcheck))
-
- The first item of the cons cell in the second argument is the
-_maximum error level_ in the buffer, for which ‘sh-shellcheck’ is still
-applicable. With ‘warning’ Flycheck will run ‘sh-shellcheck’ after
-‘sh-zsh’ if there are ‘warning’ or ‘info’ level errors from ‘sh-zsh’,
-but not if there are any errors with level ‘error’, such as syntax
-errors.
-
- Flycheck will only use a chained syntax checker if it is registered
-in ‘flycheck-checkers’, so we need to register our new syntax checker
-(*note Registering new checkers::):
-
- (add-to-list 'flycheck-checkers 'sh-shellcheck 'append)
-
- Note that unlike before we _append_ the new syntax checker at the end
-of ‘flycheck-checkers’. This ensures that Flycheck does not try
-‘sh-shellcheck’ _before_ ‘sh-zsh’. Flycheck tries all syntax checkers
-in this list in _order of appearance_, so if you add your new chained
-syntax checker at the beginning, it will likely be used right away,
-before any prior syntax checkers.
-
- You also can specify chained syntax checkers directly in
-‘flycheck-define-checker’ with the ‘:next-checkers’ property. Instead
-of calling ‘flycheck-add-next-checker’, we could also have added this
-property to the definition of ‘sh-zsh’:
-
- (flycheck-define-checker sh-zsh
- "A Zsh syntax checker using the Zsh shell.
-
- See URL `http://www.zsh.org/'."
- :command ("zsh" "-n" "-d" "-f" source)
- :error-patterns ...
- :modes sh-mode
- :predicate (lambda () (eq sh-shell 'zsh))
- :next-checkers ((warning . sh-shellcheck)))
-
- If you control the definition of both syntax checkers, this style is
-_preferable_ to ‘flycheck-add-next-checker’. Use the latter only if you
-cannot change the definition of the prior syntax checker.
-
-\1f
-File: flycheck.info, Node: Flycheck hooks, Next: Flycheck API, Prev: Syntax checker definitions, Up: Top
-
-6 Flycheck hooks
-****************
-
-This chapter gives you a brief overview over Flycheck’s rich hook
-interface, which you can use for your own extensions.
-
-6.1 Status changes
-==================
-
-‘flycheck-before-syntax-check-hook’ and
-‘flycheck-after-syntax-check-hook’ run before and after syntax checks,
-and let you update your Emacs instance according to Flycheck’s state.
-For instance, flycheck-color-mode-line
-(https://github.com/flycheck/flycheck-color-mode-line) uses these hooks
-to colour your mode-line according to the result of the last syntax
-check. Additionally, ‘flycheck-status-changed-functions’ runs on every
-single status change of Flycheck, and provides a fine-grained reporting
-about what Flycheck is currently doing.
-
-6.2 Error processing
-====================
-
-The functions in ‘flycheck-process-error-functions’ are used to process
-new errors reported by a Flycheck syntax checker. Add to this hook to
-get informed about each error reported in a Flycheck buffer. In fact,
-Flycheck uses this hook itself: The standard value
-‘flycheck-add-overlay’ is responsible for adding error highlighting to
-the buffer. As a consequence, you can _entirely opt out_ from
-highlighting with a custom hook.
-
-6.3 Error display
-=================
-
-The function ‘flycheck-display-errors-function’ is called to display an
-error at point. The flycheck-pos-tip
-(https://github.com/flycheck/flycheck-pos-tip) extension uses this hook
-to show errors in a GUI popup like conventional IDEs do.
-
-\1f
-File: flycheck.info, Node: Flycheck API, Next: Supported languages, Prev: Flycheck hooks, Up: Top
-
-7 Flycheck API
-**************
-
-TODO: The API documentation still needs to be written.
-
-* Menu:
-
-* Command syntax checkers:: Syntax checkers with external commands
-* Errors:: Error representation in Flycheck
-
-\1f
-File: flycheck.info, Node: Command syntax checkers, Next: Errors, Up: Flycheck API
-
-7.1 Command syntax checkers
-===========================
-
-* Menu:
-
-* Argument Substitution:: Argument substitution in syntax checker commands
-* Checker configuration:: Configuration for command checkers
-* Error parsers:: Parsing structured output formats
-
-\1f
-File: flycheck.info, Node: Argument Substitution, Next: Checker configuration, Up: Command syntax checkers
-
-7.1.1 Argument substitution
----------------------------
-
-\1f
-File: flycheck.info, Node: Checker configuration, Next: Error parsers, Prev: Argument Substitution, Up: Command syntax checkers
-
-7.1.2 Configuration options and files
--------------------------------------
-
-\1f
-File: flycheck.info, Node: Error parsers, Prev: Checker configuration, Up: Command syntax checkers
-
-7.1.3 Error parsers
--------------------
-
-\1f
-File: flycheck.info, Node: Errors, Prev: Command syntax checkers, Up: Flycheck API
-
-7.2 Errors
-==========
-
-\1f
-File: flycheck.info, Node: Supported languages, Next: Issues, Prev: Flycheck API, Up: Top
-
-Appendix A Supported languages
-******************************
-
-This chapter lists the languages supported by Flycheck. Some 3rd party
-extensions add support for more languages:
-
- • flycheck-ledger (https://github.com/flycheck-ledger) adds a syntax
- checker for files of the Ledger (http://ledger-cli.org/) accounting
- tool.
- • flycheck-mercury (https://github.com/flycheck/flycheck-mercury)
- adds a syntax checker for the Mercury (http://mercurylang.org/)
- programming language.
- • flycheck-ocaml (https://github.com/flycheck/flycheck-ocaml) adds a
- syntax checker for the OCaml programming language, using the Merlin
- (https://github.com/the-lambda-church/merlin) tool.
-
- Each language has one or more syntax checkers, whose names follow a
-convention of ‘LANGUAGE-TOOL’ where LANGUAGE is the programming language
-checked by the checker, and TOOL the name of the checker tool.
-
- The syntax checkers are listed in the order they are applied to a
-buffer. Use ‘C-c ! ?’ (‘flycheck-describe-checker’) to obtain more
-information about a syntax checker.
-
-Ada
-===
-
- • ‘ada-gnat’ (GNAT (https://gcc.gnu.org/onlinedocs/gnat_ugn_unw/)),
- with the following options:
-
- ‘flycheck-gnat-args’
- A list of additional arguments to GNAT.
- ‘flycheck-gnat-include-path’
- A list of include directories for GNAT. Relative paths are
- relative to the file being checked.
- ‘flycheck-gnat-language-standard’
- The language standard to use in GNAT, as string.
- ‘flycheck-gnat-warnings’
- A list of additional warnings to enable in GNAT. Each item is
- the name of a warning category to enable.
-
-AsciiDoc
-========
-
- • ‘asciidoc’ (AsciiDoc (http://www.methods.co.nz/asciidoc))
-
-C/C++
-=====
-
- 1. ‘c/c++-clang’ (syntax and type check with Clang
- (http://clang.llvm.org/)) or ‘c/c++-gcc’ (syntax and type check
- with GCC (https://gcc.gnu.org/)), and
- 2. ‘c/c++-cppcheck’ (style and error check with cppcheck
- (http://cppcheck.sourceforge.net/)).
-
- ‘c/c++-clang’ and ‘c/c++-gcc’ provide the following options:
-
-‘flycheck-clang-args’
-‘flycheck-gcc-args’
- A list of additional arguments for Clang/GCC.
-‘flycheck-clang-blocks’
- Whether to enable blocks in Clang.
-‘flycheck-clang-definitions’
-‘flycheck-gcc-definitions’
- A list of additional preprocessor definitions for Clang/GCC.
-‘flycheck-clang-include-path’
-‘flycheck-gcc-include-path’
- A list of include directories for Clang/GCC, relative to the file
- being checked.
-‘flycheck-clang-includes’
-‘flycheck-gcc-includes’
- A list of additional include files for Clang/GCC, relative to the
- file being checked.
-‘flycheck-clang-language-standard’
-‘flycheck-gcc-language-standard’
- The language standard to use in Clang/GCC, as string, via the
- ‘-std’ option.
-‘flycheck-clang-ms-extensions’
- Whether to enable Microsoft extensions to C/C++ in Clang.
-‘flycheck-clang-no-exceptions’
-‘flycheck-gcc-no-exceptions’
- Whether to disable exceptions in Clang/GCC.
-‘flycheck-clang-no-rtti’
-‘flycheck-gcc-no-rtti’
- Whether to disable RTTI in Clang/GCC, via ‘-fno-rtti’.
-‘flycheck-clang-standard-library’
- The name of the standard library to use for Clang, as string.
-‘flycheck-gcc-openmp’
- Whether to enable OpenMP in GCC.
-‘flycheck-clang-pedantic’
-‘flycheck-gcc-pedantic’
- Whether to warn about language extensions in Clang/GCC.
-‘flycheck-clang-pedantic-errors’
-‘flycheck-gcc-pedantic-errors’
- Whether to error on language extensions in Clang/GCC.
-‘flycheck-clang-warnings’
-‘flycheck-gcc-warnings’
- A list of additional warnings to enable in Clang. Each item is the
- name of a warning or warning category for ‘-W’.
-
-‘c/c++-cppcheck’ provides the following options:
-
-‘flycheck-cppcheck-checks’
- A list of enabled checks for cppcheck. Each item is the name of a
- check for the ‘--enable’ option.
-‘flycheck-cppcheck-inconclusive’
- Whether to enable inconclusive checks in cppcheck. These checks
- may yield more false positives than normal checks.
-
-CFEngine
-========
-
- • ‘cfengine’ (CFEngine (http://cfengine.com/))
-
-Chef
-====
-
- • ‘chef-foodcritic’ (style check with foodcritic
- (http://acrmp.github.io/foodcritic/)), with the following option:
-
- ‘flycheck-foodcritic-tags’
- A list of tags to select for Foodcritic.
-
-Coffeescript
-============
-
- 1. ‘coffee’ (syntax check with coffee (http://coffeescript.org/))
- 2. ‘coffee-coffeelint’ (code style check with coffeelint
- (http://www.coffeelint.org/)), with the following option:
-
- ‘flycheck-coffeelintrc’
- Configuration file for coffeelint. *Note Syntax checker
- configuration files::, for more information about
- configuration files.
-
-Coq
-===
-
- • ‘coq’ (Coq (http://coq.inria.fr/))
-
-CSS
-===
-
- • ‘css-csslint’ (style and error check with CSSLint
- (https://github.com/CSSLint/csslint))
-
-D
-=
-
- • ‘d-dmd’ (DMD (http://dlang.org/)), with the following options:
-
- ‘flycheck-dmd-include-path’
- A list of include directories for DMD.
- ‘flycheck-dmd-args’
- A list of additional arguments for DMD.
-
- The extension flycheck-d-unittest
- (https://github.com/flycheck/flycheck-d-unittest) adds a syntax
- checker which runs D unittests on the fly and reports the results.
-
-Emacs Lisp
-==========
-
- 1. ‘emacs-lisp’ (syntax check with the built-in Emacs byte compiler)
- 2. ‘emacs-lisp-checkdoc’ (code and documentation check with
- ‘checkdoc’)
-
- The extension flycheck-package
- (https://github.com/purcell/flycheck-package) adds a syntax checker
- which checks for violations of Emacs Lisp packaging conventions.
-
- The ‘emacs-lisp’ checker provides the following options
-
-‘flycheck-emacs-lisp-load-path’
- The load path to use while checking Emacs Lisp files, as list of
- strings. Relative directories are expanded against the
- ‘default-directory’ of the buffer being checked.
-
-‘flycheck-emacs-lisp-initialize-packages’
- Whether to initialize Emacs’ package manager with
- ‘package-initialize’ before checking the buffer. If set to ‘auto’
- (the default), only initialize the package managers for files in
- under ‘user-emacs-directory’.
-
-‘flycheck-emacs-lisp-package-user-dir’
- The package directory for the Emacs Lisp checker, as string. Has
- no effect if ‘flycheck-emacs-lisp-initialize-packages’ is nil.
-
-Erlang
-======
-
- • ‘erlang’ (Erlang (http://www.erlang.org/))
-
- ‘flycheck-erlang-include-path’
- A list of include directories for Erlang.
-
-ERuby
-=====
-
- • ‘eruby-erubis’ (‘erubis’ (http://www.kuwata-lab.com/erubis/))
-
-Fortran
-=======
-
- 1. ‘fortran-gfortran’ (GFortran
- (https://gcc.gnu.org/onlinedocs/gfortran/)), with the following
- options:
-
- ‘flycheck-gfortran-args’
- A list of additional arguments to GFortran.
-
- ‘flycheck-gfortran-include-path’
- A list of include directories for GFortran. Relative paths
- are relative to the file being checked.
-
- ‘flycheck-gfortran-language-standard’
- The language standard to use with GFortran, for the ‘-std’
- option.
-
- ‘flycheck-gfortran-layout’
- The source code layout to use with GFortran. Set to ‘free’ or
- ‘fixed’ for free or fixed layout respectively, or nil (the
- default) to let GFortran automatically determine the layout.
-
- ‘flycheck-gfortran-warnings’
- A list of warnings enabled for GFortran, via the ‘-W’ option.
-
-Go
-==
-
- 1. ‘go-gofmt’ (syntax check with gofmt (http://golang.org/cmd/gofmt/))
- 2. ‘go-golint’ (coding style with Golint
- (https://github.com/golang/lint))
- 3. ‘go-vet’ (check for suspicious code with ‘go tool vet’
- (http://godoc.org/golang.org/x/tools/cmd/vet))
- 4. ‘go-build’ or ‘go-test’ (syntax and type check with Go
- (http://golang.org/cmd/go), for source and tests respectively)
- 5. ‘go-errcheck’ (check for unhandled error returns with errcheck
- (https://github.com/kisielk/errcheck))
-
- ‘go-vet’ provides the following option:
-
-‘flycheck-go-vet-print-functions’
- A list of print-like functions for go vet. Go vet will check these
- functions for format string problems.
-
-Haml
-====
-
- • ‘haml’ (Haml (http://haml.info/))
-
-Handlebars
-==========
-
- • ‘handlebars’ (Handlebars (http://handlebarsjs.com/))
-
-Haskell
-=======
-
- 1. ‘haskell-ghc’ (syntax and type checker with GHC
- (http://www.haskell.org/ghc/)), and
-
- 2. ‘haskell-hlint’ (style checker with hlint
- (https://github.com/ndmitchell/hlint))
-
- The extension flycheck-haskell
- (https://github.com/flycheck/flycheck-haskell) configures Flycheck
- from the current Cabal project, and adds support for Cabal
- sandboxes. The extension flycheck-hdevtools
- (https://github.com/flycheck/flycheck-hdevtools) adds an
- alternative syntax checker for ‘haskell-ghc’ using hdevtools
- (https://github.com/bitc/hdevtools/).
-
- The ‘haskell-ghc’ checker provides the following options:
-
-‘flycheck-ghc-args’
- A list of additional arguments for GHC.
-
-‘flycheck-ghc-no-user-package-database’
- Whether to disable the user package database in GHC.
-
-‘flycheck-ghc-package-databases’
- A list of additional package databases for GHC. Each item points to
- a directory containing a package directory, for the ‘-package-db’
- option.
-
-‘flycheck-ghc-search-path’
- A list of module directories for GHC, via the ‘-i’ option.
-
-‘flycheck-ghc-language-extensions’
- A list of language extensions for GHC, via ‘-X’.
-
-HTML
-====
-
- • ‘html-tidy’ (Tidy HTML5 (https://github.com/w3c/tidy-html5)), with
- the following option:
-
- ‘flycheck-tidyrc’
- Configuration file for Tidy. *Note Syntax checker
- configuration files::, for more information about
- configuration files.
-
-Javascript
-==========
-
- 1. • ‘javascript-jshint’ (JSHint (http://jshint.com/))
- • Or ‘javascript-eslint’ (ESLint (http://eslint.org/))
- • Or ‘javascript-gjslint’ (Closure Linter
- (https://developers.google.com/closure/utilities))
- 2. ‘javascript-jscs’ (JSCS (http://jscs.info/))
- 3. ‘javascript-standard’ (Standard
- (https://github.com/feross/standard) or Semistandard
- (https://github.com/Flet/semistandard))
-
- The ‘javascript-eslint’ checker provides the following option:
-
-‘flycheck-eslint-rulesdir’
- A directory with custom rules for ESLint.
-‘flycheck-eslintrc’
- Configuration file for ESLint. *Note Syntax checker configuration
- files::, for more information about configuration files.
-
- ‘javascript-jshint’, ‘javascript-gjslint’ and ‘javascript-jscs’ read
-configuration files:
-
-‘flycheck-jshintrc’
- Configuration file for JSHint. *Note Syntax checker configuration
- files::, for more information about configuration files.
-‘flycheck-gjslintrc’
- Configuration file for Closure Linter. *Note Syntax checker
- configuration files::, for more information about configuration
- files.
-‘flycheck-jscsrc’
- Configuration file for JSCS. *Note Syntax checker configuration
- files::, for more information about configuration files.
-
-JSON
-====
-
- • ‘json-jsonlint’ (jsonlint (https://github.com/zaach/jsonlint))
-
-Less
-====
-
- • ‘less’ (less (http://lesscss.org/))
-
-Lua
-===
-
- • ‘luacheck’ (Luacheck (https://github.com/mpeterv/luacheck)) with
- the following option:
-
- ‘flycheck-luacheckrc’
- Configuration file for Luacheck. *Note Syntax checker
- configuration files::, for more information about
- configuration files.
-
- • ‘lua’ (Lua compiler (http://www.lua.org/))
-
-Perl
-====
-
- 1. ‘perl’ (syntax check with the Perl interpreter
- (http://www.perl.org/))
- 2. ‘perl-perlcritic’ (style and code check with Perl::Critic
- (https://metacpan.org/pod/Perl::Critic))
-
- These syntax checkers checker provide the following options:
-
-‘flycheck-perl-include-path’
- A list of include directories for Perl, relative to the file being
- checked.
-‘flycheck-perlcritic-severity’
- The severity level for Perl::Critic, as integer for the
- ‘--severity’ option of Perl::Critic.
-
-PHP
-===
-
- 1. ‘php’ (syntax check with PHP CLI
- (https://metacpan.org/pod/Perl::Critic))
- 2. ‘php-phpmd’ (code check with PHP Mess Detector (http://phpmd.org/))
- 3. ‘php-phpcs’ (style check with PHP CodeSniffer
- (http://pear.php.net/package/PHP_CodeSniffer/))
-
- These checkers provide the following options:
-
-‘flycheck-phpmd-rulesets’
- A list of rule sets for PHP Mess Detector as strings. Each item is
- either the name of a default rule set, or the path to a custom rule
- set file.
-
-‘flycheck-phpcs-standard’
- The coding standard for PHP CodeSniffer, either as name of a
- built-in standard, or as path to a standard specification.
-
-Puppet
-======
-
- • ‘puppet-parser’ (syntax check with Puppet (http://puppetlabs.com/))
- • ‘puppet-lint’ (style check with Puppet Lint
- (http://puppet-lint.com/))
-
-Python
-======
-
- • ‘python-flake8’ (syntax and style checking with flake8
- (https://pypi.python.org/pypi/flake8)), or
- • ‘python-pylint’ (syntax and style checking with Pylint
- (http://pylint.org/)), or
- • ‘python-pycompile’ (syntax checking with Python’s built-in byte
- compiler (https://docs.python.org/3.4/library/py_compile.html), as
- last resort)
-
- The extension flycheck-pyflakes
- (https://github.com/Wilfred/flycheck-pyflakes) adds a syntax
- checker using Pyflakes (https://pypi.python.org/pypi/pyflakes).
-
- ‘python-flake8’ provides the following options:
-
-‘flycheck-flake8-error-level-alist’
- An alist mapping Flake8 error IDs to Flycheck error levels.
-
-‘flycheck-flake8-maximum-complexity’
- The maximum McCabe complexity of methods allowed by Flake8.
-
-‘flycheck-flake8-maximum-line-length’
- The maximum length of lines for Flake8.
-
-‘flycheck-flake8rc’
- Configuration file for Flake8. *Note Syntax checker configuration
- files::, for more information about configuration files.
-
- ‘python-pylint’ reads a configuration file:
-
-‘flycheck-pylintrc’
- Configuration file for Pylint. *Note Syntax checker configuration
- files::, for more information about configuration files.
-
-R
-=
-
- • ‘r-lintr’ (syntax and style check with lintr (jimhester/lintr)),
- with the following options:
-
- ‘flycheck-lintr-caching’
- Whether to enable caching in lintr. On by default. Only
- disable it if caching causes real problems.
-
- ‘flycheck-lintr-linters’
- Linters to use with lintr, as a string containing an R
- expression which selects the linters to use.
-
-Racket
-======
-
- • ‘racket’ (Racket (http://racket-lang.org/))
-
-RPM Spec
-========
-
- • ‘rpm-rpmlint’ (rpmlint (http://sourceforge.net/projects/rpmlint/))
-
-reStructuredText
-================
-
- • ‘rst’ (using docutils (http://docutils.sourceforge.net/), for plain
- reStructuredFiles files), or ‘rst-sphinx’ (using Sphinx
- (http://sphinx-doc.org/), for Sphinx documentation files)
-
- ‘rst-sphinx’ provides the following option:
-
-‘flycheck-sphinx-warn-on-missing-references’
- Whether to emit warnings for all missing references in Sphinx.
-
-Ruby
-====
-
- 1. ‘ruby-rubocop’ (syntax and style check using RuboCop
- (http://batsov.com/rubocop/))
- 2. ‘ruby-rubylint’ (syntax and style check using ruby-lint
- (http://code.yorickpeterse.com/ruby-lint/latest/))
-
- These checkers provide the following options
-
-‘flycheck-rubocop-lint-only’
- Whether to suppress warnings about style issues in Rubocop, via the
- ‘--lint’ option.
-‘flycheck-rubocoprc’
- Configuration file for Rubocop. *Note Syntax checker configuration
- files::, for more information about configuration files.
-‘flycheck-rubylintrc’
- Configuration file for ruby-lint. *Note Syntax checker
- configuration files::, for more information about configuration
- files.
-
- If none of the above is available, Flycheck will fall back to one of
-the following checkers for very basic checking:
-
- • ‘ruby’ (using the standard Ruby interpreter
- (https://www.ruby-lang.org/)),
- • ‘ruby-jruby’ (using JRuby (http://jruby.org/))
-
-Rust
-====
-
- • ‘rust’ (using the Rust compiler (http://www.rust-lang.org/)), with
- the following options:
-
- ‘flycheck-rust-args’
- A list of additional arguments for the Rust compiler ‘rustc’.
- ‘flycheck-rust-check-tests’
- Whether to check test code in Rust.
-
- ‘flycheck-rust-crate-root’
- A path to the crate root for the current buffer, or nil if the
- current buffer is a crate by itself.
-
- ‘flycheck-rust-crate-type’
- The type of the crate to check, as string for the
- ‘--crate-type’ option.
-
- ‘flycheck-rust-library-path’
- A list of library directories for Rust. Relative paths are
- relative to the buffer being checked.
-
- The flycheck-rust (https://github.com/flycheck/flycheck-rust)
- extension configures Flycheck according to the current Cargo
- (http://doc.crates.io/guide.html) project.
-
-Sass
-====
-
- • ‘sass’ (using the standard Sass processor (http://sass-lang.com/)),
- with the following option:
-
- ‘flycheck-sass-compass’
- Whether to enable the Compass CSS framework in SASS, via
- ‘--compass’.
-
-Scala
-=====
-
- 1. ‘scala’ (syntax and type check using the Scala compiler
- (http://www.scala-lang.org/))
- 2. ‘scala-scalastyle’ (style check using Scalastyle
- (http://www.scalastyle.org/))
-
- The ‘scala-scalastyle’ syntax checker needs the following options:
-
-‘flycheck-scalastyle-jar’
- The path to the main JAR file of Scalastyle.
-‘flycheck-scalastylerc’
- Configuration file for Scalastyle. *Note Syntax checker
- configuration files::, for more information about configuration
- files.
-
- If these options are not set, ‘scala-scalastyle’ will not be used.
-
-SCSS
-====
-
- • ‘scss-lint’ (using SCSS-Lint
- (https://github.com/brigade/scss-lint)), or
- • ‘scss’ (using the standard SCSS processor (http://sass-lang.com/))
-
- These syntax checkers provide the following options:
-
-‘flycheck-scss-compass’
- Whether to enable the Compass CSS framework in SCSS, via
- ‘--compass’.
-‘flycheck-scss-lintrc’
- Configuration file for SCSS-Lint. *Note Syntax checker
- configuration files::, for more information about configuration
- files.
-
-Shell scripting languages
-=========================
-
- 1. Syntax check with one of the following checkers, depending on the
- shell used for the current Sh Mode buffer,
- • ‘sh-bash’ (for Bash (http://www.gnu.org/software/bash/))
- • ‘sh-posix-dash’ or ‘sh-posix-bash’ (for POSIX shell scripts,
- using Dash (http://gondor.apana.org.au/~herbert/dash/) or Bash
- (http://www.gnu.org/software/bash/) respectively)
- • ‘sh-zsh’ (for Zsh (http://www.zsh.org/))
- 2. ‘sh-shellcheck’ (code and style check using ShellCheck
- (https://github.com/koalaman/shellcheck/))
-
- ‘sh-shellcheck’ provides the following option:
-
-‘flycheck-shellcheck-excluded-warnings’
- A list of excluded warnings for ShellCheck.
-
-Slim
-====
-
- • ‘slim’ (using Slim (http://slim-lang.com/))
-
-TeX/LaTeX
-=========
-
- • ‘tex-chktex’ (style check using ChkTeX
- (http://www.nongnu.org/chktex/)), or
- • ‘tex-lacheck’ (style check using Lacheck
- (http://www.ctan.org/pkg/lacheck))
-
- ‘tex-chktex’ provides the following option:
-
-‘flycheck-chktexrc’
- Configuration file for ChkTeX. *Note Syntax checker configuration
- files::, for more information about configuration files.
-
-Texinfo
-=======
-
- • ‘texinfo’ (using makeinfo (http://www.gnu.org/software/texinfo/))
-
-Verilog
-=======
-
- • ‘verilog-verilator’ (using Verilator
- (http://www.veripool.org/wiki/verilator))
-
-XML
-===
-
- • ‘xml-xmlstarlet’ (using XMLStarlet
- (http://xmlstar.sourceforge.net)), or
- • ‘xml-xmllint’ (using xmllint (http://www.xmlsoft.org/))
-
-YAML
-====
-
- • ‘yaml-jsyaml’ (using js-yaml (https://github.com/nodeca/js-yaml)),
- or
- • ‘yaml-ruby’ (using Ruby’s YAML parser)
-
-\1f
-File: flycheck.info, Node: Issues, Next: GNU Free Documentation License, Prev: Supported languages, Up: Top
-
-Appendix B Issues
-*****************
-
-Please report any bugs or issues to the issue tracker
-(https://github.com/flycheck/flycheck/issues). If you report a bug,
-please include the following information to help us identify and fix the
-culprit:
-
- • The output of ‘M-x flycheck-verify-setup’ in affected buffers
- • The version of Emacs, as reported by ‘M-x emacs-version’
- • The version of Flycheck, as reported by ‘M-x flycheck-version’
- • A complete and precise description of the issue, including a
- description of the expected _and_ the observed behaviour.
-
- Please also tell us your ideas for improvements or new features.
-
- Patches are _very_ welcome as well. If you have code to contribute,
-please do not hesitate to open a pull request. We would like to ask you
-to obey a few Guidelines
-(https://github.com/flycheck/flycheck/blob/master/CONTRIBUTING.md),
-though.
-
-\1f
-File: flycheck.info, Node: GNU Free Documentation License, Next: Main Index, Prev: Issues, Up: Top
-
-Appendix C GNU Free Documentation License
-*****************************************
-
- Version 1.3, 3 November 2008
-
- Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
- <http://fsf.org/>
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- 0. PREAMBLE
-
- The purpose of this License is to make a manual, textbook, or other
- functional and useful document "free" in the sense of freedom: to
- assure everyone the effective freedom to copy and redistribute it,
- with or without modifying it, either commercially or
- noncommercially. Secondarily, this License preserves for the
- author and publisher a way to get credit for their work, while not
- being considered responsible for modifications made by others.
-
- This License is a kind of “copyleft”, which means that derivative
- works of the document must themselves be free in the same sense.
- It complements the GNU General Public License, which is a copyleft
- license designed for free software.
-
- We have designed this License in order to use it for manuals for
- free software, because free software needs free documentation: a
- free program should come with manuals providing the same freedoms
- that the software does. But this License is not limited to
- software manuals; it can be used for any textual work, regardless
- of subject matter or whether it is published as a printed book. We
- recommend this License principally for works whose purpose is
- instruction or reference.
-
- 1. APPLICABILITY AND DEFINITIONS
-
- This License applies to any manual or other work, in any medium,
- that contains a notice placed by the copyright holder saying it can
- be distributed under the terms of this License. Such a notice
- grants a world-wide, royalty-free license, unlimited in duration,
- to use that work under the conditions stated herein. The
- “Document”, below, refers to any such manual or work. Any member
- of the public is a licensee, and is addressed as “you”. You accept
- the license if you copy, modify or distribute the work in a way
- requiring permission under copyright law.
-
- A “Modified Version” of the Document means any work containing the
- Document or a portion of it, either copied verbatim, or with
- modifications and/or translated into another language.
-
- A “Secondary Section” is a named appendix or a front-matter section
- of the Document that deals exclusively with the relationship of the
- publishers or authors of the Document to the Document’s overall
- subject (or to related matters) and contains nothing that could
- fall directly within that overall subject. (Thus, if the Document
- is in part a textbook of mathematics, a Secondary Section may not
- explain any mathematics.) The relationship could be a matter of
- historical connection with the subject or with related matters, or
- of legal, commercial, philosophical, ethical or political position
- regarding them.
-
- The “Invariant Sections” are certain Secondary Sections whose
- titles are designated, as being those of Invariant Sections, in the
- notice that says that the Document is released under this License.
- If a section does not fit the above definition of Secondary then it
- is not allowed to be designated as Invariant. The Document may
- contain zero Invariant Sections. If the Document does not identify
- any Invariant Sections then there are none.
-
- The “Cover Texts” are certain short passages of text that are
- listed, as Front-Cover Texts or Back-Cover Texts, in the notice
- that says that the Document is released under this License. A
- Front-Cover Text may be at most 5 words, and a Back-Cover Text may
- be at most 25 words.
-
- A “Transparent” copy of the Document means a machine-readable copy,
- represented in a format whose specification is available to the
- general public, that is suitable for revising the document
- straightforwardly with generic text editors or (for images composed
- of pixels) generic paint programs or (for drawings) some widely
- available drawing editor, and that is suitable for input to text
- formatters or for automatic translation to a variety of formats
- suitable for input to text formatters. A copy made in an otherwise
- Transparent file format whose markup, or absence of markup, has
- been arranged to thwart or discourage subsequent modification by
- readers is not Transparent. An image format is not Transparent if
- used for any substantial amount of text. A copy that is not
- “Transparent” is called “Opaque”.
-
- Examples of suitable formats for Transparent copies include plain
- ASCII without markup, Texinfo input format, LaTeX input format,
- SGML or XML using a publicly available DTD, and standard-conforming
- simple HTML, PostScript or PDF designed for human modification.
- Examples of transparent image formats include PNG, XCF and JPG.
- Opaque formats include proprietary formats that can be read and
- edited only by proprietary word processors, SGML or XML for which
- the DTD and/or processing tools are not generally available, and
- the machine-generated HTML, PostScript or PDF produced by some word
- processors for output purposes only.
-
- The “Title Page” means, for a printed book, the title page itself,
- plus such following pages as are needed to hold, legibly, the
- material this License requires to appear in the title page. For
- works in formats which do not have any title page as such, “Title
- Page” means the text near the most prominent appearance of the
- work’s title, preceding the beginning of the body of the text.
-
- The “publisher” means any person or entity that distributes copies
- of the Document to the public.
-
- A section “Entitled XYZ” means a named subunit of the Document
- whose title either is precisely XYZ or contains XYZ in parentheses
- following text that translates XYZ in another language. (Here XYZ
- stands for a specific section name mentioned below, such as
- “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.)
- To “Preserve the Title” of such a section when you modify the
- Document means that it remains a section “Entitled XYZ” according
- to this definition.
-
- The Document may include Warranty Disclaimers next to the notice
- which states that this License applies to the Document. These
- Warranty Disclaimers are considered to be included by reference in
- this License, but only as regards disclaiming warranties: any other
- implication that these Warranty Disclaimers may have is void and
- has no effect on the meaning of this License.
-
- 2. VERBATIM COPYING
-
- You may copy and distribute the Document in any medium, either
- commercially or noncommercially, provided that this License, the
- copyright notices, and the license notice saying this License
- applies to the Document are reproduced in all copies, and that you
- add no other conditions whatsoever to those of this License. You
- may not use technical measures to obstruct or control the reading
- or further copying of the copies you make or distribute. However,
- you may accept compensation in exchange for copies. If you
- distribute a large enough number of copies you must also follow the
- conditions in section 3.
-
- You may also lend copies, under the same conditions stated above,
- and you may publicly display copies.
-
- 3. COPYING IN QUANTITY
-
- If you publish printed copies (or copies in media that commonly
- have printed covers) of the Document, numbering more than 100, and
- the Document’s license notice requires Cover Texts, you must
- enclose the copies in covers that carry, clearly and legibly, all
- these Cover Texts: Front-Cover Texts on the front cover, and
- Back-Cover Texts on the back cover. Both covers must also clearly
- and legibly identify you as the publisher of these copies. The
- front cover must present the full title with all words of the title
- equally prominent and visible. You may add other material on the
- covers in addition. Copying with changes limited to the covers, as
- long as they preserve the title of the Document and satisfy these
- conditions, can be treated as verbatim copying in other respects.
-
- If the required texts for either cover are too voluminous to fit
- legibly, you should put the first ones listed (as many as fit
- reasonably) on the actual cover, and continue the rest onto
- adjacent pages.
-
- If you publish or distribute Opaque copies of the Document
- numbering more than 100, you must either include a machine-readable
- Transparent copy along with each Opaque copy, or state in or with
- each Opaque copy a computer-network location from which the general
- network-using public has access to download using public-standard
- network protocols a complete Transparent copy of the Document, free
- of added material. If you use the latter option, you must take
- reasonably prudent steps, when you begin distribution of Opaque
- copies in quantity, to ensure that this Transparent copy will
- remain thus accessible at the stated location until at least one
- year after the last time you distribute an Opaque copy (directly or
- through your agents or retailers) of that edition to the public.
-
- It is requested, but not required, that you contact the authors of
- the Document well before redistributing any large number of copies,
- to give them a chance to provide you with an updated version of the
- Document.
-
- 4. MODIFICATIONS
-
- You may copy and distribute a Modified Version of the Document
- under the conditions of sections 2 and 3 above, provided that you
- release the Modified Version under precisely this License, with the
- Modified Version filling the role of the Document, thus licensing
- distribution and modification of the Modified Version to whoever
- possesses a copy of it. In addition, you must do these things in
- the Modified Version:
-
- A. Use in the Title Page (and on the covers, if any) a title
- distinct from that of the Document, and from those of previous
- versions (which should, if there were any, be listed in the
- History section of the Document). You may use the same title
- as a previous version if the original publisher of that
- version gives permission.
-
- B. List on the Title Page, as authors, one or more persons or
- entities responsible for authorship of the modifications in
- the Modified Version, together with at least five of the
- principal authors of the Document (all of its principal
- authors, if it has fewer than five), unless they release you
- from this requirement.
-
- C. State on the Title page the name of the publisher of the
- Modified Version, as the publisher.
-
- D. Preserve all the copyright notices of the Document.
-
- E. Add an appropriate copyright notice for your modifications
- adjacent to the other copyright notices.
-
- F. Include, immediately after the copyright notices, a license
- notice giving the public permission to use the Modified
- Version under the terms of this License, in the form shown in
- the Addendum below.
-
- G. Preserve in that license notice the full lists of Invariant
- Sections and required Cover Texts given in the Document’s
- license notice.
-
- H. Include an unaltered copy of this License.
-
- I. Preserve the section Entitled “History”, Preserve its Title,
- and add to it an item stating at least the title, year, new
- authors, and publisher of the Modified Version as given on the
- Title Page. If there is no section Entitled “History” in the
- Document, create one stating the title, year, authors, and
- publisher of the Document as given on its Title Page, then add
- an item describing the Modified Version as stated in the
- previous sentence.
-
- J. Preserve the network location, if any, given in the Document
- for public access to a Transparent copy of the Document, and
- likewise the network locations given in the Document for
- previous versions it was based on. These may be placed in the
- “History” section. You may omit a network location for a work
- that was published at least four years before the Document
- itself, or if the original publisher of the version it refers
- to gives permission.
-
- K. For any section Entitled “Acknowledgements” or “Dedications”,
- Preserve the Title of the section, and preserve in the section
- all the substance and tone of each of the contributor
- acknowledgements and/or dedications given therein.
-
- L. Preserve all the Invariant Sections of the Document, unaltered
- in their text and in their titles. Section numbers or the
- equivalent are not considered part of the section titles.
-
- M. Delete any section Entitled “Endorsements”. Such a section
- may not be included in the Modified Version.
-
- N. Do not retitle any existing section to be Entitled
- “Endorsements” or to conflict in title with any Invariant
- Section.
-
- O. Preserve any Warranty Disclaimers.
-
- If the Modified Version includes new front-matter sections or
- appendices that qualify as Secondary Sections and contain no
- material copied from the Document, you may at your option designate
- some or all of these sections as invariant. To do this, add their
- titles to the list of Invariant Sections in the Modified Version’s
- license notice. These titles must be distinct from any other
- section titles.
-
- You may add a section Entitled “Endorsements”, provided it contains
- nothing but endorsements of your Modified Version by various
- parties—for example, statements of peer review or that the text has
- been approved by an organization as the authoritative definition of
- a standard.
-
- You may add a passage of up to five words as a Front-Cover Text,
- and a passage of up to 25 words as a Back-Cover Text, to the end of
- the list of Cover Texts in the Modified Version. Only one passage
- of Front-Cover Text and one of Back-Cover Text may be added by (or
- through arrangements made by) any one entity. If the Document
- already includes a cover text for the same cover, previously added
- by you or by arrangement made by the same entity you are acting on
- behalf of, you may not add another; but you may replace the old
- one, on explicit permission from the previous publisher that added
- the old one.
-
- The author(s) and publisher(s) of the Document do not by this
- License give permission to use their names for publicity for or to
- assert or imply endorsement of any Modified Version.
-
- 5. COMBINING DOCUMENTS
-
- You may combine the Document with other documents released under
- this License, under the terms defined in section 4 above for
- modified versions, provided that you include in the combination all
- of the Invariant Sections of all of the original documents,
- unmodified, and list them all as Invariant Sections of your
- combined work in its license notice, and that you preserve all
- their Warranty Disclaimers.
-
- The combined work need only contain one copy of this License, and
- multiple identical Invariant Sections may be replaced with a single
- copy. If there are multiple Invariant Sections with the same name
- but different contents, make the title of each such section unique
- by adding at the end of it, in parentheses, the name of the
- original author or publisher of that section if known, or else a
- unique number. Make the same adjustment to the section titles in
- the list of Invariant Sections in the license notice of the
- combined work.
-
- In the combination, you must combine any sections Entitled
- “History” in the various original documents, forming one section
- Entitled “History”; likewise combine any sections Entitled
- “Acknowledgements”, and any sections Entitled “Dedications”. You
- must delete all sections Entitled “Endorsements.”
-
- 6. COLLECTIONS OF DOCUMENTS
-
- You may make a collection consisting of the Document and other
- documents released under this License, and replace the individual
- copies of this License in the various documents with a single copy
- that is included in the collection, provided that you follow the
- rules of this License for verbatim copying of each of the documents
- in all other respects.
-
- You may extract a single document from such a collection, and
- distribute it individually under this License, provided you insert
- a copy of this License into the extracted document, and follow this
- License in all other respects regarding verbatim copying of that
- document.
-
- 7. AGGREGATION WITH INDEPENDENT WORKS
-
- A compilation of the Document or its derivatives with other
- separate and independent documents or works, in or on a volume of a
- storage or distribution medium, is called an “aggregate” if the
- copyright resulting from the compilation is not used to limit the
- legal rights of the compilation’s users beyond what the individual
- works permit. When the Document is included in an aggregate, this
- License does not apply to the other works in the aggregate which
- are not themselves derivative works of the Document.
-
- If the Cover Text requirement of section 3 is applicable to these
- copies of the Document, then if the Document is less than one half
- of the entire aggregate, the Document’s Cover Texts may be placed
- on covers that bracket the Document within the aggregate, or the
- electronic equivalent of covers if the Document is in electronic
- form. Otherwise they must appear on printed covers that bracket
- the whole aggregate.
-
- 8. TRANSLATION
-
- Translation is considered a kind of modification, so you may
- distribute translations of the Document under the terms of section
- 4. Replacing Invariant Sections with translations requires special
- permission from their copyright holders, but you may include
- translations of some or all Invariant Sections in addition to the
- original versions of these Invariant Sections. You may include a
- translation of this License, and all the license notices in the
- Document, and any Warranty Disclaimers, provided that you also
- include the original English version of this License and the
- original versions of those notices and disclaimers. In case of a
- disagreement between the translation and the original version of
- this License or a notice or disclaimer, the original version will
- prevail.
-
- If a section in the Document is Entitled “Acknowledgements”,
- “Dedications”, or “History”, the requirement (section 4) to
- Preserve its Title (section 1) will typically require changing the
- actual title.
-
- 9. TERMINATION
-
- You may not copy, modify, sublicense, or distribute the Document
- except as expressly provided under this License. Any attempt
- otherwise to copy, modify, sublicense, or distribute it is void,
- and will automatically terminate your rights under this License.
-
- However, if you cease all violation of this License, then your
- license from a particular copyright holder is reinstated (a)
- provisionally, unless and until the copyright holder explicitly and
- finally terminates your license, and (b) permanently, if the
- copyright holder fails to notify you of the violation by some
- reasonable means prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
- reinstated permanently if the copyright holder notifies you of the
- violation by some reasonable means, this is the first time you have
- received notice of violation of this License (for any work) from
- that copyright holder, and you cure the violation prior to 30 days
- after your receipt of the notice.
-
- Termination of your rights under this section does not terminate
- the licenses of parties who have received copies or rights from you
- under this License. If your rights have been terminated and not
- permanently reinstated, receipt of a copy of some or all of the
- same material does not give you any rights to use it.
-
- 10. FUTURE REVISIONS OF THIS LICENSE
-
- The Free Software Foundation may publish new, revised versions of
- the GNU Free Documentation License from time to time. Such new
- versions will be similar in spirit to the present version, but may
- differ in detail to address new problems or concerns. See
- <http://www.gnu.org/copyleft/>.
-
- Each version of the License is given a distinguishing version
- number. If the Document specifies that a particular numbered
- version of this License “or any later version” applies to it, you
- have the option of following the terms and conditions either of
- that specified version or of any later version that has been
- published (not as a draft) by the Free Software Foundation. If the
- Document does not specify a version number of this License, you may
- choose any version ever published (not as a draft) by the Free
- Software Foundation. If the Document specifies that a proxy can
- decide which future versions of this License can be used, that
- proxy’s public statement of acceptance of a version permanently
- authorizes you to choose that version for the Document.
-
- 11. RELICENSING
-
- “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
- World Wide Web server that publishes copyrightable works and also
- provides prominent facilities for anybody to edit those works. A
- public wiki that anybody can edit is an example of such a server.
- A “Massive Multiauthor Collaboration” (or “MMC”) contained in the
- site means any set of copyrightable works thus published on the MMC
- site.
-
- “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
- license published by Creative Commons Corporation, a not-for-profit
- corporation with a principal place of business in San Francisco,
- California, as well as future copyleft versions of that license
- published by that same organization.
-
- “Incorporate” means to publish or republish a Document, in whole or
- in part, as part of another Document.
-
- An MMC is “eligible for relicensing” if it is licensed under this
- License, and if all works that were first published under this
- License somewhere other than this MMC, and subsequently
- incorporated in whole or in part into the MMC, (1) had no cover
- texts or invariant sections, and (2) were thus incorporated prior
- to November 1, 2008.
-
- The operator of an MMC Site may republish an MMC contained in the
- site under CC-BY-SA on the same site at any time before August 1,
- 2009, provided the MMC is eligible for relicensing.
-
-ADDENDUM: How to use this License for your documents
-====================================================
-
-To use this License in a document you have written, include a copy of
-the License in the document and put the following copyright and license
-notices just after the title page:
-
- Copyright (C) YEAR YOUR NAME.
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.3
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
- Texts. A copy of the license is included in the section entitled ``GNU
- Free Documentation License''.
-
- If you have Invariant Sections, Front-Cover Texts and Back-Cover
-Texts, replace the “with…Texts.” line with this:
-
- with the Invariant Sections being LIST THEIR TITLES, with
- the Front-Cover Texts being LIST, and with the Back-Cover Texts
- being LIST.
-
- If you have Invariant Sections without Cover Texts, or some other
-combination of the three, merge those two alternatives to suit the
-situation.
-
- If your document contains nontrivial examples of program code, we
-recommend releasing these examples in parallel under your choice of free
-software license, such as the GNU General Public License, to permit
-their use in free software.
-
-\1f
-File: flycheck.info, Node: Main Index, Next: Key Index, Prev: GNU Free Documentation License, Up: Top
-
-Main Index
-**********
-
-\0\b[index\0\b]
-* Menu:
-
-* Ada language: Supported languages. (line 30)
-* AsciiDoc language: Supported languages. (line 47)
-* automatic syntax checker selection: Syntax checkers. (line 6)
-* C/C++ language: Supported languages. (line 52)
-* cask: Installation. (line 61)
-* CFEngine language: Supported languages. (line 115)
-* chaining of syntax checkers: Syntax checkers. (line 15)
-* Chef language: Supported languages. (line 120)
-* Coffeescript language: Supported languages. (line 129)
-* configuration files of syntax checkers: Configuring checkers.
- (line 43)
-* Coq language: Supported languages. (line 141)
-* CSS language: Supported languages. (line 146)
-* D language: Supported languages. (line 152)
-* Emacs Lisp language: Supported languages. (line 166)
-* Erlang language: Supported languages. (line 194)
-* ERuby language: Supported languages. (line 202)
-* executables of syntax checkers: Configuring checkers.
- (line 110)
-* features: Introduction. (line 16)
-* flycheck mode: Checking buffers. (line 6)
-* Fortran language: Supported languages. (line 207)
-* Go language: Supported languages. (line 233)
-* Haml language: Supported languages. (line 252)
-* Handlebars language: Supported languages. (line 257)
-* Haskell language: Supported languages. (line 262)
-* HTML language: Supported languages. (line 298)
-* installation: Installation. (line 37)
-* Javascript language: Supported languages. (line 309)
-* JSON language: Supported languages. (line 343)
-* Language, Ada: Supported languages. (line 30)
-* Language, AsciiDoc: Supported languages. (line 47)
-* Language, C/C++: Supported languages. (line 52)
-* Language, CFEngine: Supported languages. (line 115)
-* Language, Chef: Supported languages. (line 120)
-* Language, Coffeescript: Supported languages. (line 129)
-* Language, Coq: Supported languages. (line 141)
-* Language, CSS: Supported languages. (line 146)
-* Language, D: Supported languages. (line 152)
-* Language, Emacs Lisp: Supported languages. (line 166)
-* Language, Erlang: Supported languages. (line 194)
-* Language, ERuby: Supported languages. (line 202)
-* Language, Fortran: Supported languages. (line 207)
-* Language, Go: Supported languages. (line 233)
-* Language, Haml: Supported languages. (line 252)
-* Language, Handlebars: Supported languages. (line 257)
-* Language, Haskell: Supported languages. (line 262)
-* Language, HTML: Supported languages. (line 298)
-* Language, Javascript: Supported languages. (line 309)
-* Language, JSON: Supported languages. (line 343)
-* Language, Less: Supported languages. (line 348)
-* Language, Lua: Supported languages. (line 353)
-* Language, Perl: Supported languages. (line 366)
-* Language, PHP: Supported languages. (line 383)
-* Language, Puppet: Supported languages. (line 403)
-* Language, Python: Supported languages. (line 410)
-* Language, R: Supported languages. (line 446)
-* Language, Racket: Supported languages. (line 460)
-* Language, reStructuredText: Supported languages. (line 470)
-* Language, RPM Spec: Supported languages. (line 465)
-* Language, Ruby: Supported languages. (line 482)
-* Language, Rust: Supported languages. (line 510)
-* Language, Sass: Supported languages. (line 537)
-* Language, Scala: Supported languages. (line 547)
-* Language, SCSS: Supported languages. (line 566)
-* Language, Shell scripting languages: Supported languages. (line 583)
-* Language, Slim: Supported languages. (line 601)
-* Language, TeX/LaTeX: Supported languages. (line 606)
-* Language, Texinfo: Supported languages. (line 620)
-* Language, Verilog: Supported languages. (line 625)
-* Language, XML: Supported languages. (line 631)
-* Language, YAML: Supported languages. (line 638)
-* Less language: Supported languages. (line 348)
-* Lua language: Supported languages. (line 353)
-* manual syntax checker selection: Syntax checkers. (line 39)
-* operating system: Installation. (line 9)
-* options of syntax checkers: Configuring checkers.
- (line 20)
-* Perl language: Supported languages. (line 366)
-* PHP language: Supported languages. (line 383)
-* prerequisites: Installation. (line 9)
-* Puppet language: Supported languages. (line 403)
-* Python language: Supported languages. (line 410)
-* R language: Supported languages. (line 446)
-* Racket language: Supported languages. (line 460)
-* reStructuredText language: Supported languages. (line 470)
-* RPM Spec language: Supported languages. (line 465)
-* Ruby language: Supported languages. (line 482)
-* Rust language: Supported languages. (line 510)
-* Sass language: Supported languages. (line 537)
-* Scala language: Supported languages. (line 547)
-* SCSS language: Supported languages. (line 566)
-* Shell scripting languages language: Supported languages. (line 583)
-* Slim language: Supported languages. (line 601)
-* syntax checker: Syntax checkers. (line 6)
-* syntax checker configuration files: Configuring checkers.
- (line 43)
-* syntax checker executables: Configuring checkers.
- (line 110)
-* syntax checker options: Configuring checkers.
- (line 20)
-* syntax checker selection, automatic: Syntax checkers. (line 6)
-* syntax checker selection, manual: Syntax checkers. (line 39)
-* TeX/LaTeX language: Supported languages. (line 606)
-* Texinfo language: Supported languages. (line 620)
-* Verilog language: Supported languages. (line 625)
-* XML language: Supported languages. (line 631)
-* YAML language: Supported languages. (line 638)
-
-\1f
-File: flycheck.info, Node: Key Index, Next: Function and Variable Index, Prev: Main Index, Up: Top
-
-Key Index
-*********
-
-\0\b[index\0\b]
-* Menu:
-
-* C-c ! ?: Syntax checkers. (line 31)
-* C-c ! c: Checking buffers. (line 57)
-* C-c ! C-c: Finding error patterns.
- (line 16)
-* C-c ! C-w: Killing errors. (line 8)
-* C-c ! e: Configuring checkers.
- (line 125)
-* C-c ! l: Listing errors. (line 9)
-* C-c ! n: Navigating errors. (line 22)
-* C-c ! p: Navigating errors. (line 32)
-* C-c ! s: Syntax checkers. (line 43)
-* C-c ! v: Checking buffers. (line 63)
-* C-c ! x: Syntax checkers. (line 85)
-* C-u C-c ! C-w: Killing errors. (line 16)
-* C-u C-c ! e: Configuring checkers.
- (line 130)
-* C-u C-c ! s: Syntax checkers. (line 48)
-* C-u C-c ! x: Syntax checkers. (line 89)
-* M-0 C-c ! C-w: Killing errors. (line 20)
-
-\1f
-File: flycheck.info, Node: Function and Variable Index, Prev: Key Index, Up: Top
-
-Function and variable index
-***************************
-
-\0\b[index\0\b]
-* Menu:
-
-* flycheck-buffer: Checking buffers. (line 57)
-* flycheck-check-syntax-automatically: Checking buffers. (line 33)
-* flycheck-checker: Syntax checkers. (line 58)
-* flycheck-checker-error-threshold: Reporting results. (line 50)
-* flycheck-checkers: Syntax checkers. (line 10)
-* flycheck-chktexrc: Supported languages. (line 614)
-* flycheck-clang-args: Supported languages. (line 61)
-* flycheck-clang-blocks: Supported languages. (line 64)
-* flycheck-clang-definitions: Supported languages. (line 66)
-* flycheck-clang-include-path: Supported languages. (line 69)
-* flycheck-clang-includes: Supported languages. (line 73)
-* flycheck-clang-language-standard: Supported languages. (line 77)
-* flycheck-clang-ms-extensions: Supported languages. (line 81)
-* flycheck-clang-no-exceptions: Supported languages. (line 83)
-* flycheck-clang-no-rtti: Supported languages. (line 86)
-* flycheck-clang-pedantic: Supported languages. (line 93)
-* flycheck-clang-pedantic-errors: Supported languages. (line 96)
-* flycheck-clang-standard-library: Supported languages. (line 89)
-* flycheck-clang-warnings: Supported languages. (line 99)
-* flycheck-clear: Reporting results. (line 55)
-* flycheck-coffeelintrc: Supported languages. (line 134)
-* flycheck-compile: Finding error patterns.
- (line 16)
-* flycheck-completion-system: Syntax checkers. (line 123)
-* flycheck-copy-errors-as-kill: Killing errors. (line 8)
-* flycheck-cppcheck-checks: Supported languages. (line 106)
-* flycheck-cppcheck-inconclusive: Supported languages. (line 109)
-* flycheck-describe-checker: Syntax checkers. (line 31)
-* flycheck-disable-checker: Syntax checkers. (line 85)
-* flycheck-disabled-checkers: Syntax checkers. (line 102)
-* flycheck-display-error-messages: Displaying errors. (line 23)
-* flycheck-display-error-messages-unless-error-list: Displaying errors.
- (line 26)
-* flycheck-display-errors-delay: Displaying errors. (line 9)
-* flycheck-display-errors-function: Displaying errors. (line 16)
-* flycheck-dmd-args: Supported languages. (line 157)
-* flycheck-dmd-include-path: Supported languages. (line 155)
-* flycheck-emacs-lisp-initialize-packages: Supported languages.
- (line 182)
-* flycheck-emacs-lisp-load-path: Supported languages. (line 177)
-* flycheck-emacs-lisp-package-user-dir: Supported languages. (line 188)
-* flycheck-erlang-include-path: Supported languages. (line 197)
-* flycheck-error: Reporting results. (line 32)
-* flycheck-error-list-after-refresh-hook: Listing errors. (line 14)
-* flycheck-error-list-highlight: Listing errors. (line 41)
-* flycheck-eslint-rulesdir: Supported languages. (line 321)
-* flycheck-eslintrc: Supported languages. (line 323)
-* flycheck-first-error: Navigating errors. (line 42)
-* flycheck-flake8-error-level-alist: Supported languages. (line 425)
-* flycheck-flake8-maximum-complexity: Supported languages. (line 428)
-* flycheck-flake8-maximum-line-length: Supported languages. (line 431)
-* flycheck-flake8rc: Supported languages. (line 434)
-* flycheck-foodcritic-tags: Supported languages. (line 124)
-* flycheck-gcc-args: Supported languages. (line 62)
-* flycheck-gcc-definitions: Supported languages. (line 67)
-* flycheck-gcc-include-path: Supported languages. (line 70)
-* flycheck-gcc-includes: Supported languages. (line 74)
-* flycheck-gcc-language-standard: Supported languages. (line 78)
-* flycheck-gcc-no-exceptions: Supported languages. (line 84)
-* flycheck-gcc-no-rtti: Supported languages. (line 87)
-* flycheck-gcc-openmp: Supported languages. (line 91)
-* flycheck-gcc-pedantic: Supported languages. (line 94)
-* flycheck-gcc-pedantic-errors: Supported languages. (line 97)
-* flycheck-gcc-warnings: Supported languages. (line 100)
-* flycheck-gfortran-args: Supported languages. (line 212)
-* flycheck-gfortran-include-path: Supported languages. (line 215)
-* flycheck-gfortran-language-standard: Supported languages. (line 219)
-* flycheck-gfortran-layout: Supported languages. (line 223)
-* flycheck-gfortran-warnings: Supported languages. (line 228)
-* flycheck-ghc-args: Supported languages. (line 279)
-* flycheck-ghc-language-extensions: Supported languages. (line 293)
-* flycheck-ghc-no-user-package-database: Supported languages. (line 282)
-* flycheck-ghc-package-databases: Supported languages. (line 285)
-* flycheck-ghc-search-path: Supported languages. (line 290)
-* flycheck-gjslintrc: Supported languages. (line 333)
-* flycheck-global-modes: Checking buffers. (line 6)
-* flycheck-gnat-args: Supported languages. (line 34)
-* flycheck-gnat-include-path: Supported languages. (line 36)
-* flycheck-gnat-language-standard: Supported languages. (line 39)
-* flycheck-gnat-warnings: Supported languages. (line 41)
-* flycheck-go-vet-print-functions: Supported languages. (line 246)
-* flycheck-highlighting-mode: Reporting results. (line 15)
-* flycheck-idle-change-delay: Checking buffers. (line 40)
-* flycheck-indication-mode: Reporting results. (line 36)
-* flycheck-info: Reporting results. (line 32)
-* flycheck-jscsrc: Supported languages. (line 337)
-* flycheck-jshintrc: Supported languages. (line 330)
-* flycheck-keymap-prefix: Usage. (line 8)
-* flycheck-lintr-caching: Supported languages. (line 450)
-* flycheck-lintr-linters: Supported languages. (line 454)
-* flycheck-list-errors: Listing errors. (line 9)
-* flycheck-locate-config-file-functions: Configuring checkers.
- (line 84)
-* flycheck-luacheckrc: Supported languages. (line 357)
-* flycheck-mode: Checking buffers. (line 6)
-* flycheck-navigation-minimum-level: Navigating errors. (line 55)
-* flycheck-next-error: Navigating errors. (line 22)
-* flycheck-perl-include-path: Supported languages. (line 374)
-* flycheck-perlcritic-severity: Supported languages. (line 377)
-* flycheck-phpcs-standard: Supported languages. (line 397)
-* flycheck-phpmd-rulesets: Supported languages. (line 392)
-* flycheck-previous-error: Navigating errors. (line 32)
-* flycheck-pylintrc: Supported languages. (line 440)
-* flycheck-rubocop-lint-only: Supported languages. (line 490)
-* flycheck-rubocoprc: Supported languages. (line 493)
-* flycheck-rubylintrc: Supported languages. (line 496)
-* flycheck-rust-args: Supported languages. (line 514)
-* flycheck-rust-check-tests: Supported languages. (line 516)
-* flycheck-rust-crate-root: Supported languages. (line 519)
-* flycheck-rust-crate-type: Supported languages. (line 523)
-* flycheck-rust-library-path: Supported languages. (line 527)
-* flycheck-sass-compass: Supported languages. (line 541)
-* flycheck-scalastyle-jar: Supported languages. (line 555)
-* flycheck-scalastylerc: Supported languages. (line 557)
-* flycheck-scss-compass: Supported languages. (line 573)
-* flycheck-scss-lintrc: Supported languages. (line 576)
-* flycheck-select-checker: Syntax checkers. (line 43)
-* flycheck-set-checker-executable: Configuring checkers.
- (line 125)
-* flycheck-shellcheck-excluded-warnings: Supported languages. (line 596)
-* flycheck-sphinx-warn-on-missing-references: Supported languages.
- (line 477)
-* flycheck-standard-error-navigation: Navigating errors. (line 6)
-* flycheck-temp-prefix: Checking buffers. (line 71)
-* flycheck-tidyrc: Supported languages. (line 302)
-* flycheck-verify-setup: Checking buffers. (line 63)
-* flycheck-warning: Reporting results. (line 32)
-* global-flycheck-mode: Checking buffers. (line 6)
-* list-flycheck-errors: Listing errors. (line 9)
-
-
-\1f
-Tag Table:
-Node: Top\7f1137
-Node: Introduction\7f3358
-Node: Installation\7f4451
-Node: Quickstart\7f6739
-Node: Usage\7f9275
-Node: Checking buffers\7f10275
-Node: Syntax checkers\7f13099
-Node: Reporting results\7f18498
-Node: Navigating errors\7f20817
-Node: Displaying errors\7f23373
-Node: Killing errors\7f24782
-Node: Listing errors\7f25569
-Node: Mode line display\7f27121
-Node: Configuring checkers\7f28434
-Ref: Syntax checker options\7f29150
-Ref: Syntax checker configuration files\7f30168
-Ref: Syntax checker executables\7f33055
-Node: Syntax checker definitions\7f34259
-Node: Defining syntax checkers\7f35440
-Node: Finding error patterns\7f39659
-Node: Trying new checkers\7f41006
-Node: Registering new checkers\7f41691
-Node: Parsing structured output\7f43239
-Node: Passing configuration to checkers\7f44482
-Node: Controlling use of checkers\7f48086
-Node: Applying multiple checkers\7f49188
-Node: Flycheck hooks\7f52441
-Node: Flycheck API\7f54074
-Node: Command syntax checkers\7f54412
-Node: Argument Substitution\7f54782
-Node: Checker configuration\7f54952
-Node: Error parsers\7f55164
-Node: Errors\7f55310
-Node: Supported languages\7f55422
-Ref: language-Ada\7f56631
-Ref: language-AsciiDoc\7f57255
-Ref: language-C/C++\7f57338
-Ref: language-CFEngine\7f59792
-Ref: language-Chef\7f59860
-Ref: language-Coffeescript\7f60105
-Ref: language-Coq\7f60505
-Ref: language-CSS\7f60561
-Ref: language-D\7f60671
-Ref: language-Emacs Lisp\7f61116
-Ref: language-Erlang\7f62244
-Ref: language-ERuby\7f62405
-Ref: language-Fortran\7f62500
-Ref: language-Go\7f63393
-Ref: language-Haml\7f64143
-Ref: language-Handlebars\7f64212
-Ref: language-Haskell\7f64294
-Ref: language-HTML\7f65534
-Ref: language-Javascript\7f65843
-Ref: language-JSON\7f67203
-Ref: language-Less\7f67289
-Ref: language-Lua\7f67346
-Ref: language-Perl\7f67704
-Ref: language-PHP\7f68239
-Ref: language-Puppet\7f68931
-Ref: language-Python\7f69113
-Ref: language-R\7f70397
-Ref: language-Racket\7f70834
-Ref: language-RPM Spec\7f70909
-Ref: language-reStructuredText\7f71023
-Ref: language-Ruby\7f71412
-Ref: language-Rust\7f72423
-Ref: language-Sass\7f73361
-Ref: language-Scala\7f73614
-Ref: language-SCSS\7f74221
-Ref: language-Shell scripting languages\7f74781
-Ref: language-Slim\7f75517
-Ref: language-TeX/LaTeX\7f75594
-Ref: language-Texinfo\7f76006
-Ref: language-Verilog\7f76101
-Ref: language-XML\7f76206
-Ref: language-YAML\7f76374
-Node: Issues\7f76513
-Node: GNU Free Documentation License\7f77534
-Node: Main Index\7f102881
-Node: Key Index\7f110860
-Node: Function and Variable Index\7f112368
-\1f
-End Tag Table
-
-\1f
-Local Variables:
-coding: utf-8
-End:
--- /dev/null
+This is the file .../info/dir, which contains the
+topmost node of the Info hierarchy, called (dir)Top.
+The first time you invoke Info you start off looking at this node.
+\1f
+File: dir, Node: Top This is the top of the INFO tree
+
+ This (the Directory node) gives a menu of major topics.
+ Typing "q" exits, "?" lists all Info commands, "d" returns here,
+ "h" gives a primer for first-timers,
+ "mEmacs<Return>" visits the Emacs manual, etc.
+
+ In Emacs, you can click mouse button 2 on a menu item or cross reference
+ to select it.
+
+* Menu:
+
+Emacs
+* Flycheck: (flycheck). Modern on-the-fly syntax checking
--- /dev/null
+This is fdl-1.3.info, produced by makeinfo version 5.2 from
+fdl-1.3.texi.
+
+ Version 1.3, 3 November 2008
+
+ Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+ <http://fsf.org/>
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ 0. PREAMBLE
+
+ The purpose of this License is to make a manual, textbook, or other
+ functional and useful document "free" in the sense of freedom: to
+ assure everyone the effective freedom to copy and redistribute it,
+ with or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the
+ author and publisher a way to get credit for their work, while not
+ being considered responsible for modifications made by others.
+
+ This License is a kind of "copyleft", which means that derivative
+ works of the document must themselves be free in the same sense.
+ It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
+
+ We have designed this License in order to use it for manuals for
+ free software, because free software needs free documentation: a
+ free program should come with manuals providing the same freedoms
+ that the software does. But this License is not limited to
+ software manuals; it can be used for any textual work, regardless
+ of subject matter or whether it is published as a printed book. We
+ recommend this License principally for works whose purpose is
+ instruction or reference.
+
+ 1. APPLICABILITY AND DEFINITIONS
+
+ This License applies to any manual or other work, in any medium,
+ that contains a notice placed by the copyright holder saying it can
+ be distributed under the terms of this License. Such a notice
+ grants a world-wide, royalty-free license, unlimited in duration,
+ to use that work under the conditions stated herein. The
+ "Document", below, refers to any such manual or work. Any member
+ of the public is a licensee, and is addressed as "you". You accept
+ the license if you copy, modify or distribute the work in a way
+ requiring permission under copyright law.
+
+ A "Modified Version" of the Document means any work containing the
+ Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+
+ A "Secondary Section" is a named appendix or a front-matter section
+ of the Document that deals exclusively with the relationship of the
+ publishers or authors of the Document to the Document's overall
+ subject (or to related matters) and contains nothing that could
+ fall directly within that overall subject. (Thus, if the Document
+ is in part a textbook of mathematics, a Secondary Section may not
+ explain any mathematics.) The relationship could be a matter of
+ historical connection with the subject or with related matters, or
+ of legal, commercial, philosophical, ethical or political position
+ regarding them.
+
+ The "Invariant Sections" are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in the
+ notice that says that the Document is released under this License.
+ If a section does not fit the above definition of Secondary then it
+ is not allowed to be designated as Invariant. The Document may
+ contain zero Invariant Sections. If the Document does not identify
+ any Invariant Sections then there are none.
+
+ The "Cover Texts" are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice
+ that says that the Document is released under this License. A
+ Front-Cover Text may be at most 5 words, and a Back-Cover Text may
+ be at most 25 words.
+
+ A "Transparent" copy of the Document means a machine-readable copy,
+ represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images composed
+ of pixels) generic paint programs or (for drawings) some widely
+ available drawing editor, and that is suitable for input to text
+ formatters or for automatic translation to a variety of formats
+ suitable for input to text formatters. A copy made in an otherwise
+ Transparent file format whose markup, or absence of markup, has
+ been arranged to thwart or discourage subsequent modification by
+ readers is not Transparent. An image format is not Transparent if
+ used for any substantial amount of text. A copy that is not
+ "Transparent" is called "Opaque".
+
+ Examples of suitable formats for Transparent copies include plain
+ ASCII without markup, Texinfo input format, LaTeX input format,
+ SGML or XML using a publicly available DTD, and standard-conforming
+ simple HTML, PostScript or PDF designed for human modification.
+ Examples of transparent image formats include PNG, XCF and JPG.
+ Opaque formats include proprietary formats that can be read and
+ edited only by proprietary word processors, SGML or XML for which
+ the DTD and/or processing tools are not generally available, and
+ the machine-generated HTML, PostScript or PDF produced by some word
+ processors for output purposes only.
+
+ The "Title Page" means, for a printed book, the title page itself,
+ plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For
+ works in formats which do not have any title page as such, "Title
+ Page" means the text near the most prominent appearance of the
+ work's title, preceding the beginning of the body of the text.
+
+ The "publisher" means any person or entity that distributes copies
+ of the Document to the public.
+
+ A section "Entitled XYZ" means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ
+ stands for a specific section name mentioned below, such as
+ "Acknowledgements", "Dedications", "Endorsements", or "History".)
+ To "Preserve the Title" of such a section when you modify the
+ Document means that it remains a section "Entitled XYZ" according
+ to this definition.
+
+ The Document may include Warranty Disclaimers next to the notice
+ which states that this License applies to the Document. These
+ Warranty Disclaimers are considered to be included by reference in
+ this License, but only as regards disclaiming warranties: any other
+ implication that these Warranty Disclaimers may have is void and
+ has no effect on the meaning of this License.
+
+ 2. VERBATIM COPYING
+
+ You may copy and distribute the Document in any medium, either
+ commercially or noncommercially, provided that this License, the
+ copyright notices, and the license notice saying this License
+ applies to the Document are reproduced in all copies, and that you
+ add no other conditions whatsoever to those of this License. You
+ may not use technical measures to obstruct or control the reading
+ or further copying of the copies you make or distribute. However,
+ you may accept compensation in exchange for copies. If you
+ distribute a large enough number of copies you must also follow the
+ conditions in section 3.
+
+ You may also lend copies, under the same conditions stated above,
+ and you may publicly display copies.
+
+ 3. COPYING IN QUANTITY
+
+ If you publish printed copies (or copies in media that commonly
+ have printed covers) of the Document, numbering more than 100, and
+ the Document's license notice requires Cover Texts, you must
+ enclose the copies in covers that carry, clearly and legibly, all
+ these Cover Texts: Front-Cover Texts on the front cover, and
+ Back-Cover Texts on the back cover. Both covers must also clearly
+ and legibly identify you as the publisher of these copies. The
+ front cover must present the full title with all words of the title
+ equally prominent and visible. You may add other material on the
+ covers in addition. Copying with changes limited to the covers, as
+ long as they preserve the title of the Document and satisfy these
+ conditions, can be treated as verbatim copying in other respects.
+
+ If the required texts for either cover are too voluminous to fit
+ legibly, you should put the first ones listed (as many as fit
+ reasonably) on the actual cover, and continue the rest onto
+ adjacent pages.
+
+ If you publish or distribute Opaque copies of the Document
+ numbering more than 100, you must either include a machine-readable
+ Transparent copy along with each Opaque copy, or state in or with
+ each Opaque copy a computer-network location from which the general
+ network-using public has access to download using public-standard
+ network protocols a complete Transparent copy of the Document, free
+ of added material. If you use the latter option, you must take
+ reasonably prudent steps, when you begin distribution of Opaque
+ copies in quantity, to ensure that this Transparent copy will
+ remain thus accessible at the stated location until at least one
+ year after the last time you distribute an Opaque copy (directly or
+ through your agents or retailers) of that edition to the public.
+
+ It is requested, but not required, that you contact the authors of
+ the Document well before redistributing any large number of copies,
+ to give them a chance to provide you with an updated version of the
+ Document.
+
+ 4. MODIFICATIONS
+
+ You may copy and distribute a Modified Version of the Document
+ under the conditions of sections 2 and 3 above, provided that you
+ release the Modified Version under precisely this License, with the
+ Modified Version filling the role of the Document, thus licensing
+ distribution and modification of the Modified Version to whoever
+ possesses a copy of it. In addition, you must do these things in
+ the Modified Version:
+
+ A. Use in the Title Page (and on the covers, if any) a title
+ distinct from that of the Document, and from those of previous
+ versions (which should, if there were any, be listed in the
+ History section of the Document). You may use the same title
+ as a previous version if the original publisher of that
+ version gives permission.
+
+ B. List on the Title Page, as authors, one or more persons or
+ entities responsible for authorship of the modifications in
+ the Modified Version, together with at least five of the
+ principal authors of the Document (all of its principal
+ authors, if it has fewer than five), unless they release you
+ from this requirement.
+
+ C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+
+ D. Preserve all the copyright notices of the Document.
+
+ E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+
+ F. Include, immediately after the copyright notices, a license
+ notice giving the public permission to use the Modified
+ Version under the terms of this License, in the form shown in
+ the Addendum below.
+
+ G. Preserve in that license notice the full lists of Invariant
+ Sections and required Cover Texts given in the Document's
+ license notice.
+
+ H. Include an unaltered copy of this License.
+
+ I. Preserve the section Entitled "History", Preserve its Title,
+ and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on the
+ Title Page. If there is no section Entitled "History" in the
+ Document, create one stating the title, year, authors, and
+ publisher of the Document as given on its Title Page, then add
+ an item describing the Modified Version as stated in the
+ previous sentence.
+
+ J. Preserve the network location, if any, given in the Document
+ for public access to a Transparent copy of the Document, and
+ likewise the network locations given in the Document for
+ previous versions it was based on. These may be placed in the
+ "History" section. You may omit a network location for a work
+ that was published at least four years before the Document
+ itself, or if the original publisher of the version it refers
+ to gives permission.
+
+ K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the section
+ all the substance and tone of each of the contributor
+ acknowledgements and/or dedications given therein.
+
+ L. Preserve all the Invariant Sections of the Document, unaltered
+ in their text and in their titles. Section numbers or the
+ equivalent are not considered part of the section titles.
+
+ M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+
+ N. Do not retitle any existing section to be Entitled
+ "Endorsements" or to conflict in title with any Invariant
+ Section.
+
+ O. Preserve any Warranty Disclaimers.
+
+ If the Modified Version includes new front-matter sections or
+ appendices that qualify as Secondary Sections and contain no
+ material copied from the Document, you may at your option designate
+ some or all of these sections as invariant. To do this, add their
+ titles to the list of Invariant Sections in the Modified Version's
+ license notice. These titles must be distinct from any other
+ section titles.
+
+ You may add a section Entitled "Endorsements", provided it contains
+ nothing but endorsements of your Modified Version by various
+ parties--for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative
+ definition of a standard.
+
+ You may add a passage of up to five words as a Front-Cover Text,
+ and a passage of up to 25 words as a Back-Cover Text, to the end of
+ the list of Cover Texts in the Modified Version. Only one passage
+ of Front-Cover Text and one of Back-Cover Text may be added by (or
+ through arrangements made by) any one entity. If the Document
+ already includes a cover text for the same cover, previously added
+ by you or by arrangement made by the same entity you are acting on
+ behalf of, you may not add another; but you may replace the old
+ one, on explicit permission from the previous publisher that added
+ the old one.
+
+ The author(s) and publisher(s) of the Document do not by this
+ License give permission to use their names for publicity for or to
+ assert or imply endorsement of any Modified Version.
+
+ 5. COMBINING DOCUMENTS
+
+ You may combine the Document with other documents released under
+ this License, under the terms defined in section 4 above for
+ modified versions, provided that you include in the combination all
+ of the Invariant Sections of all of the original documents,
+ unmodified, and list them all as Invariant Sections of your
+ combined work in its license notice, and that you preserve all
+ their Warranty Disclaimers.
+
+ The combined work need only contain one copy of this License, and
+ multiple identical Invariant Sections may be replaced with a single
+ copy. If there are multiple Invariant Sections with the same name
+ but different contents, make the title of each such section unique
+ by adding at the end of it, in parentheses, the name of the
+ original author or publisher of that section if known, or else a
+ unique number. Make the same adjustment to the section titles in
+ the list of Invariant Sections in the license notice of the
+ combined work.
+
+ In the combination, you must combine any sections Entitled
+ "History" in the various original documents, forming one section
+ Entitled "History"; likewise combine any sections Entitled
+ "Acknowledgements", and any sections Entitled "Dedications". You
+ must delete all sections Entitled "Endorsements."
+
+ 6. COLLECTIONS OF DOCUMENTS
+
+ You may make a collection consisting of the Document and other
+ documents released under this License, and replace the individual
+ copies of this License in the various documents with a single copy
+ that is included in the collection, provided that you follow the
+ rules of this License for verbatim copying of each of the documents
+ in all other respects.
+
+ You may extract a single document from such a collection, and
+ distribute it individually under this License, provided you insert
+ a copy of this License into the extracted document, and follow this
+ License in all other respects regarding verbatim copying of that
+ document.
+
+ 7. AGGREGATION WITH INDEPENDENT WORKS
+
+ A compilation of the Document or its derivatives with other
+ separate and independent documents or works, in or on a volume of a
+ storage or distribution medium, is called an "aggregate" if the
+ copyright resulting from the compilation is not used to limit the
+ legal rights of the compilation's users beyond what the individual
+ works permit. When the Document is included in an aggregate, this
+ License does not apply to the other works in the aggregate which
+ are not themselves derivative works of the Document.
+
+ If the Cover Text requirement of section 3 is applicable to these
+ copies of the Document, then if the Document is less than one half
+ of the entire aggregate, the Document's Cover Texts may be placed
+ on covers that bracket the Document within the aggregate, or the
+ electronic equivalent of covers if the Document is in electronic
+ form. Otherwise they must appear on printed covers that bracket
+ the whole aggregate.
+
+ 8. TRANSLATION
+
+ Translation is considered a kind of modification, so you may
+ distribute translations of the Document under the terms of section
+ 4. Replacing Invariant Sections with translations requires special
+ permission from their copyright holders, but you may include
+ translations of some or all Invariant Sections in addition to the
+ original versions of these Invariant Sections. You may include a
+ translation of this License, and all the license notices in the
+ Document, and any Warranty Disclaimers, provided that you also
+ include the original English version of this License and the
+ original versions of those notices and disclaimers. In case of a
+ disagreement between the translation and the original version of
+ this License or a notice or disclaimer, the original version will
+ prevail.
+
+ If a section in the Document is Entitled "Acknowledgements",
+ "Dedications", or "History", the requirement (section 4) to
+ Preserve its Title (section 1) will typically require changing the
+ actual title.
+
+ 9. TERMINATION
+
+ You may not copy, modify, sublicense, or distribute the Document
+ except as expressly provided under this License. Any attempt
+ otherwise to copy, modify, sublicense, or distribute it is void,
+ and will automatically terminate your rights under this License.
+
+ However, if you cease all violation of this License, then your
+ license from a particular copyright holder is reinstated (a)
+ provisionally, unless and until the copyright holder explicitly and
+ finally terminates your license, and (b) permanently, if the
+ copyright holder fails to notify you of the violation by some
+ reasonable means prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+ reinstated permanently if the copyright holder notifies you of the
+ violation by some reasonable means, this is the first time you have
+ received notice of violation of this License (for any work) from
+ that copyright holder, and you cure the violation prior to 30 days
+ after your receipt of the notice.
+
+ Termination of your rights under this section does not terminate
+ the licenses of parties who have received copies or rights from you
+ under this License. If your rights have been terminated and not
+ permanently reinstated, receipt of a copy of some or all of the
+ same material does not give you any rights to use it.
+
+ 10. FUTURE REVISIONS OF THIS LICENSE
+
+ The Free Software Foundation may publish new, revised versions of
+ the GNU Free Documentation License from time to time. Such new
+ versions will be similar in spirit to the present version, but may
+ differ in detail to address new problems or concerns. See
+ <http://www.gnu.org/copyleft/>.
+
+ Each version of the License is given a distinguishing version
+ number. If the Document specifies that a particular numbered
+ version of this License "or any later version" applies to it, you
+ have the option of following the terms and conditions either of
+ that specified version or of any later version that has been
+ published (not as a draft) by the Free Software Foundation. If the
+ Document does not specify a version number of this License, you may
+ choose any version ever published (not as a draft) by the Free
+ Software Foundation. If the Document specifies that a proxy can
+ decide which future versions of this License can be used, that
+ proxy's public statement of acceptance of a version permanently
+ authorizes you to choose that version for the Document.
+
+ 11. RELICENSING
+
+ "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
+ World Wide Web server that publishes copyrightable works and also
+ provides prominent facilities for anybody to edit those works. A
+ public wiki that anybody can edit is an example of such a server.
+ A "Massive Multiauthor Collaboration" (or "MMC") contained in the
+ site means any set of copyrightable works thus published on the MMC
+ site.
+
+ "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
+ license published by Creative Commons Corporation, a not-for-profit
+ corporation with a principal place of business in San Francisco,
+ California, as well as future copyleft versions of that license
+ published by that same organization.
+
+ "Incorporate" means to publish or republish a Document, in whole or
+ in part, as part of another Document.
+
+ An MMC is "eligible for relicensing" if it is licensed under this
+ License, and if all works that were first published under this
+ License somewhere other than this MMC, and subsequently
+ incorporated in whole or in part into the MMC, (1) had no cover
+ texts or invariant sections, and (2) were thus incorporated prior
+ to November 1, 2008.
+
+ The operator of an MMC Site may republish an MMC contained in the
+ site under CC-BY-SA on the same site at any time before August 1,
+ 2009, provided the MMC is eligible for relicensing.
+
+ADDENDUM: How to use this License for your documents
+====================================================
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and license
+notices just after the title page:
+
+ Copyright (C) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.3
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover
+Texts, replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with
+ the Front-Cover Texts being LIST, and with the Back-Cover Texts
+ being LIST.
+
+ If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+ If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of free
+software license, such as the GNU General Public License, to permit
+their use in free software.
+
+
+\1f
+Tag Table:
+\1f
+End Tag Table
--- /dev/null
+;;; flycheck-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "flycheck" "flycheck.el" (22215 7567 0 0))
+;;; Generated autoloads from flycheck.el
+
+(autoload 'flycheck-info "flycheck" "\
+Open the Flycheck manual.
+
+\(fn)" t nil)
+
+(autoload 'flycheck-mode "flycheck" "\
+Minor mode for on-the-fly syntax checking.
+
+When called interactively, toggle `flycheck-mode'. With prefix
+ARG, enable `flycheck-mode' if ARG is positive, otherwise disable
+it.
+
+When called from Lisp, enable `flycheck-mode' if ARG is omitted,
+nil or positive. If ARG is `toggle', toggle `flycheck-mode'.
+Otherwise behave as if called interactively.
+
+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.
+
+\\{flycheck-mode-map}
+
+\(fn &optional ARG)" t nil)
+
+(defvar global-flycheck-mode nil "\
+Non-nil if Global-Flycheck mode is enabled.
+See the command `global-flycheck-mode' 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, enable the mode if
+ARG is omitted or nil.
+
+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 nil)
+
+(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.
+
+ 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 BITMAP'
+ A fringe bitmap symbol denoting the bitmap to use for fringe
+ indicators for this level. 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.
+
+`: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)" nil nil)
+
+(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.
+
+ 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)" nil nil)
+
+(put 'flycheck-define-command-checker 'lisp-indent-function '1)
+
+(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 a configuration file 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.
+
+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)
+
+(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)
+
+(put 'flycheck-def-option-var 'lisp-indent-function '3)
+
+(put 'flycheck-def-option-var 'doc-string-elt '4)
+
+;;;***
+\f
+;;;### (autoloads nil nil ("flycheck-buttercup.el" "flycheck-ert.el"
+;;;;;; "flycheck-pkg.el") (22215 7567 763689 0))
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; flycheck-autoloads.el ends here
--- /dev/null
+;;; flycheck-buttercup.el --- Flycheck: Extensions to Buttercup -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors
+
+;; Author: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
+;; Keywords: lisp, tools
+
+;; 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:
+
+;; Extensions to Buttercup to write BDD tests for Flycheck.
+;;
+;; Buttercup is a BDD testing framework for Emacs, see URL
+;; `https://github.com/jorgenschaefer/emacs-buttercup/'. Flycheck uses
+;; Buttercup extensively for new tests.
+;;
+;; This library provides extensions to Buttercup to write Specs for Flycheck.
+;;
+;; * Custom matchers
+;;
+;; (expect 'foo :to-be-local) - Is `foo' a local variable in the current buffer?
+
+;;; Code:
+
+(require 'buttercup)
+(require 'flycheck)
+(require 'seq)
+
+\f
+;;; Buttercup helpers
+
+(defun flycheck-buttercup-format-error-list (errors)
+ "Format ERRORS into a human-readable string."
+ (mapconcat (lambda (e) (flycheck-error-format e 'with-file-name))
+ errors "\n"))
+
+\f
+;;; Data matchers
+
+(buttercup-define-matcher :to-be-empty-string (s)
+ (if (equal s "")
+ (cons t (format "Expected %S not be an empty string" s))
+ (cons nil (format "Expected %S to be an empty string" s))))
+
+(buttercup-define-matcher :to-match-with-group (re s index match)
+ (let* ((matches? (string-match re s))
+ (result (and matches? (match-string index s))))
+ (if (and matches? (equal result match))
+ (cons t (format "Expected %S not to match %S with %S in group %s"
+ re s match index))
+
+ (cons nil (format "Expected %S to match %S with %S in group %s, %s"
+ re s match index
+ (if matches?
+ (format "but got %S" result)
+ "but did not match"))))))
+
+\f
+;;; Emacs feature matchers
+
+(buttercup-define-matcher :to-be-local (symbol)
+ (if (local-variable-p symbol)
+ (cons t (format "Expected %S not to be a local variable, but it is"
+ symbol))
+ (cons nil (format "Expected %S to be a local variable, but it is not"
+ symbol))))
+
+\f
+;;; Flycheck matchers
+
+(buttercup-define-matcher :to-be-equal-flycheck-errors (a b)
+ (let ((a-formatted (flycheck-buttercup-format-error-list a))
+ (b-formatted (flycheck-buttercup-format-error-list b)))
+ (if (equal a b)
+ (cons t (format "Expected
+%s
+not to be equal to
+%s" a-formatted b-formatted))
+ (cons nil (format "Expected
+%s
+to be equal to
+%s" a-formatted b-formatted)))))
+
+(provide 'flycheck-buttercup)
+;;; flycheck-buttercup.el ends here
--- /dev/null
+;;; flycheck-ert.el --- Flycheck: ERT extensions -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2013-2016 Sebastian Wiesner and Flycheck contributors
+
+;; Author: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
+;; Maintainer: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
+;; URL: https://github.com/flycheck/flycheck
+
+;; 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:
+
+;; Unit testing library for Flycheck, the modern on-the-fly syntax checking
+;; extension for GNU Emacs.
+
+;; Provide various utility functions and unit test helpers to test Flycheck and
+;; Flycheck extensions.
+
+;;; Code:
+
+(require 'flycheck)
+(require 'ert)
+(require 'macroexp) ; For macro utilities
+
+\f
+;;; Compatibility
+
+(eval-and-compile
+ ;; Provide `ert-skip' and friends for Emacs 24.3
+ (defconst flycheck-ert-ert-can-skip (fboundp 'ert-skip)
+ "Whether ERT supports test skipping.")
+
+ (unless flycheck-ert-ert-can-skip
+ ;; Fake skipping
+
+ (setf (get 'flycheck-ert-skipped 'error-message) "Test skipped")
+ (setf (get 'flycheck-ert-skipped 'error-conditions) '(error))
+
+ (defun ert-skip (data)
+ (signal 'flycheck-ert-skipped data))
+
+ (defmacro skip-unless (form)
+ `(unless (ignore-errors ,form)
+ (signal 'flycheck-ert-skipped ',form)))
+
+ (defun ert-test-skipped-p (result)
+ (and (ert-test-failed-p result)
+ (eq (car (ert-test-failed-condition result))
+ 'flycheck-ert-skipped)))))
+
+\f
+;;; Internal variables
+
+(defvar flycheck-ert--resource-directory nil
+ "The directory to get resources from in this test suite.")
+
+\f
+;;; Resource management macros
+
+(defmacro flycheck-ert-with-temp-buffer (&rest body)
+ "Eval BODY within a temporary buffer.
+
+Like `with-temp-buffer', but resets the modification state of the
+temporary buffer to make sure that it is properly killed even if
+it has a backing file and is modified."
+ (declare (indent 0))
+ `(with-temp-buffer
+ (unwind-protect
+ ,(macroexp-progn body)
+ ;; Reset modification state of the buffer, and unlink it from its backing
+ ;; file, if any, because Emacs refuses to kill modified buffers with
+ ;; backing files, even if they are temporary.
+ (set-buffer-modified-p nil)
+ (set-visited-file-name nil 'no-query))))
+
+(defmacro flycheck-ert-with-file-buffer (file-name &rest body)
+ "Create a buffer from FILE-NAME and eval BODY.
+
+BODY is evaluated with `current-buffer' being a buffer with the
+contents FILE-NAME."
+ (declare (indent 1))
+ `(let ((file-name ,file-name))
+ (unless (file-exists-p file-name)
+ (error "%s does not exist" file-name))
+ (flycheck-ert-with-temp-buffer
+ (insert-file-contents file-name 'visit)
+ (set-visited-file-name file-name 'no-query)
+ (cd (file-name-directory file-name))
+ ;; Mark the buffer as not modified, because we just loaded the file up to
+ ;; now.
+ (set-buffer-modified-p nil)
+ ,@body)))
+
+(defmacro flycheck-ert-with-help-buffer (&rest body)
+ "Execute BODY and kill the help buffer afterwards.
+
+Use this macro to test functions that create a Help buffer."
+ (declare (indent 0))
+ `(unwind-protect
+ ,(macroexp-progn body)
+ (when (buffer-live-p (get-buffer (help-buffer)))
+ (kill-buffer (help-buffer)))))
+
+(defmacro flycheck-ert-with-global-mode (&rest body)
+ "Execute BODY with Global Flycheck Mode enabled.
+
+After BODY, restore the old state of Global Flycheck Mode."
+ (declare (indent 0))
+ `(let ((old-state global-flycheck-mode))
+ (unwind-protect
+ (progn
+ (global-flycheck-mode 1)
+ ,@body)
+ (global-flycheck-mode (if old-state 1 -1)))))
+
+(defmacro flycheck-ert-with-env (env &rest body)
+ "Add ENV to `process-environment' in BODY.
+
+Execute BODY with a `process-environment' with contains all
+variables from ENV added.
+
+ENV is an alist, where each cons cell `(VAR . VALUE)' is a
+environment variable VAR to be added to `process-environment'
+with VALUE."
+ (declare (indent 1))
+ `(let ((process-environment (copy-sequence process-environment)))
+ (pcase-dolist (`(,var . ,value) ,env)
+ (setenv var value))
+ ,@body))
+
+\f
+;;; Test resources
+(defun flycheck-ert-resource-filename (resource-file)
+ "Determine the absolute file name of a RESOURCE-FILE.
+
+Relative file names are expanded against
+`flycheck-ert-resources-directory'."
+ (expand-file-name resource-file flycheck-ert--resource-directory))
+
+(defmacro flycheck-ert-with-resource-buffer (resource-file &rest body)
+ "Create a temp buffer from a RESOURCE-FILE and execute BODY.
+
+The absolute file name of RESOURCE-FILE is determined with
+`flycheck-ert-resource-filename'."
+ (declare (indent 1))
+ `(flycheck-ert-with-file-buffer
+ (flycheck-ert-resource-filename ,resource-file)
+ ,@body))
+
+\f
+;;; Test suite initialization
+
+(defun flycheck-ert-initialize (resource-dir)
+ "Initialize a test suite with RESOURCE-DIR.
+
+RESOURCE-DIR is the directory, `flycheck-ert-resource-filename'
+should use to lookup resource files."
+ (when flycheck-ert--resource-directory
+ (error "Test suite already initialized"))
+ (let ((tests (ert-select-tests t t)))
+ ;; Select all tests
+ (unless tests
+ (error "No tests defined. Call `flycheck-ert-initialize' after defining all tests!"))
+
+ (setq flycheck-ert--resource-directory resource-dir)
+
+ ;; Emacs 24.3 don't support skipped tests, so we add poor man's test
+ ;; skipping: We mark skipped tests as expected failures by adjusting the
+ ;; expected result of all test cases. Not particularly pretty, but works :)
+ (unless flycheck-ert-ert-can-skip
+ (dolist (test tests)
+ (let ((result (ert-test-expected-result-type test)))
+ (setf (ert-test-expected-result-type test)
+ `(or ,result (satisfies ert-test-skipped-p))))))))
+
+\f
+;;; Environment and version information
+(defun flycheck-ert-check-gpg ()
+ "Check whether GPG is available."
+ (or (epg-check-configuration (epg-configuration)) t))
+
+\f
+;;; Test case definitions
+(defmacro flycheck-ert-def-checker-test (checker language name
+ &rest keys-and-body)
+ "Define a test case for a syntax CHECKER for LANGUAGE.
+
+CHECKER is a symbol or a list of symbols denoting syntax checkers
+being tested by the test. The test case is skipped, if any of
+these checkers cannot be used. LANGUAGE is a symbol or a list of
+symbols denoting the programming languages supported by the
+syntax checkers. This is currently only used for tagging the
+test appropriately.
+
+NAME is a symbol denoting the local name of the test. The test
+itself is ultimately named
+`flycheck-define-checker/CHECKER/NAME'. If CHECKER is a list,
+the first checker in the list is used for naming the test.
+
+Optionally, the keyword arguments `:tags' and `:expected-result'
+may be given. They have the same meaning as in `ert-deftest.',
+and are added to the tags and result expectations set up by this
+macro.
+
+The remaining forms KEYS-AND-BODY denote the body of the test
+case, including assertions and setup code."
+ (declare (indent 3))
+ (unless checker
+ (error "No syntax checkers specified"))
+ (unless language
+ (error "No languages specified"))
+ (let* ((checkers (if (symbolp checker) (list checker) checker))
+ (checker (car checkers))
+ (languages (if (symbolp language) (list language) language))
+ (language-tags (mapcar (lambda (l) (intern (format "language-%s" l)))
+ languages))
+ (checker-tags (mapcar (lambda (c) (intern (format "checker-%s" c)))
+ checkers))
+ (local-name (or name 'default))
+ (full-name (intern (format "flycheck-define-checker/%s/%s"
+ checker local-name)))
+ (keys-and-body (ert--parse-keys-and-body keys-and-body))
+ (body (cadr keys-and-body))
+ (keys (car keys-and-body))
+ (default-tags '(syntax-checker external-tool)))
+ `(ert-deftest ,full-name ()
+ :expected-result
+ (list 'or
+ '(satisfies flycheck-ert-syntax-check-timed-out-p)
+ ,(or (plist-get keys :expected-result) :passed))
+ :tags (append ',(append default-tags language-tags checker-tags)
+ ,(plist-get keys :tags))
+ ,@(mapcar (lambda (c) `(skip-unless
+ ;; Ignore non-command checkers
+ (or (not (flycheck-checker-get ',c 'command))
+ (executable-find (flycheck-checker-executable ',c)))))
+ checkers)
+ ,@body)))
+
+\f
+;;; Test case results
+
+(defun flycheck-ert-syntax-check-timed-out-p (result)
+ "Whether RESULT denotes a timed-out test.
+
+RESULT is an ERT test result object."
+ (and (ert-test-failed-p result)
+ (eq (car (ert-test-failed-condition result))
+ 'flycheck-ert-syntax-check-timed-out)))
+
+\f
+;;; Syntax checking in tests
+
+(defvar-local flycheck-ert-syntax-checker-finished nil
+ "Non-nil if the current checker has finished.")
+
+(add-hook 'flycheck-after-syntax-check-hook
+ (lambda () (setq flycheck-ert-syntax-checker-finished t)))
+
+(defconst flycheck-ert-checker-wait-time 10
+ "Time to wait until a checker is finished in seconds.
+
+After this time has elapsed, the checker is considered to have
+failed, and the test aborted with failure.")
+
+(put 'flycheck-ert-syntax-check-timed-out 'error-message
+ "Syntax check timed out.")
+(put 'flycheck-ert-syntax-check-timed-out 'error-conditions '(error))
+
+(defun flycheck-ert-wait-for-syntax-checker ()
+ "Wait until the syntax check in the current buffer is finished."
+ (let ((starttime (float-time)))
+ (while (and (not flycheck-ert-syntax-checker-finished)
+ (< (- (float-time) starttime) flycheck-ert-checker-wait-time))
+ (sleep-for 1))
+ (unless (< (- (float-time) starttime) flycheck-ert-checker-wait-time)
+ (flycheck-stop)
+ (signal 'flycheck-ert-syntax-check-timed-out nil)))
+ (setq flycheck-ert-syntax-checker-finished nil))
+
+(defun flycheck-ert-buffer-sync ()
+ "Like `flycheck-buffer', but synchronously."
+ (setq flycheck-ert-syntax-checker-finished nil)
+ (should (not (flycheck-running-p)))
+ (flycheck-mode) ; This will only start a deferred check,
+ (flycheck-buffer) ; so we need an explicit manual check
+ ;; After starting the check, the checker should either be running now, or
+ ;; already be finished (if it was fast).
+ (should (or flycheck-current-syntax-check
+ flycheck-ert-syntax-checker-finished))
+ ;; Also there should be no deferred check pending anymore
+ (should-not (flycheck-deferred-check-p))
+ (flycheck-ert-wait-for-syntax-checker))
+
+(defun flycheck-ert-ensure-clear ()
+ "Clear the current buffer.
+
+Raise an assertion error if the buffer is not clear afterwards."
+ (flycheck-clear)
+ (should (not flycheck-current-errors))
+ (should (not (-any? (lambda (ov) (overlay-get ov 'flycheck-overlay))
+ (overlays-in (point-min) (point-max))))))
+
+\f
+;;; Test assertions
+
+(defun flycheck-ert-should-overlay (error)
+ "Test that ERROR has a proper overlay in the current buffer.
+
+ERROR is a Flycheck error object."
+ (let* ((overlay (-first (lambda (ov) (equal (overlay-get ov 'flycheck-error)
+ error))
+ (flycheck-overlays-in 0 (+ 1 (buffer-size)))))
+ (region (flycheck-error-region-for-mode error 'symbols))
+ (level (flycheck-error-level error))
+ (category (flycheck-error-level-overlay-category level))
+ (face (get category 'face))
+ (fringe-bitmap (flycheck-error-level-fringe-bitmap level))
+ (fringe-face (flycheck-error-level-fringe-face level))
+ (fringe-icon (list 'left-fringe fringe-bitmap fringe-face)))
+ (should overlay)
+ (should (overlay-get overlay 'flycheck-overlay))
+ (should (= (overlay-start overlay) (car region)))
+ (should (= (overlay-end overlay) (cdr region)))
+ (should (eq (overlay-get overlay 'face) face))
+ (should (equal (get-char-property 0 'display
+ (overlay-get overlay 'before-string))
+ fringe-icon))
+ (should (eq (overlay-get overlay 'category) category))
+ (should (equal (overlay-get overlay 'flycheck-error) error))))
+
+(defun flycheck-ert-should-errors (&rest errors)
+ "Test that the current buffers has ERRORS.
+
+ERRORS is a list of errors expected to be present in the current
+buffer. Each error is given as a list of arguments to
+`flycheck-error-new-at'.
+
+If ERRORS are omitted, test that there are no errors at all in
+the current buffer.
+
+With ERRORS, test that each error in ERRORS is present in the
+current buffer, and that the number of errors in the current
+buffer is equal to the number of given ERRORS. In other words,
+check that the buffer has all ERRORS, and no other errors."
+ (let ((expected (mapcar (apply-partially #'apply #'flycheck-error-new-at)
+ errors)))
+ (should (equal expected flycheck-current-errors))
+ (mapc #'flycheck-ert-should-overlay expected))
+ (should (= (length errors)
+ (length (flycheck-overlays-in (point-min) (point-max))))))
+
+(defun flycheck-ert-should-syntax-check (resource-file modes &rest errors)
+ "Test a syntax check in RESOURCE-FILE with MODES.
+
+RESOURCE-FILE is the file to check. MODES is a single major mode
+symbol or a list thereof, specifying the major modes to syntax
+check with. If more than one major mode is specified, the test
+is run for each mode separately, so if you give three major
+modes, the entire test will run three times. ERRORS is the list
+of expected errors, as in `flycheck-ert-should-errors'. If
+omitted, the syntax check must not emit any errors. The errors
+are cleared after each test.
+
+The syntax checker is selected via standard syntax checker
+selection. To test a specific checker, you need to set
+`flycheck-checker' or `flycheck-disabled-checkers' accordingly
+before using this predicate, depending on whether you want to use
+manual or automatic checker selection.
+
+During the syntax check, configuration files of syntax checkers
+are also searched in the `config-files' sub-directory of the
+resource directory."
+ (when (symbolp modes)
+ (setq modes (list modes)))
+ (dolist (mode modes)
+ (unless (fboundp mode)
+ (ert-skip (format "%S missing" mode)))
+ (flycheck-ert-with-resource-buffer resource-file
+ (funcall mode)
+ ;; Configure config file locating for unit tests
+ (let ((process-hook-called 0))
+ (add-hook 'flycheck-process-error-functions
+ (lambda (_err)
+ (setq process-hook-called (1+ process-hook-called))
+ nil)
+ nil :local)
+ (flycheck-ert-buffer-sync)
+ (apply #'flycheck-ert-should-errors errors)
+ (should (= process-hook-called (length errors))))
+ (flycheck-ert-ensure-clear))))
+
+(defun flycheck-ert-at-nth-error (n)
+ "Determine whether point is at the N'th Flycheck error.
+
+Return non-nil if the point is at the N'th Flycheck error in the
+current buffer. Otherwise return nil."
+ (let* ((error (nth (1- n) flycheck-current-errors))
+ (mode flycheck-highlighting-mode)
+ (region (flycheck-error-region-for-mode error mode)))
+ (and (member error (flycheck-overlay-errors-at (point)))
+ (= (point) (car region)))))
+
+(defun flycheck-ert-explain--at-nth-error (n)
+ "Explain a failed at-nth-error predicate at N."
+ (let ((errors (flycheck-overlay-errors-at (point))))
+ (if (null errors)
+ (format "Expected to be at error %s, but no error at point %s"
+ n (point))
+ (let ((pos (cl-position (car errors) flycheck-current-errors)))
+ (format "Expected to be at error %s, but point %s is at error %s"
+ n (point) (1+ pos))))))
+
+(put 'flycheck-ert-at-nth-error 'ert-explainer
+ 'flycheck-ert-explain--at-nth-error)
+
+(provide 'flycheck-ert)
+
+;;; flycheck-ert.el ends here
--- /dev/null
+(define-package "flycheck" "20160218.41" "On-the-fly syntax checking"
+ '((dash "2.12.1")
+ (pkg-info "0.4")
+ (let-alist "1.0.4")
+ (seq "1.11")
+ (emacs "24.3"))
+ :url "https://www.flycheck.org" :keywords
+ '("convenience" "languages" "tools"))
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
--- /dev/null
+;;; flycheck.el --- On-the-fly syntax checking -*- lexical-binding: t; -*-
+
+;; Copyright (c) 2012-2016 Sebastian Wiesner and Flycheck contributors
+;; Copyright (C) 2013, 2014 Free Software Foundation, Inc.
+;;
+;; Author: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
+;; Maintainer: Sebastian Wiesner <swiesnerNOSPAMlunaryorn.com>
+;; Clément Pit--Claudel <clement.pitclaudelNOSPAMlive.com>
+;; URL: https://www.flycheck.org
+;; Keywords: convenience, languages, tools
+;; Version: 0.26-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.
+;;
+;; This package provides on-the-fly syntax checking for GNU Emacs 24. It is a
+;; replacement for the older Flymake extension which is part of GNU Emacs, with
+;; many improvements and additional features.
+;;
+;; Flycheck provides fully-automatic, fail-safe, on-the-fly background syntax
+;; checking for over 30 programming and markup languages with more than 70
+;; different tools. It highlights errors and warnings inline in the buffer, and
+;; provides 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.
+;;
+;; # 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.
+;;
+;; # Documentation
+;;
+;; Flycheck comes with a rich manual, which you can read in Emacs with `M-x
+;; flycheck-info' after installing this package. It is also available online at
+;; URL `http://www.flycheck.org/manual/latest/index.html'.
+;;
+;; The manual has a Quickstart section which gives you a short and comprehensive
+;; introduction into Flycheck's features and usage, and a complete list of all
+;; supported languages and tools.
+
+;;; Code:
+
+(eval-when-compile
+ (require 'let-alist) ; `let-alist'
+ (require 'compile) ; Compile Mode integration
+ (require 'jka-compr) ; For JKA workarounds in `flycheck-temp-file-system'
+ (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'
+
+
+;; 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 package-user-dir) ; For emacs-lisp option filters
+
+;; Tell the byte compiler about autoloaded functions from packages
+(declare-function pkg-info-version-info "pkg-info" (package))
+
+\f
+;;; 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))))))
+
+ ;; 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 ""))))
+
+\f
+;;; 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")
+ :link '(custom-manual "(flycheck)Top")
+ :link '(info-link "(flycheck)Usage"))
+
+(defgroup flycheck-config-files nil
+ "Configuration files for on-the-fly syntax checkers."
+ :prefix "flycheck-"
+ :group 'flycheck
+ :link '(custom-manual "(flycheck)Syntax checker configuration files"))
+
+(defgroup flycheck-options nil
+ "Options for on-the-fly syntax checkers."
+ :prefix "flycheck-"
+ :group 'flycheck
+ :link '(custom-manual "(flycheck)Syntax checker options"))
+
+(defgroup flycheck-executables nil
+ "Executables of syntax checkers."
+ :prefix "flycheck-"
+ :group 'flycheck
+ :link '(custom-manual "(flycheck)Syntax checker executables"))
+
+(defgroup flycheck-faces nil
+ "Faces used by on-the-fly syntax checking."
+ :prefix "flycheck-"
+ :group 'flycheck
+ :link '(info-link "(flycheck)Error reporting"))
+
+(defcustom flycheck-checkers
+ '(ada-gnat
+ asciidoc
+ c/c++-clang
+ c/c++-gcc
+ c/c++-cppcheck
+ cfengine
+ chef-foodcritic
+ coffee
+ coffee-coffeelint
+ coq
+ css-csslint
+ d-dmd
+ emacs-lisp
+ emacs-lisp-checkdoc
+ erlang
+ eruby-erubis
+ fortran-gfortran
+ go-gofmt
+ go-golint
+ go-vet
+ go-build
+ go-test
+ go-errcheck
+ groovy
+ haml
+ handlebars
+ haskell-stack-ghc
+ haskell-ghc
+ haskell-hlint
+ html-tidy
+ jade
+ javascript-jshint
+ javascript-eslint
+ javascript-gjslint
+ javascript-jscs
+ javascript-standard
+ json-jsonlint
+ json-python-json
+ less
+ luacheck
+ lua
+ perl
+ perl-perlcritic
+ php
+ php-phpmd
+ php-phpcs
+ processing
+ puppet-parser
+ puppet-lint
+ python-flake8
+ python-pylint
+ python-pycompile
+ r-lintr
+ rpm-rpmlint
+ rst-sphinx
+ rst
+ ruby-rubocop
+ ruby-rubylint
+ ruby
+ ruby-jruby
+ rust-cargo
+ rust
+ sass
+ scala
+ scala-scalastyle
+ scss-lint
+ scss
+ sh-bash
+ sh-posix-dash
+ sh-posix-bash
+ sh-zsh
+ sh-shellcheck
+ slim
+ sql-sqlint
+ tex-chktex
+ tex-lacheck
+ texinfo
+ verilog-verilator
+ xml-xmlstarlet
+ xml-xmllint
+ yaml-jsyaml
+ yaml-ruby)
+ "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-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 #'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 the standard `executable-find' function which
+searches `exec-path'. 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'" executable-find)
+ (function :tag "Search executables with a custom function"))
+ :package-version '(flycheck . "0.25")
+ :risky t)
+
+(defcustom flycheck-indication-mode 'left-fringe
+ "The indication mode for Flycheck errors and warnings.
+
+This variable controls how Flycheck indicates errors in buffers.
+May either be `left-fringe', `right-fringe', or nil.
+
+If set to `left-fringe' or `right-fringe', indicate errors and
+warnings via icons in the left and right fringe respectively.
+
+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 "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. The following modes are known:
+
+`columns'
+ Highlight the error column. If the error does not have a column,
+ highlight the whole line.
+
+`symbols'
+ Highlight the symbol at the error column, if there is any,
+ otherwise behave like `columns'. This is the default.
+
+`sexps'
+ Highlight the expression at the error column, 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)
+
+(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.
+
+`new-line'
+ Check syntax immediately after a new line was inserted into
+ the buffer.
+
+`mode-enabled'
+ Check syntax immediately when `flycheck-mode' is enabled.
+
+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 a new line was inserted" new-line)
+ (const :tag "After `flycheck-mode' was enabled" mode-enabled))
+ :package-version '(flycheck . "0.12")
+ :safe #'symbolp)
+
+(defcustom flycheck-idle-change-delay 0.5
+ "How many seconds to wait before checking syntax automatically.
+
+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-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 `flycheck-mode' is
+enabled. Changing it will not affect buffers which already have
+`flycheck-mode' enabled."
+ :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-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 . "0.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 `flycheck-mode'."
+ :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 sinlge argument, as
+given to `flycheck-report-status', which see.
+
+This variable is a 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
+ '((((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
+ '((t :inherit error))
+ "Flycheck face for fringe error indicators."
+ :package-version '(flycheck . "0.13")
+ :group 'flycheck-faces)
+
+(defface flycheck-fringe-warning
+ '((t :inherit warning))
+ "Flycheck face for fringe warning indicators."
+ :package-version '(flycheck . "0.13")
+ :group 'flycheck-faces)
+
+(defface flycheck-fringe-info
+ ;; Semantically `success' is probably not the right face, but it looks nice as
+ ;; a base face
+ '((t :inherit success))
+ "Flycheck face for fringe info indicators."
+ :package-version '(flycheck . "0.15")
+ :group 'flycheck-faces)
+
+(defface flycheck-error-list-error
+ '((t :inherit error))
+ "Flycheck face for error messages in the error list."
+ :package-version '(flycheck . "0.16")
+ :group 'flycheck-faces)
+
+(defface flycheck-error-list-warning
+ '((t :inherit warning))
+ "Flycheck face for warning messages in the error list."
+ :package-version '(flycheck . "0.16")
+ :group 'flycheck-faces)
+
+(defface flycheck-error-list-info
+ '((t :inherit success))
+ "Flycheck face for info messages in the error list."
+ :package-version '(flycheck . "0.16")
+ :group 'flycheck-faces)
+
+;; The base faces for the following two faces are inspired by Compilation Mode
+(defface flycheck-error-list-line-number
+ '((t :inherit font-lock-constant-face))
+ "Face for line numbers in the error list."
+ :group 'flycheck-faces
+ :package-version '(flycheck . "0.16"))
+
+(defface flycheck-error-list-column-number
+ '((t :inherit font-lock-constant-face))
+ "Face for line numbers in the error list."
+ :group 'flycheck-faces
+ :package-version '(flycheck . "0.16"))
+
+(defface flycheck-error-list-id
+ '((t :inherit font-lock-type-face))
+ "Face for the error ID in the error list."
+ :group 'flycheck-faces
+ :package-version '(flycheck . "0.22"))
+
+(defface flycheck-error-list-checker-name
+ '((t :inherit font-lock-function-name-face))
+ "Face for the syntax checker name in the error list."
+ :group 'flycheck-faces
+ :package-version '(flycheck . "0.21"))
+
+(defface flycheck-error-list-highlight
+ '((t :inherit highlight))
+ "Flycheck face to highlight errors in the error list."
+ :package-version '(flycheck . "0.15")
+ :group 'flycheck-faces)
+
+(defvar flycheck-command-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "c" #'flycheck-buffer)
+ (define-key map "C" #'flycheck-clear)
+ (define-key map (kbd "C-c") #'flycheck-compile)
+ (define-key map "n" #'flycheck-next-error)
+ (define-key map "p" #'flycheck-previous-error)
+ (define-key map "l" #'flycheck-list-errors)
+ (define-key map (kbd "C-w") #'flycheck-copy-errors-as-kill)
+ (define-key map "s" #'flycheck-select-checker)
+ (define-key map "e" #'flycheck-set-checker-executable)
+ (define-key map "?" #'flycheck-describe-checker)
+ (define-key map "h" #'flycheck-display-error-at-point)
+ (define-key map "H" #'display-local-help)
+ (define-key map "i" #'flycheck-info)
+ (define-key map "V" #'flycheck-version)
+ (define-key map "v" #'flycheck-verify-setup)
+ (define-key map "x" #'flycheck-disable-checker)
+ map)
+ "Keymap of Flycheck interactive commands.")
+
+(defcustom flycheck-keymap-prefix (kbd "C-c !")
+ "Prefix for key bindings of Flycheck.
+
+Changing this variable outside Customize does not have any
+effect. To change the keymap prefix from Lisp, you need to
+explicitly re-define the prefix key:
+
+ (define-key flycheck-mode-map flycheck-keymap-prefix nil)
+ (setq flycheck-keymap-prefix (kbd \"C-c f\"))
+ (define-key flycheck-mode-map flycheck-keymap-prefix
+ flycheck-command-map)
+
+Please note that Flycheck's manual documents the default
+keybindings. Changing this variable is at your own risk."
+ :group 'flycheck
+ :package-version '(flycheck . "0.19")
+ :type 'string
+ :risky t
+ :set
+ (lambda (variable key)
+ (when (and (boundp variable) (boundp 'flycheck-mode-map))
+ (define-key flycheck-mode-map (symbol-value variable) nil)
+ (define-key flycheck-mode-map key flycheck-command-map))
+ (set-default variable key)))
+
+(defcustom flycheck-mode-line '(:eval (flycheck-mode-line-status-text))
+ "Mode line lighter for Flycheck.
+
+The value of this variable is a mode line template as in
+`mode-line-format'. See Info Node `(elisp)Mode Line Format' for
+more information. Note that it should contain a _single_ mode
+line construct only.
+
+Customize this variable to change how Flycheck reports its status
+in the mode line. You may use `flycheck-mode-line-status-text'
+to obtain a human-readable status text, including an
+error/warning count.
+
+You may also assemble your own status text. The current status
+of Flycheck is available in `flycheck-last-status-change'. The
+errors in the current buffer are stored in
+`flycheck-current-errors', and the function
+`flycheck-count-errors' may be used to obtain the number of
+errors grouped by error level.
+
+Set this variable to nil to disable the mode line completely."
+ :group 'flycheck
+ :type 'sexp
+ :risky t
+ :package-version '(flycheck . "0.20"))
+
+(defcustom flycheck-mode-line-prefix "FlyC"
+ "Base mode line lighter for Flycheck.
+
+This will have an effect only with the default
+`flycheck-mode-line'.
+
+If you've customized `flycheck-mode-line' then the customized
+function must be updated to use this variable."
+ :group 'flycheck
+ :type 'string
+ :package-version '(flycheck . "0.26"))
+
+(defcustom flycheck-error-list-mode-line
+ `(,(propertized-buffer-identification "%12b")
+ " for buffer "
+ (:eval (flycheck-error-list-propertized-source-name))
+ (:eval (flycheck-error-list-mode-line-filter-indicator)))
+ "Mode line construct for Flycheck error list.
+
+The value of this variable is a mode line template as in
+`mode-line-format', to be used as
+`mode-line-buffer-identification' in `flycheck-error-list-mode'.
+See Info Node `(elisp)Mode Line Format' for more information.
+
+Customize this variable to change how the error list appears in
+the mode line. The default shows the name of the buffer and the
+name of the source buffer, i.e. the buffer whose errors are
+currently listed."
+ :group 'flycheck
+ :type 'sexp
+ :risky t
+ :package-version '(flycheck . "0.20"))
+
+(defcustom flycheck-global-modes t
+ "Modes for which `flycheck-mode' is turned on by `global-flycheck-mode'.
+
+If t, Flycheck Mode is turned on for all major modes. If a list,
+Flycheck Mode is turned on for all `major-mode' symbols in that
+list. If the `car' of the list is `not', Flycheck Mode is turned
+on for all `major-mode' symbols _not_ in that list. If nil,
+Flycheck Mode is never turned on by `global-flycheck-mode'.
+
+Note that Flycheck is never turned on for modes whose
+`mode-class' property is `special' (see Info node `(elisp)Major
+Mode Conventions'), regardless of the value of this option."
+ :group 'flycheck
+ :type '(choice (const :tag "none" nil)
+ (const :tag "all" t)
+ (set :menu-tag "mode specific" :tag "modes"
+ :value (not)
+ (const :tag "Except" not)
+ (repeat :inline t (symbol :tag "mode"))))
+ :risky t
+ :package-version '(flycheck . "0.23"))
+
+;; Add built-in functions to our hooks, via `add-hook', to make sure that our
+;; functions are really present, even if the variable was implicitly defined by
+;; another call to `add-hook' that occurred before Flycheck was loaded. See
+;; http://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01271.html for why
+;; we don't initialize the hook variables right away. We append our own
+;; functions, because a user likely expects that their functions come first,
+;; even if the added them before Flycheck was loaded.
+(dolist (hook (list #'flycheck-locate-config-file-by-path
+ #'flycheck-locate-config-file-ancestor-directories
+ #'flycheck-locate-config-file-home))
+ (add-hook 'flycheck-locate-config-file-functions hook 'append))
+
+(add-hook 'flycheck-process-error-functions #'flycheck-add-overlay 'append)
+
+\f
+;;; Global Flycheck menu
+(defvar flycheck-mode-menu-map
+ (easy-menu-create-menu
+ "Syntax Checking"
+ '(["Enable on-the-fly syntax checking" flycheck-mode
+ :style toggle :selected flycheck-mode
+ ;; Don't let users toggle the mode if there is no syntax checker for this
+ ;; buffer
+ :enable (or flycheck-mode (flycheck-get-checker-for-buffer))]
+ ["Check current buffer" flycheck-buffer flycheck-mode]
+ ["Clear errors in buffer" flycheck-clear t]
+ "---"
+ ["Go to next error" flycheck-next-error flycheck-mode]
+ ["Go to previous error" flycheck-previous-error flycheck-mode]
+ ["Show all errors" flycheck-list-errors flycheck-mode]
+ "---"
+ ["Copy messages at point" flycheck-copy-errors-as-kill
+ (flycheck-overlays-at (point))]
+ "---"
+ ["Select syntax checker" flycheck-select-checker flycheck-mode]
+ ["Disable syntax checker" flycheck-disable-checker flycheck-mode]
+ ["Set executable of syntax checker" flycheck-set-checker-executable
+ flycheck-mode]
+ "---"
+ ["Describe syntax checker" flycheck-describe-checker t]
+ ["Show Flycheck version" flycheck-version t]
+ ["Read the Flycheck manual" flycheck-info t]))
+ "Menu of `flycheck-mode'.")
+
+(easy-menu-add-item nil '("Tools") flycheck-mode-menu-map "Spell Checking")
+
+\f
+;;; Version information, manual and loading of Flycheck
+(defun flycheck-version (&optional show-version)
+ "Get the Flycheck version as string.
+
+If called interactively or if SHOW-VERSION is non-nil, show the
+version in the echo area and the messages buffer.
+
+The returned string includes both, the version from package.el
+and the library version, if both a present and different.
+
+If the version number could not be determined, signal an error,
+if called interactively, or if SHOW-VERSION is non-nil, otherwise
+just return nil."
+ (interactive (list t))
+ (let ((version (pkg-info-version-info 'flycheck)))
+ (when show-version
+ (message "Flycheck version: %s" version))
+ version))
+
+(defun flycheck-unload-function ()
+ "Unload function for Flycheck."
+ (global-flycheck-mode -1)
+ (easy-menu-remove-item nil '("Tools") (cadr flycheck-mode-menu-map))
+ (remove-hook 'kill-emacs-hook #'flycheck-global-teardown)
+ (setq find-function-regexp-alist
+ (assq-delete-all 'flycheck-checker find-function-regexp-alist)))
+
+;;;###autoload
+(defun flycheck-info ()
+ "Open the Flycheck manual."
+ (interactive)
+ (info "flycheck"))
+
+\f
+;;; Utility functions
+(defun flycheck-sexp-to-string (sexp)
+ "Convert SEXP to a string.
+
+Like `prin1-to-string' but ensure that the returned string
+is loadable."
+ (let ((print-quoted t)
+ (print-length nil)
+ (print-level nil))
+ (prin1-to-string sexp)))
+
+(defun flycheck-string-to-number-safe (string)
+ "Safely convert STRING to a number.
+
+If STRING is of string type and a numeric string, convert STRING
+to a number and return it. Otherwise return nil."
+ (let ((number-re (rx string-start (one-or-more (any digit)) string-end)))
+ (when (and (stringp string) (string-match-p number-re string))
+ (string-to-number string))))
+
+(defun flycheck-string-list-p (obj)
+ "Determine if OBJ is a list of strings."
+ (and (listp obj) (seq-every-p #'stringp obj)))
+
+(defun flycheck-symbol-list-p (obj)
+ "Determine if OBJ is a list of symbols."
+ (and (listp obj) (seq-every-p #'symbolp obj)))
+
+(defun flycheck-same-files-p (file-a file-b)
+ "Determine whether FILE-A and FILE-B refer to the same file."
+ (let ((file-a (expand-file-name file-a))
+ (file-b (expand-file-name file-b)))
+ ;; We must resolve symbolic links here, since some syntax checker always
+ ;; output canonical file names with all symbolic links resolved. However,
+ ;; we still do a simple path compassion first, to avoid the comparatively
+ ;; expensive file system call if possible. See
+ ;; https://github.com/flycheck/flycheck/issues/561
+ (or (string= (directory-file-name file-a) (directory-file-name file-b))
+ (string= (directory-file-name (file-truename file-a))
+ (directory-file-name (file-truename file-b))))))
+
+(defvar-local flycheck-temporaries nil
+ "Temporary files and directories created by Flycheck.")
+
+(defun flycheck-temp-dir-system ()
+ "Create a unique temporary directory.
+
+Use `flycheck-temp-prefix' as prefix, and add the directory to
+`flycheck-temporaries'.
+
+Return the path of the directory"
+ (let* ((tempdir (make-temp-file flycheck-temp-prefix 'directory)))
+ (push tempdir flycheck-temporaries)
+ tempdir))
+
+(defun flycheck-temp-file-system (filename)
+ "Create a temporary file named after FILENAME.
+
+If FILENAME is non-nil, this function creates a temporary
+directory with `flycheck-temp-dir-system', and creates a file
+with the same name as FILENAME in this directory.
+
+Otherwise this function creates a temporary file with
+`flycheck-temp-prefix' and a random suffix. The path of the file
+is added to `flycheck-temporaries'.
+
+Add the path of the file to `flycheck-temporaries'.
+
+Return the path of the file."
+ (let (tempfile)
+ (if filename
+ (let ((directory (flycheck-temp-dir-system)))
+ (setq tempfile (expand-file-name (file-name-nondirectory filename)
+ directory)))
+ (setq tempfile (make-temp-file flycheck-temp-prefix)))
+ (push tempfile flycheck-temporaries)
+ tempfile))
+
+(defun flycheck-temp-file-inplace (filename)
+ "Create an in-place copy of FILENAME.
+
+Prefix the file with `flycheck-temp-prefix' and add the path of
+the file to `flycheck-temporaries'.
+
+If FILENAME is nil, fall back to `flycheck-temp-file-system'.
+
+Return the path of the file."
+ (if filename
+ (let* ((tempname (format "%s_%s"
+ flycheck-temp-prefix
+ (file-name-nondirectory filename)))
+ (tempfile (expand-file-name tempname
+ (file-name-directory filename))))
+ (push tempfile flycheck-temporaries)
+ tempfile)
+ (flycheck-temp-file-system filename)))
+
+(defun flycheck-save-buffer-to-file (file-name)
+ "Save the contents of the current buffer to FILE-NAME."
+ (make-directory (file-name-directory file-name) t)
+ (let ((jka-compr-inhibit t))
+ (write-region nil nil file-name nil 0)))
+
+(defun flycheck-save-buffer-to-temp (temp-file-fn)
+ "Save buffer to temp file returned by TEMP-FILE-FN.
+
+Return the name of the temporary file."
+ (let ((filename (funcall temp-file-fn (buffer-file-name))))
+ ;; Do not flush short-lived temporary files onto disk
+ (let ((write-region-inhibit-fsync t))
+ (flycheck-save-buffer-to-file filename))
+ filename))
+
+(defun flycheck-prepend-with-option (option items &optional prepend-fn)
+ "Prepend OPTION to each item in ITEMS, using PREPEND-FN.
+
+Prepend OPTION to each item in ITEMS.
+
+ITEMS is a list of strings to pass to the syntax checker. OPTION
+is the option, as string. PREPEND-FN is a function called to
+prepend OPTION to each item in ITEMS. It receives the option and
+a single item from ITEMS as argument, and must return a string or
+a list of strings with OPTION prepended to the item. If
+PREPEND-FN is nil or omitted, use `list'.
+
+Return a list of strings where OPTION is prepended to each item
+in ITEMS using PREPEND-FN. If PREPEND-FN returns a list, it is
+spliced into the resulting list."
+ (unless (stringp option)
+ (error "Option %S is not a string" option))
+ (unless prepend-fn
+ (setq prepend-fn #'list))
+ (let ((prepend
+ (lambda (item)
+ (let ((result (funcall prepend-fn option item)))
+ (cond
+ ((and (listp result) (seq-every-p #'stringp result)) result)
+ ((stringp result) (list result))
+ (t (error "Invalid result type for option: %S" result)))))))
+ (apply #'append (seq-map prepend items))))
+
+(defun flycheck-find-in-buffer (pattern)
+ "Find PATTERN in the current buffer.
+
+Return the result of the first matching group of PATTERN, or nil,
+if PATTERN did not match."
+ (save-restriction
+ (widen)
+ (save-excursion
+ (goto-char (point-min))
+ (when (re-search-forward pattern nil 'no-error)
+ (match-string-no-properties 1)))))
+
+(defun flycheck-ephemeral-buffer-p ()
+ "Determine whether the current buffer is an ephemeral buffer.
+
+See Info node `(elisp)Buffer Names' for information about
+ephemeral buffers."
+ (string-prefix-p " " (buffer-name)))
+
+(defun flycheck-encrypted-buffer-p ()
+ "Determine whether the current buffer is an encrypted file.
+
+See Info node `(epa)Top' for Emacs' interface to encrypted
+files."
+ ;; The EPA file handler sets this variable locally to remember the recipients
+ ;; of the encrypted file for re-encryption. Hence, a local binding of this
+ ;; variable is a good indication that the buffer is encrypted. I haven't
+ ;; found any better indicator anyway.
+ (local-variable-p 'epa-file-encrypt-to))
+
+(defun flycheck-autoloads-file-p ()
+ "Determine whether the current buffer is a autoloads file.
+
+Autoloads are generated by package.el during installation."
+ (string-suffix-p "-autoloads.el" (buffer-name)))
+
+(defun flycheck-in-user-emacs-directory-p (filename)
+ "Whether FILENAME is in `user-emacs-directory'."
+ (string-prefix-p (file-name-as-directory (file-truename user-emacs-directory))
+ (file-truename filename)))
+
+(defun flycheck-safe-delete (file-or-dir)
+ "Safely delete FILE-OR-DIR."
+ (ignore-errors
+ (if (file-directory-p file-or-dir)
+ (delete-directory file-or-dir 'recursive)
+ (delete-file file-or-dir))))
+
+(defun flycheck-safe-delete-temporaries ()
+ "Safely delete all temp files and directories of Flycheck.
+
+Safely delete all files and directories listed in
+`flycheck-temporaries' and set the variable's value to nil."
+ (seq-do #'flycheck-safe-delete flycheck-temporaries)
+ (setq flycheck-temporaries nil))
+
+(defun flycheck-rx-file-name (form)
+ "Translate the `(file-name)' FORM into a regular expression."
+ (let ((body (or (cdr form) '((minimal-match
+ (one-or-more not-newline))))))
+ (rx-submatch-n `(group-n 1 ,@body))))
+
+(defun flycheck-rx-message (form)
+ "Translate the `(message)' FORM into a regular expression."
+ (let ((body (or (cdr form) '((one-or-more not-newline)))))
+ (rx-submatch-n `(group-n 4 ,@body))))
+
+(defun flycheck-rx-id (form)
+ "Translate the `(id)' FORM into a regular expression."
+ (rx-submatch-n `(group-n 5 ,@(cdr form))))
+
+(defun flycheck-rx-to-string (form &optional no-group)
+ "Like `rx-to-string' for FORM, but with special keywords:
+
+`line'
+ matches the line number.
+
+`column'
+ matches the column number.
+
+`(file-name SEXP ...)'
+ matches the file name. SEXP describes the file name. If no
+ SEXP is given, use a default body of `(minimal-match
+ (one-or-more not-newline))'.
+
+`(message SEXP ...)'
+ matches the message. SEXP constitutes the body of the
+ message. If no SEXP is given, use a default body
+ of `(one-or-more not-newline)'.
+
+`(id SEXP ...)'
+ matches an error ID. SEXP describes the ID.
+
+NO-GROUP is passed to `rx-to-string'.
+
+See `rx' for a complete list of all built-in `rx' forms."
+ (let ((rx-constituents
+ (append
+ `((line . ,(rx (group-n 2 (one-or-more digit))))
+ (column . ,(rx (group-n 3 (one-or-more digit))))
+ (file-name flycheck-rx-file-name 0 nil)
+ (message flycheck-rx-message 0 nil)
+ (id flycheck-rx-id 0 nil))
+ rx-constituents nil)))
+ (rx-to-string form no-group)))
+
+(defun flycheck-current-load-file ()
+ "Get the source file currently being loaded.
+
+Always return the name of the corresponding source file, never
+any byte-compiled file.
+
+Return nil, if the currently loaded file cannot be determined."
+ (-when-let* ((this-file (cond
+ (load-in-progress load-file-name)
+ ((bound-and-true-p byte-compile-current-file))
+ (t (buffer-file-name))))
+ ;; A best guess for the source file of a compiled library. Works
+ ;; well in most cases, and especially for ELPA packages
+ (source-file (concat (file-name-sans-extension this-file)
+ ".el")))
+ (when (file-exists-p source-file)
+ source-file)))
+
+(defun flycheck-module-root-directory (module &optional file-name)
+ "Get the root directory for a MODULE in FILE-NAME.
+
+MODULE is a qualified module name, either a string with
+components separated by a dot, or as list of components.
+FILE-NAME is the name of the file or directory containing the
+module as string. When nil or omitted, defaults to the return
+value of function `buffer-file-name'.
+
+Return the root directory of the module, that is, the directory,
+from which FILE-NAME can be reached by descending directories
+along each part of MODULE.
+
+If the MODULE name does not match the directory hierarchy upwards
+from FILE-NAME, return the directory containing FILE-NAME. When
+FILE-NAME is nil, return `default-directory'."
+ (let ((file-name (or file-name (buffer-file-name)))
+ (module-components (if (stringp module)
+ (split-string module (rx "."))
+ (copy-sequence module))))
+ (if (and module-components file-name)
+ (let ((parts (nreverse module-components))
+ (base-directory (directory-file-name
+ (file-name-sans-extension file-name))))
+ (while (and parts
+ (string= (file-name-nondirectory base-directory)
+ (car parts)))
+ (pop parts)
+ (setq base-directory (directory-file-name
+ (file-name-directory base-directory))))
+ (file-name-as-directory base-directory))
+ (if file-name
+ (file-name-directory file-name)
+ (expand-file-name default-directory)))))
+
+\f
+;;; Minibuffer tools
+(defvar read-flycheck-checker-history nil
+ "`completing-read' history of `read-flycheck-checker'.")
+
+(defun flycheck-completing-read (prompt candidates default &optional history)
+ "Read a value from the minibuffer.
+
+Use `flycheck-completing-read-function' to read input from the
+minibuffer with completion.
+
+Show PROMPT and read one of CANDIDATES, defaulting to DEFAULT.
+HISTORY is passed to `flycheck-completing-read-function'."
+ (funcall flycheck-completing-read-function
+ prompt candidates nil 'require-match nil history default))
+
+(defun read-flycheck-checker (prompt &optional default property candidates)
+ "Read a flycheck checker from minibuffer with PROMPT and DEFAULT.
+
+PROMPT is a string to show in the minibuffer as prompt. It
+should end with a single space. DEFAULT is a symbol denoting the
+default checker to use, if the user did not select any checker.
+PROPERTY is a symbol denoting a syntax checker property. If
+non-nil, only complete syntax checkers which have a non-nil value
+for PROPERTY. CANDIDATES is an optional list of all syntax
+checkers available for completion, defaulting to all defined
+checkers. If given, PROPERTY is ignored.
+
+Return the checker as symbol, or DEFAULT if no checker was
+chosen. If DEFAULT is nil and no checker was chosen, signal a
+`user-error' if the underlying completion system does not provide
+a default on its own."
+ (when (and default (not (flycheck-valid-checker-p default)))
+ (error "%S is no valid Flycheck checker" default))
+ (let* ((candidates (seq-map #'symbol-name
+ (or candidates
+ (flycheck-defined-checkers property))))
+ (default (and default (symbol-name default)))
+ (input (flycheck-completing-read
+ prompt candidates default
+ 'read-flycheck-checker-history)))
+ (when (string-empty-p input)
+ (unless default
+ (user-error "No syntax checker selected"))
+ (setq input default))
+ (let ((checker (intern input)))
+ (unless (flycheck-valid-checker-p checker)
+ (error "%S is not a valid Flycheck syntax checker" checker))
+ checker)))
+
+(defun read-flycheck-error-level (prompt)
+ "Read an error level from the user with PROMPT.
+
+Only offers level for which errors currently exist, in addition
+to the default levels."
+ (let* ((levels (seq-map #'flycheck-error-level
+ (flycheck-error-list-current-errors)))
+ (levels-with-defaults (append '(info warning error) levels))
+ (uniq-levels (seq-uniq levels-with-defaults))
+ (level (flycheck-completing-read prompt uniq-levels nil)))
+ (and (stringp level) (intern level))))
+
+\f
+;;; Checker API
+(defun flycheck-defined-checkers (&optional property)
+ "Find all defined syntax checkers, optionally with PROPERTY.
+
+PROPERTY is a symbol. If given, only return syntax checkers with
+a non-nil value for PROPERTY.
+
+The returned list is sorted alphapetically by the symbol name of
+the syntax checkers."
+ (let (defined-checkers)
+ (mapatoms (lambda (symbol)
+ (when (and (flycheck-valid-checker-p symbol)
+ (or (null property)
+ (flycheck-checker-get symbol property)))
+ (push symbol defined-checkers))))
+ (sort defined-checkers #'string<)))
+
+(defun flycheck-registered-checker-p (checker)
+ "Determine whether CHECKER is registered.
+
+A checker is registered if it is contained in
+`flycheck-checkers'."
+ (and (flycheck-valid-checker-p checker)
+ (memq checker flycheck-checkers)))
+
+(defun flycheck-disabled-checker-p (checker)
+ "Determine whether CHECKER is disabled.
+
+A checker is disabled if it is contained in
+`flycheck-disabled-checkers'."
+ (memq checker flycheck-disabled-checkers))
+
+(defun flycheck-possibly-suitable-checkers ()
+ "Find possibly suitable checkers for the current buffer.
+
+Return a list of all syntax checkers which could possibly be
+suitable for the current buffer, if any problems in their setup
+were fixed.
+
+Currently this function collects all registered syntax checkers
+whose `:modes' contain the current major mode or which do not
+have any `:modes', but a `:predicate' that returns non-nil for
+the current buffer."
+ (let (checkers)
+ (dolist (checker flycheck-checkers)
+ (let ((modes (flycheck-checker-get checker 'modes))
+ (predicate (flycheck-checker-get checker 'predicate)))
+ (when (or (memq major-mode modes)
+ (and (not modes)
+ (functionp predicate)
+ (funcall predicate)))
+ (push checker checkers))))
+ (nreverse checkers)))
+
+\f
+;;; Generic syntax checkers
+(defconst flycheck-generic-checker-version 2
+ "The internal version of generic syntax checker declarations.
+
+Flycheck will not use syntax checkers whose generic version is
+less than this constant.")
+
+(defsubst flycheck--checker-property-name (property)
+ "Return the SYMBOL property for checker PROPERTY."
+ (intern (concat "flycheck-" (symbol-name property))))
+
+(defun flycheck-checker-get (checker property)
+ "Get the value of CHECKER's PROPERTY."
+ (get checker (flycheck--checker-property-name property)))
+
+(gv-define-setter flycheck-checker-get (value checker property)
+ `(setf (get ,checker (flycheck--checker-property-name ,property)) ,value))
+
+(defun flycheck-validate-next-checker (next &optional strict)
+ "Validate NEXT checker.
+
+With STRICT non-nil, also check whether the syntax checker and
+the error level in NEXT are valid. Otherwise just check whether
+these are symbols.
+
+Signal an error if NEXT is not a valid entry for
+`:next-checkers'."
+ (when (symbolp next)
+ (setq next (cons t next)))
+ (pcase next
+ (`(,level . ,checker)
+ (if strict
+ (progn
+ (unless (or (eq level t) (flycheck-error-level-p level))
+ (error "%S is not a valid Flycheck error level" level))
+ (unless (flycheck-valid-checker-p checker)
+ (error "%s is not a valid Flycheck syntax checker" checker)))
+ (unless (symbolp level)
+ (error "Error level %S must be a symbol" level))
+ (unless (symbolp checker)
+ (error "Checker %S must be a symbol" checker))))
+ (_ (error "%S must be a symbol or cons cell" next)))
+ t)
+
+(defun flycheck-define-generic-checker (symbol docstring &rest properties)
+ "Define SYMBOL as generic syntax checker.
+
+Any syntax checker defined with this macro is eligible for manual
+syntax checker selection with `flycheck-select-checker'. To make
+the new syntax checker available for automatic selection, it must
+be registered in `flycheck-checkers'.
+
+DOCSTRING is the documentation of the syntax checker, for
+`flycheck-describe-checker'. The following PROPERTIES constitute
+a generic syntax checker. Unless otherwise noted, all properties
+are mandatory.
+
+`:start FUNCTION'
+ A function to start the syntax checker.
+
+ FUNCTION shall take two arguments and return a context
+ object if the checker is started successfully. Otherwise it
+ shall signal an error.
+
+ The first argument is the syntax checker being started. The
+ second is a callback function to report state changes to
+ Flycheck. The callback takes two arguments STATUS DATA,
+ where STATUS is a symbol denoting the syntax checker status
+ and DATA an optional argument with additional data for the
+ status report. See `flycheck-report-buffer-checker-status'
+ for more information about STATUS and DATA.
+
+ FUNCTION may be synchronous or asynchronous, i.e. it may
+ call the given callback either immediately, or at some later
+ point (e.g. from a process sentinel).
+
+ A syntax checker _must_ call CALLBACK at least once with a
+ STATUS that finishes the current syntax checker. Otherwise
+ Flycheck gets stuck at the current syntax check with this
+ syntax checker.
+
+ The context object returned by FUNCTION is passed to
+ `:interrupt'.
+
+`:interrupt FUNCTION'
+ A function to interrupt the syntax check.
+
+ FUNCTION is called with the syntax checker and the context
+ object returned by the `:start' function and shall try to
+ interrupt the syntax check. The context may be nil, if the
+ syntax check is interrupted before actually started.
+ FUNCTION should handle this situation.
+
+ If it cannot interrupt the syntax check, it may either
+ signal an error or silently ignore the attempt to interrupt
+ the syntax checker, depending on the severity of the
+ situation.
+
+ If interrupting the syntax check failed, Flycheck will let
+ the syntax check continue, but ignore any status reports.
+ Notably, it won't highlight any errors reported by the
+ syntax check in the buffer.
+
+ This property is optional. If omitted, Flycheck won't
+ attempt to interrupt syntax checks wit this syntax checker,
+ and simply ignore their results.
+
+`:print-doc FUNCTION'
+ A function to print additional documentation into the Help
+ buffer of this checker.
+
+ FUNCTION is called when creating the Help buffer for the
+ syntax checker, with the syntax checker as single argument,
+ after printing the name of the syntax checker and its modes
+ and predicate, but before printing DOCSTRING. It may insert
+ additional documentation into the current buffer.
+
+ The call occurs within `with-help-window'. Hence
+ `standard-output' points to the current buffer, so you may
+ use `princ' and friends to add content. Also, the current
+ buffer is put into Help mode afterwards, which automatically
+ turns symbols into references, if possible.
+
+ This property is optional. If omitted, no additional
+ documentation is printed for this syntax checker.
+
+:verify FUNCTION
+ A function to verify the checker for the current buffer.
+
+ FUNCTION is called with the syntax checker as single
+ argument, and shall return a list of
+ `flycheck-verification-result' objects indicating whether
+ the syntax checker could be used in the current buffer, and
+ highlighting potential setup problems.
+
+ This property is optional. If omitted, no additional
+ verification occurs for this syntax checker. It is however
+ absolutely recommended that you add a `:verify' function to
+ your syntax checker, because it will help users to spot
+ potential setup problems.
+
+`:modes MODES'
+ A major mode symbol or a list thereof, denoting major modes
+ to use this syntax checker in.
+
+ If given this syntax checker is only used in buffers whose
+ `major-mode' is `eq' to any mode in MODES.
+
+ If `:predicate' is also given, the syntax checker will only
+ be used in buffers for which the `:predicate' returns
+ non-nil.
+
+ This property is optional, however at least one of `:modes'
+ or `:predicate' must be given.
+
+`:predicate FUNCTION'
+ A function to determine whether to use the syntax checker in
+ the current buffer.
+
+ FUNCTION is called without arguments and shall return
+ non-nil if this syntax checker shall be used to check the
+ current buffer. Otherwise it shall return nil.
+
+ If `:modes' is also given, FUNCTION is only called in
+ matching major modes.
+
+ This property is optional, however at least one of `:modes'
+ or `:predicate' must be given.
+
+`:error-filter FUNCTION'
+ A function to filter the errors returned by this checker.
+
+ FUNCTION is called with the list of `flycheck-error' objects
+ returned by the syntax checker and shall return another list
+ of `flycheck-error' objects, which is considered the final
+ result of this syntax checker.
+
+ FUNCTION is free to add, remove or modify errors, whether in
+ place or by copying.
+
+ This property is optional. The default filter is
+ `identity'.
+
+`:next-checkers NEXT-CHECKERS'
+ A list denoting syntax checkers to apply after this syntax
+ checker, in what we call \"chaining\" of syntax checkers.
+
+ Each ITEM is a cons cell `(LEVEL . CHECKER)'. CHECKER is a
+ syntax checker to run after this syntax checker. LEVEL is
+ an error level. CHECKER will only be used if there are no
+ current errors of at least LEVEL. LEVEL may also be t, in
+ which case CHECKER is used regardless of the current errors.
+
+ ITEM may also be a syntax checker symbol, which is
+ equivalent to `(t . ITEM)'.
+
+ Flycheck tries all items in order of declaration, and uses
+ the first whose LEVEL matches and whose CHECKER is
+ registered and can be used for the current buffer.
+
+ This feature is typically used to apply more than one syntax
+ checker to a buffer. For instance, you might first use a
+ compiler to check a buffer for syntax and type errors, and
+ then run a linting tool that checks for insecure code, or
+ questionable style.
+
+ This property is optional. If omitted, it defaults to the
+ nil, i.e. no other syntax checkers are applied after this
+ syntax checker.
+
+Signal an error, if any property has an invalid value."
+ (declare (indent 1)
+ (doc-string 2))
+ (let ((start (plist-get properties :start))
+ (interrupt (plist-get properties :interrupt))
+ (print-doc (plist-get properties :print-doc))
+ (modes (plist-get properties :modes))
+ (predicate (plist-get properties :predicate))
+ (verify (plist-get properties :verify))
+ (filter (or (plist-get properties :error-filter) #'identity))
+ (next-checkers (plist-get properties :next-checkers))
+ (file (flycheck-current-load-file)))
+
+ (unless (listp modes)
+ (setq modes (list modes)))
+
+ (unless (functionp start)
+ (error ":start %S of syntax checker %s is not a function" symbol start))
+ (unless (or (null interrupt) (functionp interrupt))
+ (error ":interrupt %S of syntax checker %s is not a function"
+ symbol interrupt))
+ (unless (or (null print-doc) (functionp print-doc))
+ (error ":print-doc %S of syntax checker %s is not a function"
+ symbol print-doc))
+ (unless (or (null verify) (functionp verify))
+ (error ":verify %S of syntax checker %S is not a function"
+ symbol verify))
+ (unless (or modes predicate)
+ (error "Missing :modes or :predicate in syntax checker %s" symbol))
+ (dolist (mode modes)
+ (unless (symbolp mode)
+ (error "Invalid :modes %s in syntax checker %s, %s must be a symbol"
+ modes symbol mode)))
+ (unless (or (null predicate) (functionp predicate))
+ (error ":predicate %S of syntax checker %s is not a function"
+ symbol predicate))
+ (unless (functionp filter)
+ (error ":error-filter %S of syntax checker %s is not a function"
+ symbol filter))
+ (dolist (checker next-checkers)
+ (flycheck-validate-next-checker checker))
+
+ (let ((real-predicate (lambda ()
+ (if (flycheck-valid-checker-p symbol)
+ (or (null predicate) (funcall predicate))
+ (lwarn 'flycheck :warning "%S is no valid Flycheck syntax checker.
+Try to reinstall the package defining this syntax checker." symbol)
+ nil))))
+ (pcase-dolist (`(,prop . ,value)
+ `((start . ,start)
+ (interrupt . ,interrupt)
+ (print-doc . ,print-doc)
+ (modes . ,modes)
+ (predicate . ,real-predicate)
+ (verify . ,verify)
+ (error-filter . ,filter)
+ (next-checkers . ,next-checkers)
+ (documentation . ,docstring)
+ (file . ,file)))
+ (setf (flycheck-checker-get symbol prop) value)))
+
+ ;; Track the version, to avoid breakage if the internal format changes
+ (setf (flycheck-checker-get symbol 'generic-checker-version)
+ flycheck-generic-checker-version)))
+
+(defun flycheck-valid-checker-p (checker)
+ "Check whether a CHECKER is valid.
+
+A valid checker is a symbol defined as syntax checker with
+`flycheck-define-checker'."
+ (and (symbolp checker)
+ (= (or (get checker 'flycheck-generic-checker-version) 0)
+ flycheck-generic-checker-version)))
+
+(defun flycheck-may-use-checker (checker)
+ "Whether a generic CHECKER may be used.
+
+Return non-nil if CHECKER may be used for the current buffer, and
+nil otherwise."
+ (let ((modes (flycheck-checker-get checker 'modes))
+ (predicate (flycheck-checker-get checker 'predicate)))
+ (and (flycheck-valid-checker-p checker)
+ (not (flycheck-disabled-checker-p checker))
+ (or (not modes) (memq major-mode modes))
+ (funcall predicate))))
+
+(defun flycheck-may-use-next-checker (next-checker)
+ "Determine whether NEXT-CHECKER may be used."
+ (when (symbolp next-checker)
+ (push t next-checker))
+ (let ((level (car next-checker))
+ (next-checker (cdr next-checker)))
+ (and (or (eq level t)
+ (flycheck-has-max-current-errors-p level))
+ (flycheck-registered-checker-p next-checker)
+ (flycheck-may-use-checker next-checker))))
+
+\f
+;;; Help for generic syntax checkers
+(define-button-type 'help-flycheck-checker-def
+ :supertype 'help-xref
+ 'help-function #'flycheck-goto-checker-definition
+ 'help-echo "mouse-2, RET: find Flycheck checker definition")
+
+(defconst flycheck-find-checker-regexp
+ (rx line-start (zero-or-more (syntax whitespace))
+ "(" symbol-start "flycheck-define-checker" symbol-end
+ (eval (list 'regexp find-function-space-re))
+ symbol-start
+ "%s"
+ symbol-end
+ (or (syntax whitespace) line-end))
+ "Regular expression to find a checker definition.")
+
+(add-to-list 'find-function-regexp-alist
+ '(flycheck-checker . flycheck-find-checker-regexp))
+
+(defun flycheck-goto-checker-definition (checker file)
+ "Go to to the definition of CHECKER in FILE."
+ (let ((location (find-function-search-for-symbol
+ checker 'flycheck-checker file)))
+ (pop-to-buffer (car location))
+ (if (cdr location)
+ (goto-char (cdr location))
+ (message "Unable to find checker location in file"))))
+
+(defun flycheck-checker-at-point ()
+ "Return the Flycheck checker found at or before point.
+
+Return nil if there is no checker."
+ (let ((symbol (variable-at-point 'any-symbol)))
+ (when (flycheck-valid-checker-p symbol)
+ symbol)))
+
+(defun flycheck-describe-checker (checker)
+ "Display the documentation of CHECKER.
+
+CHECKER is a checker symbol.
+
+Pop up a help buffer with the documentation of CHECKER."
+ (interactive
+ (let* ((enable-recursive-minibuffers t)
+ (default (or (flycheck-checker-at-point)
+ (ignore-errors (flycheck-get-checker-for-buffer))))
+ (prompt (if default
+ (format "Describe syntax checker (default %s): " default)
+ "Describe syntax checker: ")))
+ (list (read-flycheck-checker prompt default))))
+ (unless (flycheck-valid-checker-p checker)
+ (user-error "You didn't specify a Flycheck syntax checker"))
+ (help-setup-xref (list #'flycheck-describe-checker checker)
+ (called-interactively-p 'interactive))
+ (save-excursion
+ (with-help-window (help-buffer)
+ (let ((filename (flycheck-checker-get checker 'file))
+ (modes (flycheck-checker-get checker 'modes))
+ (predicate (flycheck-checker-get checker 'predicate))
+ (print-doc (flycheck-checker-get checker 'print-doc))
+ (next-checkers (flycheck-checker-get checker 'next-checkers)))
+ (princ (format "%s is a Flycheck syntax checker" checker))
+ (when filename
+ (princ (format " in `%s'" (file-name-nondirectory filename)))
+ (with-current-buffer standard-output
+ (save-excursion
+ (re-search-backward "`\\([^`']+\\)'" nil t)
+ (help-xref-button 1 'help-flycheck-checker-def checker filename))))
+ (princ ".\n\n")
+
+ (let ((modes-start (with-current-buffer standard-output (point-max))))
+ ;; Track the start of the modes documentation, to properly re-fill
+ ;; it later
+ (if (not modes)
+ ;; Syntax checkers without modes must have a predicate
+ (princ " This syntax checker checks syntax if a custom predicate holds")
+ (princ " This syntax checker checks syntax in the major mode(s) ")
+ (princ (string-join
+ (seq-map (apply-partially #'format "`%s'") modes)
+ ", "))
+ (when predicate
+ (princ ", and uses a custom predicate")))
+ (princ ".")
+ (when next-checkers
+ (princ " It runs the following checkers afterwards:"))
+ (with-current-buffer standard-output
+ (save-excursion
+ (fill-region-as-paragraph modes-start (point-max))))
+ (princ "\n")
+
+ ;; Print the list of next checkers
+ (when next-checkers
+ (princ "\n")
+ (let ((beg-checker-list (with-current-buffer standard-output
+ (point))))
+ (dolist (next-checker next-checkers)
+ (if (symbolp next-checker)
+ (princ (format " * `%s'\n" next-checker))
+ (princ (format " * `%s' (maximum level `%s')\n"
+ (cdr next-checker) (car next-checker)))))
+ ;;
+ (with-current-buffer standard-output
+ (save-excursion
+ (while (re-search-backward "`\\([^`']+\\)'"
+ beg-checker-list t)
+ (when (flycheck-valid-checker-p
+ (intern-soft (match-string 1)))
+ (help-xref-button 1 'help-flycheck-checker-def checker
+ filename))))))))
+ ;; Call the custom print-doc function of the checker, if present
+ (when print-doc
+ (funcall print-doc checker))
+ ;; Ultimately, print the docstring
+ (princ "\nDocumentation:\n")
+ (princ (flycheck-checker-get checker 'documentation))))))
+
+\f
+;;; Syntax checker verification
+(cl-defstruct (flycheck-verification-result
+ (:constructor flycheck-verification-result-new))
+ "Structure for storing a single verification result.
+
+Slots:
+
+`label'
+ A label for this result, as string
+
+`message'
+ A message for this result, as string
+
+`face'
+ The face to use for the `message'.
+
+ You can either use a face symbol, or a list of face symbols."
+ label message face)
+
+(defun flycheck-verify-generic-checker (checker)
+ "Verify a generic CHECKER in the current buffer.
+
+Return a list of `flycheck-verification-result' objects."
+ (let (results
+ (predicate (flycheck-checker-get checker 'predicate))
+ (verify (flycheck-checker-get checker 'verify)))
+ (when predicate
+ (let ((result (funcall predicate)))
+ (push (flycheck-verification-result-new
+ :label "predicate"
+ :message (prin1-to-string (not (null result)))
+ :face (if result 'success '(bold warning)))
+ results)))
+ (append (nreverse results)
+ (and verify (funcall verify checker)))))
+
+(define-button-type 'help-flycheck-checker-doc
+ :supertype 'help-xref
+ 'help-function #'flycheck-describe-checker
+ 'help-echo "mouse-2, RET: describe Flycheck checker")
+
+(defun flycheck--verify-princ-checker (checker buffer &optional with-mm)
+ "Print verification result of CHECKER for BUFFER.
+
+When WITH-MM is given and non-nil, also include the major mode
+into the verification results."
+ (princ " ")
+ (insert-button (symbol-name checker)
+ 'type 'help-flycheck-checker-doc
+ 'help-args (list checker))
+ (when (with-current-buffer buffer (flycheck-disabled-checker-p checker))
+ (insert (propertize " (disabled)" 'face '(bold error))))
+ (princ "\n")
+ (let ((results (with-current-buffer buffer
+ (flycheck-verify-generic-checker checker))))
+ (when with-mm
+ (with-current-buffer buffer
+ (let* ((modes (flycheck-checker-get checker 'modes))
+ (mm-supported (memq major-mode modes))
+ (message-and-face
+ (cond
+ ((not modes) '("No restriction" . success))
+ (mm-supported (cons (format "`%s' supported" major-mode)
+ 'success))
+ (t (cons (format "`%s' not supported" major-mode) 'error)))))
+ (push (flycheck-verification-result-new
+ :label "major mode"
+ :message (car message-and-face)
+ :face (cdr message-and-face))
+ results))))
+ (let* ((label-length
+ (seq-max (mapcar
+ (lambda (res)
+ (length (flycheck-verification-result-label res)))
+ results)))
+ (message-column (+ 8 label-length)))
+ (dolist (result results)
+ (princ " - ")
+ (princ (flycheck-verification-result-label result))
+ (princ ": ")
+ (princ (make-string (- message-column (current-column)) ?\ ))
+ (let ((message (flycheck-verification-result-message result))
+ (face (flycheck-verification-result-face result)))
+ (insert (propertize message 'face face)))
+ (princ "\n"))))
+ (princ "\n"))
+
+(defun flycheck--verify-print-header (desc buffer)
+ "Print a title with DESC for BUFFER in the current buffer.
+
+DESC is an arbitrary string containing a description, and BUFFER
+is the buffer being verified. The name and the major mode mode
+of BUFFER are printed.
+
+DESC and information about BUFFER are printed in the current
+buffer."
+ (princ desc)
+ (insert (propertize (buffer-name buffer) 'face 'bold))
+ (princ " in ")
+ (let ((mode (buffer-local-value 'major-mode buffer)))
+ (insert-button (symbol-name mode)
+ 'type 'help-function
+ 'help-args (list mode)))
+ (princ ":\n\n"))
+
+(defun flycheck--verify-print-footer (buffer)
+ "Print a footer for BUFFER in the current buffer.
+
+BUFFER is the buffer being verified."
+ (princ "Flycheck Mode is ")
+ (let ((enabled (buffer-local-value 'flycheck-mode buffer)))
+ (insert (propertize (if enabled "enabled" "disabled")
+ 'face (if enabled 'success '(warning bold)))))
+ (princ
+ (with-current-buffer buffer
+ ;; Use key binding state in the verified buffer to print the help.
+ (substitute-command-keys
+ ". Use \\[universal-argument] \\[flycheck-disable-checker] to enable disabled checkers.")))
+ (save-excursion
+ (let ((end (point)))
+ (backward-paragraph)
+ (fill-region-as-paragraph (point) end))))
+
+(defun flycheck-verify-checker (checker)
+ "Check whether a CHECKER can be used in this buffer.
+
+Show a buffer listing possible problems that prevent CHECKER from
+being used for the current buffer.
+
+Note: Do not use this function to check whether a syntax checker
+is applicable from Emacs Lisp code. Use
+`flycheck-may-use-checker' instead."
+ (interactive (list (read-flycheck-checker "Checker to verify: ")))
+ (unless (flycheck-valid-checker-p checker)
+ (user-error "%s is not a syntax checker" checker))
+
+ ;; Save the buffer to make sure that all predicates are good
+ (when (and (buffer-file-name) (buffer-modified-p))
+ (save-buffer))
+
+ (let ((buffer (current-buffer)))
+ (with-help-window (get-buffer-create " *Flycheck checker*")
+ (with-current-buffer standard-output
+ (flycheck--verify-print-header "Syntax checker in buffer " buffer)
+ (flycheck--verify-princ-checker checker buffer 'with-mm)
+ (if (with-current-buffer buffer (flycheck-may-use-checker checker))
+ (insert (propertize "Flycheck can use this syntax checker for this buffer.\n"
+ 'face 'success))
+ (insert (propertize "Flycheck cannot use this syntax checker for this buffer.\n"
+ 'face 'error)))
+ (insert "\n")
+ (flycheck--verify-print-footer buffer)))))
+
+(defun flycheck-verify-setup ()
+ "Check whether Flycheck can be used in this buffer.
+
+Display a new buffer listing all syntax checkers that could be
+applicable in the current buffer. For each syntax checkers,
+possible problems are shown."
+ (interactive)
+ (when (and (buffer-file-name) (buffer-modified-p))
+ ;; Save the buffer
+ (save-buffer))
+
+ (let ((buffer (current-buffer))
+ (checkers (flycheck-possibly-suitable-checkers)))
+
+ ;; Now print all applicable checkers
+ (with-help-window (get-buffer-create " *Flycheck checkers*")
+ (with-current-buffer standard-output
+ (flycheck--verify-print-header "Syntax checkers for buffer " buffer)
+ (unless checkers
+ (insert (propertize "There are no syntax checkers for this buffer!\n\n"
+ 'face '(bold error))))
+ (dolist (checker checkers)
+ (flycheck--verify-princ-checker checker buffer))
+
+ (-when-let (selected-checker (buffer-local-value 'flycheck-checker buffer))
+ (insert (propertize "The following checker is explicitly selected for this buffer:\n\n"
+ 'face 'bold))
+ (flycheck--verify-princ-checker selected-checker buffer 'with-mm))
+
+ (let ((unregistered-checkers (seq-difference (flycheck-defined-checkers)
+ flycheck-checkers)))
+ (when unregistered-checkers
+ (insert (propertize "\nThe following syntax checkers are not registered:\n\n"
+ 'face '(bold warning)))
+ (dolist (checker unregistered-checkers)
+ (princ " - ")
+ (princ checker)
+ (princ "\n"))
+ (princ "\nTry adding these syntax checkers to `flycheck-checkers'.\n")))
+
+ (flycheck--verify-print-footer buffer)))))
+
+\f
+;;; Predicates for generic syntax checkers
+(defun flycheck-buffer-saved-p (&optional buffer)
+ "Determine whether BUFFER is saved to a file.
+
+BUFFER is the buffer to check. If omitted or nil, use the
+current buffer as BUFFER.
+
+Return non-nil if the BUFFER is backed by a file, and not
+modified, or nil otherwise."
+ (and (buffer-file-name buffer) (not (buffer-modified-p buffer))))
+
+\f
+;;; Extending generic checkers
+(defun flycheck-add-next-checker (checker next &optional append)
+ "After CHECKER add a NEXT checker.
+
+CHECKER is a syntax checker symbol, to which to add NEXT checker.
+
+NEXT is a cons cell `(LEVEL . NEXT-CHECKER)'. NEXT-CHECKER is a
+symbol denoting the syntax checker to run after CHECKER. LEVEL
+is an error level. NEXT-CHECKER will only be used if there is no
+current error whose level is more severe than LEVEL. LEVEL may
+also be t, in which case NEXT-CHECKER is used regardless of the
+current errors.
+
+NEXT can also be a syntax checker symbol only, which is
+equivalent to `(t . NEXT)'.
+
+NEXT-CHECKER is prepended before other next checkers, unless
+APPEND is non-nil."
+ (unless (flycheck-valid-checker-p checker)
+ (error "%s is not a valid syntax checker" checker))
+ (flycheck-validate-next-checker next 'strict)
+ (if append
+ (setf (flycheck-checker-get checker 'next-checkers)
+ (append (flycheck-checker-get checker 'next-checkers) (list next)))
+ (push next (flycheck-checker-get checker 'next-checkers))))
+
+(defun flycheck-add-mode (checker mode)
+ "To CHECKER add a new major MODE.
+
+CHECKER and MODE are symbols denoting a syntax checker and a
+major mode respectively.
+
+Add MODE to the `:modes' property of CHECKER, so that CHECKER
+will be used in buffers with MODE."
+ (unless (flycheck-valid-checker-p checker)
+ (error "%s is not a valid syntax checker" checker))
+ (unless (symbolp mode)
+ (error "%s is not a symbol" mode))
+ (push mode (flycheck-checker-get checker 'modes)))
+
+\f
+;;; Generic syntax checks
+(cl-defstruct (flycheck-syntax-check
+ (:constructor flycheck-syntax-check-new))
+ "Structure for storing syntax check state.
+
+Slots:
+
+`buffer'
+ The buffer being checked
+
+`checker'
+ The syntax checker being used
+
+`context'
+ The context object."
+ buffer checker context)
+
+(defun flycheck-syntax-check-start (syntax-check callback)
+ "Start a SYNTAX-CHECK with CALLBACK."
+ (let ((checker (flycheck-syntax-check-checker syntax-check)))
+ (setf (flycheck-syntax-check-context syntax-check)
+ (funcall (flycheck-checker-get checker 'start) checker callback))))
+
+(defun flycheck-syntax-check-interrupt (syntax-check)
+ "Interrupt a SYNTAX-CHECK."
+ (let* ((checker (flycheck-syntax-check-checker syntax-check))
+ (interrupt-fn (flycheck-checker-get checker 'interrupt))
+ (context (flycheck-syntax-check-context syntax-check)))
+ (when interrupt-fn
+ (funcall interrupt-fn checker context))))
+
+\f
+;;; Syntax checking mode
+
+(defvar flycheck-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map flycheck-keymap-prefix flycheck-command-map)
+ ;; We place the menu under a custom menu key. Since this menu key is not
+ ;; present in the menu of the global map, no top-level menu entry is added
+ ;; to the global menu bar. However, it still appears on the mode line
+ ;; lighter.
+ (define-key map [menu-bar flycheck] flycheck-mode-menu-map)
+ map)
+ "Keymap of `flycheck-mode'.")
+
+(defvar-local flycheck-old-next-error-function nil
+ "Remember the old `next-error-function'.")
+
+(defconst flycheck-hooks-alist
+ '(
+ ;; Handle events that may start automatic syntax checks
+ (after-save-hook . flycheck-handle-save)
+ (after-change-functions . flycheck-handle-change)
+ ;; Handle events that may triggered pending deferred checks
+ (window-configuration-change-hook . flycheck-perform-deferred-syntax-check)
+ (post-command-hook . flycheck-perform-deferred-syntax-check)
+ ;; Teardown Flycheck whenever the buffer state is about to get lost, to
+ ;; clean up temporary files and directories.
+ (kill-buffer-hook . flycheck-teardown)
+ (change-major-mode-hook . flycheck-teardown)
+ (before-revert-hook . flycheck-teardown)
+ ;; Update the error list if necessary
+ (post-command-hook . flycheck-error-list-update-source)
+ (post-command-hook . flycheck-error-list-highlight-errors)
+ ;; Display errors. Show errors at point after commands (like movements) and
+ ;; when Emacs gets focus. Cancel the display timer when Emacs looses focus
+ ;; (as there's no need to display errors if the user can't see them), and
+ ;; hide the error buffer (for large error messages) if necessary. Note that
+ ;; the focus hooks only work on Emacs 24.4 and upwards, but since undefined
+ ;; hooks are perfectly ok we don't need a version guard here. They'll just
+ ;; not work silently.
+ (post-command-hook . flycheck-display-error-at-point-soon)
+ (focus-in-hook . flycheck-display-error-at-point-soon)
+ (focus-out-hook . flycheck-cancel-error-display-error-at-point-timer)
+ (post-command-hook . flycheck-hide-error-buffer)
+ ;; Immediately show error popups when navigating to an error
+ (next-error-hook . flycheck-display-error-at-point))
+ "Hooks which Flycheck needs to hook in.
+
+The `car' of each pair is a hook variable, the `cdr' a function
+to be added or removed from the hook variable if Flycheck mode is
+enabled and disabled respectively.")
+
+;;;###autoload
+(define-minor-mode flycheck-mode
+ "Minor mode for on-the-fly syntax checking.
+
+When called interactively, toggle `flycheck-mode'. With prefix
+ARG, enable `flycheck-mode' if ARG is positive, otherwise disable
+it.
+
+When called from Lisp, enable `flycheck-mode' if ARG is omitted,
+nil or positive. If ARG is `toggle', toggle `flycheck-mode'.
+Otherwise behave as if called interactively.
+
+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.
+
+\\{flycheck-mode-map}"
+ :init-value nil
+ :keymap flycheck-mode-map
+ :lighter flycheck-mode-line
+ :after-hook (flycheck-buffer-automatically 'mode-enabled 'force-deferred)
+ (cond
+ (flycheck-mode
+ (flycheck-clear)
+
+ (pcase-dolist (`(,hook . ,fn) flycheck-hooks-alist)
+ (add-hook hook fn nil 'local))
+
+ (setq flycheck-old-next-error-function (if flycheck-standard-error-navigation
+ next-error-function
+ :unset))
+ (when flycheck-standard-error-navigation
+ (setq next-error-function #'flycheck-next-error-function)))
+ (t
+ (unless (eq flycheck-old-next-error-function :unset)
+ (setq next-error-function flycheck-old-next-error-function))
+
+ (pcase-dolist (`(,hook . ,fn) flycheck-hooks-alist)
+ (remove-hook hook fn 'local))
+
+ (flycheck-teardown))))
+
+\f
+;;; Syntax checker selection for the current buffer
+(defvar-local flycheck-last-checker nil
+ "The last checker used for the current buffer.")
+
+(defun flycheck-get-checker-for-buffer ()
+ "Find the checker for the current buffer.
+
+Use the selected checker for the current buffer, if any,
+otherwise search for the best checker from `flycheck-checkers'.
+
+Return checker if there is a checker for the current buffer, or
+nil otherwise."
+ (if flycheck-checker
+ (if (flycheck-may-use-checker flycheck-checker)
+ flycheck-checker
+ (error "Flycheck cannot use %s in this buffer, type M-x flycheck-verify-setup for more details"
+ flycheck-checker))
+ (seq-find #'flycheck-may-use-checker flycheck-checkers)))
+
+(defun flycheck-get-next-checker-for-buffer (checker)
+ "Get the checker to run after CHECKER for the current buffer."
+ (let ((next (seq-find #'flycheck-may-use-next-checker
+ (flycheck-checker-get checker 'next-checkers))))
+ (when next
+ (if (symbolp next) next (cdr next)))))
+
+(defun flycheck-select-checker (checker)
+ "Select CHECKER for the current buffer.
+
+CHECKER is a syntax checker symbol (see `flycheck-checkers') or
+nil. In the former case, use CHECKER for the current buffer,
+otherwise deselect the current syntax checker (if any) and use
+automatic checker selection via `flycheck-checkers'.
+
+If called interactively prompt for CHECKER. With prefix arg
+deselect the current syntax checker and enable automatic
+selection again.
+
+Set `flycheck-checker' to CHECKER and automatically start a new
+syntax check if the syntax checker changed.
+
+CHECKER will be used, even if it is not contained in
+`flycheck-checkers', or if it is disabled via
+`flycheck-disabled-checkers'."
+ (interactive
+ (if current-prefix-arg
+ (list nil)
+ (list (read-flycheck-checker "Select checker: "
+ (flycheck-get-checker-for-buffer)))))
+ (when (not (eq checker flycheck-checker))
+ (unless (or (not checker) (flycheck-may-use-checker checker))
+ (flycheck-verify-checker checker)
+ (user-error "Can't use syntax checker %S in this buffer" checker))
+ (setq flycheck-checker checker)
+ (when flycheck-mode
+ (flycheck-buffer))))
+
+(defun flycheck-disable-checker (checker &optional enable)
+ "Interactively disable CHECKER for the current buffer.
+
+Interactively, prompt for a syntax checker to disable, and add
+the syntax checker to the buffer-local value of
+`flycheck-disabled-checkers'.
+
+With non-nil ENABLE or with prefix arg, prompt for a disabled
+syntax checker and re-enable it by removing it from the
+buffer-local value of `flycheck-disabled-checkers'."
+ (declare (interactive-only "Directly set `flycheck-disabled-checkers' instead"))
+ (interactive
+ (let* ((enable current-prefix-arg)
+ (candidates (if enable flycheck-disabled-checkers flycheck-checkers))
+ (prompt (if enable "Enable syntax checker: "
+ "Disable syntax checker: ")))
+ (when (and enable (not candidates))
+ (user-error "No syntax checkers disabled in this buffer"))
+ (list (read-flycheck-checker prompt nil nil candidates) enable)))
+ (unless checker
+ (user-error "No syntax checker given"))
+ (if enable
+ ;; We must use `remq' instead of `delq', because we must _not_ modify the
+ ;; list. Otherwise we could potentially modify the global default value,
+ ;; in case the list is the global default.
+ (when (memq checker flycheck-disabled-checkers)
+ (setq flycheck-disabled-checkers
+ (remq checker flycheck-disabled-checkers))
+ (flycheck-buffer))
+ (unless (memq checker flycheck-disabled-checkers)
+ (push checker flycheck-disabled-checkers)
+ (flycheck-buffer))))
+
+\f
+;;; Syntax checks for the current buffer
+(defvar-local flycheck-current-syntax-check nil
+ "The current syntax check in the this buffer.")
+(put 'flycheck-current-syntax-check 'permanent-local t)
+
+(defun flycheck-start-current-syntax-check (checker)
+ "Start a syntax check in the current buffer with CHECKER.
+
+Set `flycheck-current-syntax-check' accordingly."
+ ;; Allocate the current syntax check *before* starting it. This allows for
+ ;; synchronous checks, which call the status callback immediately in there
+ ;; start function.
+ (let* ((check (flycheck-syntax-check-new :buffer (current-buffer)
+ :checker checker
+ :context nil))
+ (callback (flycheck-buffer-status-callback check)))
+ (setq flycheck-current-syntax-check check)
+ (flycheck-report-status 'running)
+ (flycheck-syntax-check-start check callback)))
+
+(defun flycheck-running-p ()
+ "Determine whether a syntax check is running in the current buffer."
+ (not (null flycheck-current-syntax-check)))
+
+(defun flycheck-stop ()
+ "Stop any ongoing syntax check in the current buffer."
+ (when (flycheck-running-p)
+ (flycheck-syntax-check-interrupt flycheck-current-syntax-check)
+ ;; Remove the current syntax check, to reset Flycheck into a non-running
+ ;; state, and to make `flycheck-report-buffer-checker-status' ignore any
+ ;; status reports from the current syntax check.
+ (setq flycheck-current-syntax-check nil)
+ (flycheck-report-status 'interrupted)))
+
+(defun flycheck-buffer-status-callback (syntax-check)
+ "Create a status callback for SYNTAX-CHECK in the current buffer."
+ (lambda (&rest args)
+ (apply #'flycheck-report-buffer-checker-status
+ syntax-check args)))
+
+(defun flycheck-buffer ()
+ "Start checking syntax in the current buffer.
+
+Get a syntax checker for the current buffer with
+`flycheck-get-checker-for-buffer', and start it."
+ (interactive)
+ (flycheck-clean-deferred-check)
+ (if flycheck-mode
+ (unless (flycheck-running-p)
+ ;; Clear error list and mark all overlays for deletion. We do not
+ ;; delete all overlays immediately to avoid excessive re-displays and
+ ;; flickering, if the same errors gets highlighted again after the check
+ ;; completed.
+ (run-hooks 'flycheck-before-syntax-check-hook)
+ (flycheck-clear-errors)
+ (flycheck-mark-all-overlays-for-deletion)
+ (condition-case err
+ (let* ((checker (flycheck-get-checker-for-buffer)))
+ (if checker
+ (flycheck-start-current-syntax-check checker)
+ (flycheck-clear)
+ (flycheck-report-status 'no-checker)))
+ (error
+ (flycheck-report-failed-syntax-check)
+ (signal (car err) (cdr err)))))
+ (user-error "Flycheck mode disabled")))
+
+(defun flycheck-report-buffer-checker-status
+ (syntax-check status &optional data)
+ "In BUFFER, report a SYNTAX-CHECK STATUS with DATA.
+
+SYNTAX-CHECK is the `flycheck-syntax-check' which reported
+STATUS. STATUS denotes the status of CHECKER, with an optional
+DATA. STATUS may be one of the following symbols:
+
+`errored'
+ The syntax checker has errored. DATA is an optional error
+ message.
+
+ This report finishes the current syntax check.
+
+`interrupted'
+ The syntax checker was interrupted. DATA is ignored.
+
+ This report finishes the current syntax check.
+
+`finished'
+ The syntax checker has finished with a proper error report
+ for the current buffer. DATA is the (potentially empty)
+ list of `flycheck-error' objects reported by the syntax
+ check.
+
+ This report finishes the current syntax check.
+
+`suspicious'
+ The syntax checker encountered a suspicious state, which the
+ user needs to be informed about. DATA is an optional
+ message.
+
+A syntax checker _must_ report a status at least once with any
+symbol that finishes the current syntax checker. Otherwise
+Flycheck gets stuck with the current syntax check.
+
+If CHECKER is not the currently used syntax checker in
+`flycheck-current-syntax-check', the status report is largely
+ignored. Notably, any errors reported by the checker are
+discarded."
+ (let ((buffer (flycheck-syntax-check-buffer syntax-check)))
+ ;; Ignore the status report if the buffer is gone, or if this syntax check
+ ;; isn't the current one in buffer (which can happen if this is an old
+ ;; report of an interrupted syntax check, and a new syntax check was started
+ ;; since this check was interrupted)
+ (when (and (buffer-live-p buffer)
+ (eq syntax-check
+ (buffer-local-value 'flycheck-current-syntax-check buffer)))
+ (with-current-buffer buffer
+ (let ((checker (flycheck-syntax-check-checker syntax-check)))
+ (pcase status
+ ((or `errored `interrupted)
+ (flycheck-report-failed-syntax-check status)
+ (when (eq status 'errored)
+ ;; In case of error, show the error message
+ (message "Error from syntax checker %s: %s"
+ checker (or data "UNKNOWN!"))))
+ (`suspicious
+ (when flycheck-mode
+ (message "Suspicious state from syntax checker %s: %s"
+ checker (or data "UNKNOWN!")))
+ (flycheck-report-status 'suspicious))
+ (`finished
+ (when flycheck-mode
+ ;; Only report errors from the checker if Flycheck Mode is
+ ;; still enabled.
+ (flycheck-finish-current-syntax-check data)))
+ (_
+ (error "Unknown status %s from syntax checker %s"
+ status checker))))))))
+
+(defun flycheck-finish-current-syntax-check (errors)
+ "Finish the current syntax-check in the current buffer with ERRORS.
+
+ERRORS is a list of `flycheck-error' objects reported by the
+current syntax check in `flycheck-current-syntax-check'.
+
+Report all ERRORS and potentially start any next syntax checkers.
+
+If the current syntax checker reported excessive errors, it is disabled
+via `flycheck-disable-excessive-checker' for subsequent syntax
+checks."
+ (let* ((syntax-check flycheck-current-syntax-check)
+ (checker (flycheck-syntax-check-checker syntax-check))
+ (errors (flycheck-relevant-errors
+ (flycheck-fill-and-expand-error-file-names
+ (flycheck-filter-errors
+ (flycheck-assert-error-list-p errors) checker)))))
+ (unless (flycheck-disable-excessive-checker checker errors)
+ (flycheck-report-current-errors errors))
+ (let ((next-checker (flycheck-get-next-checker-for-buffer checker)))
+ (if next-checker
+ (flycheck-start-current-syntax-check next-checker)
+ (setq flycheck-current-syntax-check nil)
+ (flycheck-report-status 'finished)
+ ;; Delete overlays only after the very last checker has run, to avoid
+ ;; flickering on intermediate re-displays
+ (flycheck-delete-marked-overlays)
+ (flycheck-error-list-refresh)
+ (run-hooks 'flycheck-after-syntax-check-hook)
+ (when (eq (current-buffer) (window-buffer))
+ (flycheck-display-error-at-point))
+ ;; Immediately try to run any pending deferred syntax check, which
+ ;; were triggered by intermediate automatic check event, to make sure
+ ;; that we quickly refine outdated error information
+ (flycheck-perform-deferred-syntax-check)))))
+
+(defun flycheck-disable-excessive-checker (checker errors)
+ "Disable CHECKER if it reported excessive ERRORS.
+
+If ERRORS has more items than `flycheck-checker-error-threshold',
+add CHECKER to `flycheck-disabled-checkers', and show a warning.
+
+Return t when CHECKER was disabled, or nil otherwise."
+ (when (and flycheck-checker-error-threshold
+ (> (length errors) flycheck-checker-error-threshold))
+ ;; Disable CHECKER for this buffer (`flycheck-disabled-checkers' is a local
+ ;; variable).
+ (lwarn '(flycheck syntax-checker) :warning
+ "Syntax checker %s reported too many errors (%s) and is disabled."
+ checker (length errors))
+ (push checker flycheck-disabled-checkers)
+ t))
+
+(defun flycheck-clear (&optional shall-interrupt)
+ "Clear all errors in the current buffer.
+
+With prefix arg or SHALL-INTERRUPT non-nil, also interrupt the
+current syntax check."
+ (interactive "P")
+ (when shall-interrupt
+ (flycheck-stop))
+ (flycheck-delete-all-overlays)
+ (flycheck-clear-errors)
+ (flycheck-error-list-refresh)
+ (flycheck-hide-error-buffer))
+
+(defun flycheck-teardown ()
+ "Teardown Flycheck in the current buffer..
+
+Completely clear the whole Flycheck state. Remove overlays, kill
+running checks, and empty all variables used by Flycheck."
+ (flycheck-safe-delete-temporaries)
+ (flycheck-stop)
+ (flycheck-clean-deferred-check)
+ (flycheck-clear)
+ (flycheck-cancel-error-display-error-at-point-timer))
+
+\f
+;;; Automatic syntax checking in a buffer
+(defun flycheck-may-check-automatically (&optional condition)
+ "Determine whether the buffer may be checked under CONDITION.
+
+Read-only buffers may never be checked automatically.
+
+If CONDITION is non-nil, determine whether syntax may checked
+automatically according to
+`flycheck-check-syntax-automatically'."
+ (and (not (or buffer-read-only (flycheck-ephemeral-buffer-p)))
+ (file-exists-p default-directory)
+ (or (not condition)
+ (memq condition flycheck-check-syntax-automatically))))
+
+(defun flycheck-buffer-automatically (&optional condition force-deferred)
+ "Automatically check syntax at CONDITION.
+
+Syntax is not checked if `flycheck-may-check-automatically'
+returns nil for CONDITION.
+
+The syntax check is deferred if FORCE-DEFERRED is non-nil, or if
+`flycheck-must-defer-check' returns t."
+ (when (and flycheck-mode (flycheck-may-check-automatically condition))
+ (if (or force-deferred (flycheck-must-defer-check))
+ (flycheck-buffer-deferred)
+ (with-demoted-errors "Error while checking syntax automatically: %S"
+ (flycheck-buffer)))))
+
+(defvar-local flycheck-idle-change-timer nil
+ "Timer to mark the idle time since the last change.")
+
+(defun flycheck-clear-idle-change-timer ()
+ "Clear the idle change timer."
+ (when flycheck-idle-change-timer
+ (cancel-timer flycheck-idle-change-timer)
+ (setq flycheck-idle-change-timer nil)))
+
+(defun flycheck-handle-change (beg end _len)
+ "Handle a buffer change between BEG and END.
+
+BEG and END mark the beginning and end of the change text. _LEN
+is ignored.
+
+Start a syntax check if a new line has been inserted into the
+buffer."
+ ;; Save and restore the match data, as recommended in (elisp)Change Hooks
+ (save-match-data
+ (when flycheck-mode
+ ;; The buffer was changed, thus clear the idle timer
+ (flycheck-clear-idle-change-timer)
+ (if (string-match-p (rx "\n") (buffer-substring beg end))
+ (flycheck-buffer-automatically 'new-line 'force-deferred)
+ (setq flycheck-idle-change-timer
+ (run-at-time flycheck-idle-change-delay nil
+ #'flycheck-handle-idle-change))))))
+
+(defun flycheck-handle-idle-change ()
+ "Handle an expired idle time since the last change."
+ (flycheck-clear-idle-change-timer)
+ (flycheck-buffer-automatically 'idle-change))
+
+(defun flycheck-handle-save ()
+ "Handle a save of the buffer."
+ (flycheck-buffer-automatically 'save))
+
+\f
+;;; Deferred syntax checking
+(defvar-local flycheck-deferred-syntax-check nil
+ "If non-nil, a deferred syntax check is pending.")
+
+(defun flycheck-must-defer-check ()
+ "Determine whether the syntax check has to be deferred.
+
+A check has to be deferred if the buffer is not visible, or if the buffer is
+currently being reverted.
+
+Return t if the check is to be deferred, or nil otherwise."
+ (or (not (get-buffer-window))
+ ;; We defer the syntax check if Flycheck is already running, to
+ ;; immediately start a new syntax check after the current one finished,
+ ;; because the result of the current check will most likely be outdated by
+ ;; the time it is finished.
+ (flycheck-running-p)
+ ;; We must defer checks while a buffer is being reverted, to avoid race
+ ;; conditions while the buffer contents are being restored.
+ revert-buffer-in-progress-p))
+
+(defun flycheck-deferred-check-p ()
+ "Determine whether the current buffer has a deferred check.
+
+Return t if so, or nil otherwise."
+ flycheck-deferred-syntax-check)
+
+(defun flycheck-buffer-deferred ()
+ "Defer syntax check for the current buffer."
+ (setq flycheck-deferred-syntax-check t))
+
+(defun flycheck-clean-deferred-check ()
+ "Clean an deferred syntax checking state."
+ (setq flycheck-deferred-syntax-check nil))
+
+(defun flycheck-perform-deferred-syntax-check ()
+ "Perform the deferred syntax check."
+ (when (flycheck-deferred-check-p)
+ (flycheck-clean-deferred-check)
+ (flycheck-buffer-automatically)))
+
+\f
+;;; Syntax checking in all buffers
+(defun flycheck-may-enable-mode ()
+ "Determine whether Flycheck mode may be enabled.
+
+Flycheck mode is not enabled for
+
+- the minibuffer,
+- major modes whose `mode-class' property is `special',
+- ephemeral buffers (see `flycheck-ephemeral-buffer-p'),
+- encrypted buffers (see `flycheck-encrypted-buffer-p'),
+- remote files (see `file-remote-p'),
+- and major modes excluded by `flycheck-global-modes'.
+
+Return non-nil if Flycheck mode may be enabled, and nil
+otherwise."
+ (and (pcase flycheck-global-modes
+ ;; Whether `major-mode' is disallowed by `flycheck-global-modes'
+ (`t t)
+ (`(not . ,modes) (not (memq major-mode modes)))
+ (modes (memq major-mode modes)))
+ (not (or (minibufferp)
+ (eq (get major-mode 'mode-class) 'special)
+ (flycheck-ephemeral-buffer-p)
+ (flycheck-encrypted-buffer-p)
+ (and (buffer-file-name)
+ (file-remote-p (buffer-file-name) 'method))))))
+
+(defun flycheck-mode-on-safe ()
+ "Enable `flycheck-mode' if it is safe to do so.
+
+`flycheck-mode' is only enabled if `flycheck-may-enable-mode'
+returns t."
+ (when (flycheck-may-enable-mode)
+ (flycheck-mode)))
+
+;;;###autoload
+(define-globalized-minor-mode global-flycheck-mode flycheck-mode
+ flycheck-mode-on-safe
+ :init-value nil
+ ;; Do not expose Global Flycheck Mode on customize interface, because the
+ ;; interaction between package.el and customize is currently broken. See
+ ;; https://github.com/flycheck/flycheck/issues/595
+
+ ;; :require 'flycheck :group
+ ;; 'flycheck
+ )
+
+(defun flycheck-global-teardown ()
+ "Teardown Flycheck in all buffers.
+
+Completely clear the whole Flycheck state in all buffers, stop
+all running checks, remove all temporary files, and empty all
+variables of Flycheck."
+ (dolist (buffer (buffer-list))
+ (with-current-buffer buffer
+ (when flycheck-mode
+ (flycheck-teardown)))))
+
+;; Clean up the entire state of Flycheck when Emacs is killed, to get rid of any
+;; pending temporary files.
+(add-hook 'kill-emacs-hook #'flycheck-global-teardown)
+
+\f
+;;; Errors from syntax checks
+(cl-defstruct (flycheck-error
+ (:constructor flycheck-error-new)
+ (:constructor flycheck-error-new-at (line column
+ &optional level message
+ &key checker id
+ (filename (buffer-file-name))
+ (buffer (current-buffer)))))
+ "Structure representing an error reported by a syntax checker.
+Slots:
+
+`buffer'
+ The buffer the reported was reported for, as buffer object.
+
+`checker'
+ The syntax checker which reported this error, as symbol.
+
+`filename'
+ The file name the error refers to, as string.
+
+`line'
+ The line number the error refers to, as number.
+
+`column' (optional)
+ The column number the error refers to, as number.
+
+ For compatibility with external tools and unlike Emacs
+ itself (e.g. in Compile Mode) Flycheck uses _1-based_
+ columns: The first character on a line is column 1.
+
+ Occasionally some tools try to proactively adapt to Emacs
+ and emit 0-based columns automatically. In these cases, the
+ columns must be adjusted for Flycheck, see
+ `flycheck-increment-error-columns'.
+
+`level'
+ The error level, as either `warning' or `error'.
+
+`id' (optional)
+ An ID identifying the kind of error."
+ buffer checker filename line column message level id)
+
+(defmacro flycheck-error-with-buffer (err &rest forms)
+ "Switch to the buffer of ERR and evaluate FORMS.
+
+If the buffer of ERR is not live, FORMS are not evaluated."
+ (declare (indent 1) (debug t))
+ `(when (buffer-live-p (flycheck-error-buffer ,err))
+ (with-current-buffer (flycheck-error-buffer ,err)
+ ,@forms)))
+
+(defun flycheck-error-line-region (err)
+ "Get the line region of ERR.
+
+ERR is a Flycheck error whose region to get.
+
+Return a cons cell `(BEG . END)' where BEG is the first
+non-whitespace character on the line ERR refers to, and END the
+end of the line."
+ (flycheck-error-with-buffer err
+ (save-restriction
+ (save-excursion
+ (widen)
+ (goto-char (point-min))
+ (forward-line (- (flycheck-error-line err) 1))
+ ;; We are at the beginning of the line now, so move to the beginning of
+ ;; its indentation, similar to `back-to-indentation'
+ (let ((end (line-end-position)))
+ (skip-syntax-forward " " end)
+ (backward-prefix-chars)
+ ;; If the current line is empty, include the previous line break
+ ;; character(s) to have any region at all. When called with 0,
+ ;; `line-end-position' gives us the end of the previous line
+ (cons (if (eolp) (line-end-position 0) (point)) end))))))
+
+(defun flycheck-error-column-region (err)
+ "Get the error column region of ERR.
+
+ERR is a Flycheck error whose region to get.
+
+Return a cons cell `(BEG . END)' where BEG is the character
+before the error column, and END the actual error column, or nil
+if ERR has no column."
+ (flycheck-error-with-buffer err
+ (save-restriction
+ (save-excursion
+ (-when-let (column (flycheck-error-column err))
+ (widen)
+ (goto-char (point-min))
+ (forward-line (- (flycheck-error-line err) 1))
+ (cond
+ ((eobp) ; Line beyond EOF
+ ;; If we are at the end of the file (i.e. the line was beyond the
+ ;; end of the file), use the very last column in the file.
+ (cons (- (point-max) 1) (point-max)))
+ ((eolp) ; Empty line
+ ;; If the target line is empty, there's no column to highlight on
+ ;; this line, so return the last column of the previous line.
+ (cons (line-end-position 0) (point)))
+ (t
+ ;; The end is either the column offset of the line, or the end of
+ ;; the line, if the column offset points beyond the end of the
+ ;; line.
+ (let ((end (min (+ (point) column)
+ (+ (line-end-position) 1))))
+ (cons (- end 1) end)))))))))
+
+(defun flycheck-error-thing-region (thing err)
+ "Get the region of THING at the column of ERR.
+
+ERR is a Flycheck error whose region to get. THING is a
+understood by `thing-at-point'.
+
+Return a cons cell `(BEG . END)' where BEG is the beginning of
+the THING at the error column, and END the end of the symbol. If
+ERR has no error column, or if there is no THING at this column,
+return nil."
+ (-when-let (column (car (flycheck-error-column-region err)))
+ (flycheck-error-with-buffer err
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char column)
+ (bounds-of-thing-at-point thing))))))
+
+(defun flycheck-error-region-for-mode (err mode)
+ "Get the region of ERR for the highlighting MODE.
+
+ERR is a Flycheck error. MODE may be one of the following symbols:
+
+`columns'
+ Get the column region of ERR, or the line region if ERR
+ has no column.
+
+`symbols'
+ Get the symbol region of ERR, or the result of `columns', if
+ there is no sexp at the error column.
+
+`sexps'
+ Get the sexp region of ERR, or the result of `columns', if
+ there is no sexp at the error column.
+
+`lines'
+ Return the line region.
+
+Otherwise signal an error."
+ (pcase mode
+ (`columns (or (flycheck-error-column-region err)
+ (flycheck-error-line-region err)))
+ (`symbols (or (flycheck-error-thing-region 'symbol err)
+ (flycheck-error-region-for-mode err 'columns)))
+ (`sexps (or (flycheck-error-thing-region 'sexp err)
+ (flycheck-error-region-for-mode err 'columns)))
+ (`lines (flycheck-error-line-region err))
+ (_ (error "Invalid mode %S" mode))))
+
+(defun flycheck-error-pos (err)
+ "Get the buffer position of ERR.
+
+ERR is a Flycheck error whose position to get.
+
+The error position is the error column, or the first
+non-whitespace character of the error line, if ERR has no error column."
+ (car (or (flycheck-error-column-region err)
+ (flycheck-error-line-region err))))
+
+(defun flycheck-error-format-message-and-id (err)
+ "Format the message and id of ERR as human-readable string."
+ (let ((id (flycheck-error-id err))
+ (message (flycheck-error-message err)))
+ (if id (format "%s [%s]" message id) message)))
+
+(defun flycheck-error-format (err &optional with-file-name)
+ "Format ERR as human-readable string, optionally WITH-FILE-NAME.
+
+Return a string that represents the given ERR. If WITH-FILE-NAME
+is given and non-nil, include the file-name as well, otherwise
+omit it."
+ (let* ((line (flycheck-error-line err))
+ (column (flycheck-error-column err))
+ (level (symbol-name (flycheck-error-level err)))
+ (checker (symbol-name (flycheck-error-checker err)))
+ (format `(,@(when with-file-name
+ (list (flycheck-error-filename err) ":"))
+ ,(number-to-string line) ":"
+ ,@(when column (list (number-to-string column) ":"))
+ ,level ": "
+ ,(flycheck-error-format-message-and-id err)
+ " (" ,checker ")")))
+ (apply #'concat format)))
+
+(defun flycheck-error-< (err1 err2)
+ "Determine whether ERR1 is less than ERR2 by location.
+
+Compare by line numbers and then by column numbers."
+ (let ((line1 (flycheck-error-line err1))
+ (line2 (flycheck-error-line err2)))
+ (if (= line1 line2)
+ (let ((col1 (flycheck-error-column err1))
+ (col2 (flycheck-error-column err2)))
+ (and col2
+ ;; Sort errors for the whole line first
+ (or (not col1) (< col1 col2))))
+ (< line1 line2))))
+
+(defun flycheck-error-level-< (err1 err2)
+ "Determine whether ERR1 is less than ERR2 by error level.
+
+Like `flycheck-error-<', but compares by error level severity
+first. Levels of the same severity are compared by name."
+ (let* ((level1 (flycheck-error-level err1))
+ (level2 (flycheck-error-level err2))
+ (severity1 (flycheck-error-level-severity level1))
+ (severity2 (flycheck-error-level-severity level2)))
+ (cond
+ ((= severity1 severity2)
+ (if (string= level1 level2)
+ (flycheck-error-< err1 err2)
+ (string< level1 level2)))
+ (t (< severity1 severity2)))))
+
+(defun flycheck-assert-error-list-p (errors)
+ "Assert that all items in ERRORS are of `flycheck-error' type.
+
+Signal an error if any item in ERRORS is not a `flycheck-error'
+object, as by `flycheck-error-p'. Otherwise return ERRORS
+again."
+ (unless (listp errors)
+ (signal 'wrong-type-argument (list 'listp errors)))
+ (dolist (err errors)
+ (unless (flycheck-error-p err)
+ (signal 'wrong-type-argument (list 'flycheck-error-p err))))
+ errors)
+
+\f
+;;; Errors in the current buffer
+(defvar-local flycheck-current-errors nil
+ "A list of all errors and warnings in the current buffer.")
+
+(defun flycheck-report-current-errors (errors)
+ "Report ERRORS in the current buffer.
+
+Add ERRORS to `flycheck-current-errors' and process each error
+with `flycheck-process-error-functions'."
+ (setq flycheck-current-errors (sort (append errors flycheck-current-errors)
+ #'flycheck-error-<))
+ (seq-do (lambda (err)
+ (run-hook-with-args-until-success 'flycheck-process-error-functions
+ err))
+ errors))
+
+(defun flycheck-clear-errors ()
+ "Remove all error information from the current buffer."
+ (setq flycheck-current-errors nil)
+ (flycheck-report-status 'not-checked))
+
+(defun flycheck-fill-and-expand-error-file-names (errors)
+ "Fill and expand file names in ERRORS.
+
+Expand all file names of ERRORS against the `default-directory'
+of the current buffer. If the file name of an error is nil fill
+in the result of function `buffer-file-name' in the current
+buffer.
+
+Return ERRORS, modified in-place."
+ (seq-do (lambda (err)
+ (setf (flycheck-error-filename err)
+ (-if-let (filename (flycheck-error-filename err))
+ (expand-file-name filename)
+ (buffer-file-name))))
+ errors)
+ errors)
+
+(defun flycheck-relevant-error-p (err)
+ "Determine whether ERR is relevant for the current buffer.
+
+Return t if ERR may be shown for the current buffer, or nil
+otherwise."
+ (flycheck-error-with-buffer err
+ (let ((file-name (flycheck-error-filename err))
+ (message (flycheck-error-message err)))
+ (and
+ (or (not file-name) (flycheck-same-files-p file-name (buffer-file-name)))
+ message
+ (not (string-empty-p message))
+ (flycheck-error-line err)))))
+
+(defun flycheck-relevant-errors (errors)
+ "Filter the relevant errors from ERRORS.
+
+Return a list of all errors that are relevant for their
+corresponding buffer."
+ (seq-filter #'flycheck-relevant-error-p errors))
+
+\f
+;;; Status reporting for the current buffer
+(defvar-local flycheck-last-status-change 'not-checked
+ "The last status change in the current buffer.")
+
+(defun flycheck-report-failed-syntax-check (&optional status)
+ "Report a failed Flycheck syntax check with STATUS.
+
+STATUS is a status symbol for `flycheck-report-status',
+defaulting to `errored'.
+
+Clear Flycheck state, run `flycheck-syntax-check-failed-hook' and
+report an error STATUS."
+ (flycheck-clear)
+ (setq flycheck-current-syntax-check nil)
+ (run-hooks 'flycheck-syntax-check-failed-hook)
+ (flycheck-report-status (or status 'errored)))
+
+(defun flycheck-report-status (status)
+ "Report Flycheck STATUS.
+
+STATUS is one of the following symbols:
+
+`not-checked'
+ The current buffer was not checked.
+
+`no-checker'
+ Automatic syntax checker selection did not find a suitable
+ syntax checker.
+
+`running'
+ A syntax check is now running in the current buffer.
+
+`errored'
+ The current syntax check has errored.
+
+`finished'
+ The current syntax check was finished normally.
+
+`interrupted'
+ The current syntax check was interrupted.
+
+`suspicious'
+ The last syntax check had a suspicious result.
+
+Set `flycheck-last-status-change' and call
+`flycheck-status-changed-functions' with STATUS. Afterwards
+refresh the mode line."
+ (setq flycheck-last-status-change status)
+ (run-hook-with-args 'flycheck-status-changed-functions status)
+ (force-mode-line-update))
+
+(defun flycheck-mode-line-status-text (&optional status)
+ "Get a text describing STATUS for use in the mode line.
+
+STATUS defaults to `flycheck-last-status-change' if omitted or
+nil."
+ (let ((text (pcase (or status flycheck-last-status-change)
+ (`not-checked "")
+ (`no-checker "-")
+ (`running "*")
+ (`errored "!")
+ (`finished
+ (let-alist (flycheck-count-errors flycheck-current-errors)
+ (if (or .error .warning)
+ (format ":%s/%s" (or .error 0) (or .warning 0))
+ "")))
+ (`interrupted "-")
+ (`suspicious "?"))))
+ (concat " " flycheck-mode-line-prefix text)))
+
+\f
+;;; Error levels
+;;;###autoload
+(defun flycheck-define-error-level (level &rest properties)
+ "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.
+
+ 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 BITMAP'
+ A fringe bitmap symbol denoting the bitmap to use for fringe
+ indicators for this level. 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.
+
+`: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'."
+ (declare (indent 1))
+ (setf (get level 'flycheck-error-level) t)
+ (setf (get level 'flycheck-error-severity)
+ (or (plist-get properties :severity) 0))
+ (setf (get level 'flycheck-compilation-level)
+ (plist-get properties :compilation-level))
+ (setf (get level 'flycheck-overlay-category)
+ (plist-get properties :overlay-category))
+ (setf (get level 'flycheck-fringe-bitmap-double-arrow)
+ (plist-get properties :fringe-bitmap))
+ (setf (get level 'flycheck-fringe-face)
+ (plist-get properties :fringe-face))
+ (setf (get level 'flycheck-error-list-face)
+ (plist-get properties :error-list-face)))
+
+(defun flycheck-error-level-p (level)
+ "Determine whether LEVEL is a Flycheck error level."
+ (get level 'flycheck-error-level))
+
+(defun flycheck-error-level-severity (level)
+ "Get the numeric severity of LEVEL."
+ (or (get level 'flycheck-error-severity) 0))
+
+(defun flycheck-error-level-compilation-level (level)
+ "Get the compilation level for LEVEL."
+ (get level 'flycheck-compilation-level))
+
+(defun flycheck-error-level-overlay-category (level)
+ "Get the overlay category for LEVEL."
+ (get level 'flycheck-overlay-category))
+
+(defun flycheck-error-level-fringe-bitmap (level)
+ "Get the fringe bitmap for LEVEL."
+ (get level 'flycheck-fringe-bitmap-double-arrow))
+
+(defun flycheck-error-level-fringe-face (level)
+ "Get the fringe face for LEVEL."
+ (get level 'flycheck-fringe-face))
+
+(defun flycheck-error-level-error-list-face (level)
+ "Get the error list face for LEVEL."
+ (get level 'flycheck-error-list-face))
+
+(defun flycheck-error-level-make-fringe-icon (level side)
+ "Create the fringe icon for LEVEL at SIDE.
+
+Return a propertized string that shows a fringe bitmap according
+to LEVEL and the given fringe SIDE.
+
+LEVEL is a Flycheck error level defined with
+`flycheck-define-error-level', and SIDE is either `left-fringe'
+or `right-fringe'.
+
+Return a propertized string representing the fringe icon,
+intended for use as `before-string' of an overlay to actually
+show the icon."
+ (unless (memq side '(left-fringe right-fringe))
+ (error "Invalid fringe side: %S" side))
+ (propertize "!" 'display
+ (list side
+ (flycheck-error-level-fringe-bitmap level)
+ (flycheck-error-level-fringe-face level))))
+
+\f
+;;; Built-in error levels
+(when (fboundp 'define-fringe-bitmap)
+ (define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
+ (vector #b00000000
+ #b00000000
+ #b00000000
+ #b00000000
+ #b00000000
+ #b10011000
+ #b01101100
+ #b00110110
+ #b00011011
+ #b00110110
+ #b01101100
+ #b10011000
+ #b00000000
+ #b00000000
+ #b00000000
+ #b00000000
+ #b00000000)))
+
+(setf (get 'flycheck-error-overlay 'face) 'flycheck-error)
+(setf (get 'flycheck-error-overlay 'priority) 110)
+
+(flycheck-define-error-level 'error
+ :severity 100
+ :compilation-level 2
+ :overlay-category 'flycheck-error-overlay
+ :fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
+ :fringe-face 'flycheck-fringe-error
+ :error-list-face 'flycheck-error-list-error)
+
+(setf (get 'flycheck-warning-overlay 'face) 'flycheck-warning)
+(setf (get 'flycheck-warning-overlay 'priority) 100)
+
+(flycheck-define-error-level 'warning
+ :severity 10
+ :compilation-level 1
+ :overlay-category 'flycheck-warning-overlay
+ :fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
+ :fringe-face 'flycheck-fringe-warning
+ :error-list-face 'flycheck-error-list-warning)
+
+(setf (get 'flycheck-info-overlay 'face) 'flycheck-info)
+(setf (get 'flycheck-info-overlay 'priority) 90)
+
+(flycheck-define-error-level 'info
+ :severity -10
+ :compilation-level 0
+ :overlay-category 'flycheck-info-overlay
+ :fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
+ :fringe-face 'flycheck-fringe-info
+ :error-list-face 'flycheck-error-list-info)
+
+\f
+;;; Error filtering
+(defun flycheck-filter-errors (errors checker)
+ "Filter ERRORS from CHECKER.
+
+Apply the error filter of CHECKER to ERRORs and return the
+result. If CHECKER has no error filter, fall back to
+`flycheck-sanitize-errors'."
+ (let ((filter (or (flycheck-checker-get checker 'error-filter)
+ #'flycheck-sanitize-errors)))
+ (funcall filter errors)))
+
+(defun flycheck-sanitize-errors (errors)
+ "Sanitize ERRORS.
+
+Sanitize ERRORS by trimming leading and trailing whitespace in
+all error messages, and by replacing 0 columns and empty error
+messages with nil.
+
+Returns sanitized ERRORS."
+ (dolist (err errors)
+ (flycheck-error-with-buffer err
+ (let ((message (flycheck-error-message err))
+ (column (flycheck-error-column err))
+ (id (flycheck-error-id err)))
+ (when message
+ (setq message (string-trim message))
+ (setf (flycheck-error-message err)
+ (if (string-empty-p message) nil message)))
+ (when (and id (string-empty-p id))
+ (setf (flycheck-error-id err) nil))
+ (when (eq column 0)
+ (setf (flycheck-error-column err) nil)))))
+ errors)
+
+(defun flycheck-remove-error-file-names (file-name errors)
+ "Remove matching FILE-NAME from ERRORS.
+
+Use as `:error-filter' for syntax checkers that output faulty
+filenames. Flycheck will later fill in the buffer file name.
+
+Return ERRORS."
+ (seq-do (lambda (err)
+ (when (and (flycheck-error-filename err)
+ (string= (flycheck-error-filename err) file-name))
+ (setf (flycheck-error-filename err) nil)))
+ errors)
+ errors)
+
+(defun flycheck-increment-error-columns (errors &optional offset)
+ "Increment all columns of ERRORS by OFFSET.
+
+Use this as `:error-filter' if a syntax checker outputs 0-based
+columns."
+ (seq-do (lambda (err)
+ (let ((column (flycheck-error-column err)))
+ (when column
+ (setf (flycheck-error-column err)
+ (+ column (or offset 1))))))
+ errors)
+ errors)
+
+(defun flycheck-collapse-error-message-whitespace (errors)
+ "Collapse whitespace in all messages of ERRORS.
+
+Return ERRORS."
+ (dolist (err errors)
+ (-when-let (message (flycheck-error-message err))
+ (setf (flycheck-error-message err)
+ (replace-regexp-in-string (rx (one-or-more (any space "\n" "\r")))
+ " " message 'fixed-case 'literal))))
+ errors)
+
+(defun flycheck-dedent-error-messages (errors)
+ "Dedent all messages of ERRORS.
+
+For each error in ERRORS, determine the indentation offset from
+the leading whitespace of the first line, and dedent all further
+lines accordingly.
+
+Return ERRORS, with in-place modifications."
+ (dolist (err errors)
+ (-when-let (message (flycheck-error-message err))
+ (with-temp-buffer
+ (insert message)
+ ;; Determine the indentation offset
+ (goto-char (point-min))
+ (back-to-indentation)
+ (let* ((indent-offset (- (point) (point-min))))
+ ;; Now iterate over all lines and dedent each according to
+ ;; `indent-offset'
+ (while (not (eobp))
+ (back-to-indentation)
+ ;; If the current line starts with sufficient whitespace, delete the
+ ;; indendation offset. Otherwise keep the line intact, as we might
+ ;; loose valuable information
+ (when (>= (- (point) (line-beginning-position)) indent-offset)
+ (delete-char (- indent-offset)))
+ (forward-line 1)))
+ (delete-trailing-whitespace (point-min) (point-max))
+ (setf (flycheck-error-message err)
+ (buffer-substring-no-properties (point-min) (point-max))))))
+ errors)
+
+(defun flycheck-fold-include-levels (errors sentinel-message)
+ "Fold levels of ERRORS from included files.
+
+ERRORS is a list of `flycheck-error' objects. SENTINEL-MESSAGE
+is a regular expression matched against the error message to
+determine whether the errror denotes errors from an included
+file. Alternatively, it is a function that is given an error and
+shall return non-nil, if the error denotes errors from an
+included file."
+ (unless (or (stringp sentinel-message) (functionp sentinel-message))
+ (error "Sentinel must be string or function: %S" sentinel-message))
+ (let ((sentinel (if (functionp sentinel-message)
+ sentinel-message
+ (lambda (err)
+ (string-match-p sentinel-message
+ (flycheck-error-message err)))))
+ (remaining-errors errors))
+ (while remaining-errors
+ (let* ((current-error (pop remaining-errors)))
+ (when (funcall sentinel current-error)
+ ;; We found an error denoting errors in the included file:
+ ;; 1. process all subsequent errors until faulty include file is found
+ ;; 2. process again all subsequent errors until an error has the
+ ;; current file name again
+ ;; 3. find the most severe error level
+ (let ((current-filename (flycheck-error-filename current-error))
+ (current-level nil)
+ (faulty-include-filename nil)
+ (filename nil)
+ (done (null remaining-errors)))
+
+ (while (not done)
+ (setq filename (flycheck-error-filename (car remaining-errors)))
+ (unless faulty-include-filename
+ (unless (string= filename current-filename)
+ (setq faulty-include-filename filename)))
+
+ (let* ((error-in-include (pop remaining-errors))
+ (in-include-level (flycheck-error-level error-in-include)))
+ (unless (funcall sentinel error-in-include)
+ ;; Ignore nested "included file" errors, we are only
+ ;; interested in real errors because these define our level
+ (when (or (not current-level)
+ (> (flycheck-error-level-severity in-include-level)
+ (flycheck-error-level-severity current-level)))
+ (setq current-level in-include-level))))
+
+ (setq done (or (null remaining-errors)
+ (and faulty-include-filename
+ (string= filename current-filename)))))
+
+ (setf (flycheck-error-level current-error) current-level
+ (flycheck-error-message current-error)
+ (format "In include %s" faulty-include-filename))))))
+ errors))
+
+(defun flycheck-dequalify-error-ids (errors)
+ "De-qualify error ids in ERRORS.
+
+Remove all qualifications from error ids in ERRORS, by stripping
+all leading dotted components from error IDs. For instance, if
+the error ID is com.foo.E100, replace it with E100.
+
+This error filter is mainly useful to simplify error IDs obtained
+from parsing Checkstyle XML, which frequently has very verbose
+IDs, that include the name of the tool."
+ (seq-do (lambda (err)
+ (let ((id (flycheck-error-id err)))
+ (when id
+ (setf (flycheck-error-id err)
+ (replace-regexp-in-string
+ (rx string-start
+ (group
+ (optional (zero-or-more not-newline) "."))
+ (one-or-more (not (any ".")))
+ string-end)
+ "" id 'fixedcase 'literal 1)))))
+ errors)
+ errors)
+
+(defun flycheck-remove-error-ids (errors)
+ "Remove all error ids from ERRORS."
+ (seq-do (lambda (err) (setf (flycheck-error-id err) nil)) errors)
+ errors)
+
+\f
+;;; Error analysis
+(defun flycheck-count-errors (errors)
+ "Count the number of ERRORS, grouped by level..
+
+Return an alist, where each ITEM is a cons cell whose `car' is an
+error level, and whose `cdr' is the number of errors of that
+level."
+ (let (counts-by-level)
+ (dolist (err errors)
+ (let* ((level (flycheck-error-level err))
+ (item (assq level counts-by-level)))
+ (if item
+ (cl-incf (cdr item))
+ (push (cons level 1) counts-by-level))))
+ counts-by-level))
+
+(defun flycheck-has-max-errors-p (errors level)
+ "Check if there is no error in ERRORS more severe than LEVEL."
+ (let ((severity (flycheck-error-level-severity level)))
+ (seq-every-p (lambda (e) (<= (flycheck-error-level-severity
+ (flycheck-error-level e))
+ severity))
+ errors)))
+
+(defun flycheck-has-max-current-errors-p (level)
+ "Check if there is no current error more severe than LEVEL."
+ (flycheck-has-max-errors-p flycheck-current-errors level))
+
+(defun flycheck-has-errors-p (errors level)
+ "Determine if there are any ERRORS with LEVEL."
+ (seq-some (lambda (e) (eq (flycheck-error-level e) level)) errors))
+
+(defun flycheck-has-current-errors-p (&optional level)
+ "Determine if the current buffer has errors with LEVEL.
+
+If LEVEL is omitted if the current buffer has any errors at all."
+ (if level
+ (flycheck-has-errors-p flycheck-current-errors level)
+ (and flycheck-current-errors t)))
+
+\f
+;;; Error overlays in the current buffer
+(defun flycheck-add-overlay (err)
+ "Add overlay for ERR.
+
+Return the created overlay."
+ ;; We must have a proper error region for the sake of fringe indication,
+ ;; error display and error navigation, even if the highlighting is disabled.
+ ;; We erase the highlighting later on in this case
+ (pcase-let* ((`(,beg . ,end) (flycheck-error-region-for-mode
+ err (or flycheck-highlighting-mode 'lines)))
+ (overlay (make-overlay beg end))
+ (level (flycheck-error-level err))
+ (category (flycheck-error-level-overlay-category level)))
+ (unless (flycheck-error-level-p level)
+ (error "Undefined error level: %S" level))
+ (setf (overlay-get overlay 'flycheck-overlay) t)
+ (setf (overlay-get overlay 'flycheck-error) err)
+ ;; TODO: Consider hooks to re-check if overlay contents change
+ (setf (overlay-get overlay 'category) category)
+ (unless flycheck-highlighting-mode
+ ;; Erase the highlighting from the overlay if requested by the user
+ (setf (overlay-get overlay 'face) nil))
+ (when flycheck-indication-mode
+ (setf (overlay-get overlay 'before-string)
+ (flycheck-error-level-make-fringe-icon
+ level flycheck-indication-mode)))
+ (setf (overlay-get overlay 'help-echo) #'flycheck-help-echo)
+ overlay))
+
+(defun flycheck-help-echo (_window object pos)
+ "Construct a tooltip message.
+
+Most of the actual work is done by calling
+`flycheck-help-echo-function' with the appropriate list of
+errors. Arguments WINDOW, OBJECT and POS are as described in
+info node `(elisp)Special properties', as this function is
+intended to be used as the 'help-echo property of flycheck error
+overlays."
+ (-when-let (buf (cond ((bufferp object) object)
+ ((overlayp object) (overlay-buffer object))))
+ (with-current-buffer buf
+ (-when-let* ((fn flycheck-help-echo-function)
+ (errs (flycheck-overlay-errors-at pos)))
+ (funcall fn errs)))))
+
+(defun flycheck-help-echo-all-error-messages (errs)
+ "Concatenate error messages and ids from ERRS."
+ (mapconcat
+ (lambda (err)
+ (when err
+ (if (flycheck-error-message err)
+ (flycheck-error-format-message-and-id err)
+ (format "Unknown %s" (flycheck-error-level err)))))
+ (reverse errs) "\n\n"))
+
+(defun flycheck-filter-overlays (overlays)
+ "Get all Flycheck overlays from OVERLAYS."
+ (seq-filter (lambda (o) (overlay-get o 'flycheck-overlay)) overlays))
+
+(defun flycheck-overlays-at (pos)
+ "Get all Flycheck overlays at POS."
+ (flycheck-filter-overlays (overlays-at pos)))
+
+(defun flycheck-overlays-in (beg end)
+ "Get all Flycheck overlays between BEG and END."
+ (flycheck-filter-overlays (overlays-in beg end)))
+
+(defun flycheck-overlay-errors-at (pos)
+ "Return a list of all flycheck errors overlayed at POS."
+ (seq-map (lambda (o) (overlay-get o 'flycheck-error))
+ (flycheck-overlays-at pos)))
+
+(defun flycheck-overlay-errors-in (beg end)
+ "Return a list of all flycheck errors overlayed between BEG and END."
+ (seq-map (lambda (o) (overlay-get o 'flycheck-error))
+ (flycheck-overlays-in beg end)))
+
+(defvar-local flycheck-overlays-to-delete nil
+ "Overlays mark for deletion after all syntax checks completed.")
+(put 'flycheck-overlays-to-delete 'permanent-local t)
+
+(defun flycheck-delete-all-overlays ()
+ "Remove all flycheck overlays in the current buffer."
+ (flycheck-delete-marked-overlays)
+ (save-restriction
+ (widen)
+ (seq-do #'delete-overlay (flycheck-overlays-in (point-min) (point-max)))))
+
+(defun flycheck-mark-all-overlays-for-deletion ()
+ "Mark all current overlays for deletion."
+ (setq flycheck-overlays-to-delete
+ (append (flycheck-overlays-in (point-min) (point-max))
+ flycheck-overlays-to-delete)))
+
+(defun flycheck-delete-marked-overlays ()
+ "Delete all overlays marked for deletion."
+ (seq-do #'delete-overlay flycheck-overlays-to-delete)
+ (setq flycheck-overlays-to-delete nil))
+
+\f
+;;; Error navigation in the current buffer
+(defun flycheck-error-level-interesting-at-pos-p (pos)
+ "Check if error severity at POS passes `flycheck-error-level-interesting-p'."
+ (flycheck-error-level-interesting-p (get-char-property pos 'flycheck-error)))
+
+(defun flycheck-error-level-interesting-p (err)
+ "Check if ERR severity is >= `flycheck-navigation-minimum-level'."
+ (when (flycheck-error-p err)
+ (-if-let (min-level flycheck-navigation-minimum-level)
+ (<= (flycheck-error-level-severity min-level)
+ (flycheck-error-level-severity (flycheck-error-level err)))
+ t)))
+
+(defun flycheck-next-error-pos (n &optional reset)
+ "Get the position of the N-th next error.
+
+With negative N, get the position of the (-N)-th previous error
+instead. With non-nil RESET, search from `point-min', otherwise
+search from the current point.
+
+Return the position of the next or previous error, or nil if
+there is none."
+ (let ((n (or n 1))
+ (pos (if reset (point-min) (point))))
+ (if (>= n 0)
+ ;; Search forwards
+ (while (and pos (> n 0))
+ (setq n (1- n))
+ (when (get-char-property pos 'flycheck-error)
+ ;; Move beyond from the current error if any
+ (setq pos (next-single-char-property-change pos 'flycheck-error)))
+ (while (not (or (= pos (point-max))
+ (flycheck-error-level-interesting-at-pos-p pos)))
+ ;; Scan for the next error
+ (setq pos (next-single-char-property-change pos 'flycheck-error)))
+ (when (and (= pos (point-max))
+ (not (flycheck-error-level-interesting-at-pos-p pos)))
+ ;; If we reached the end of the buffer, but no error, we didn't find
+ ;; any
+ (setq pos nil)))
+ ;; Search backwards
+ (while (and pos (< n 0))
+ (setq n (1+ n))
+ ;; Loop until we find an error. We need to check the position *before*
+ ;; the current one, because `previous-single-char-property-change'
+ ;; always moves to the position *of* the change.
+ (while (not (or (= pos (point-min))
+ (flycheck-error-level-interesting-at-pos-p (1- pos))))
+ (setq pos (previous-single-char-property-change pos 'flycheck-error)))
+ (when (and (= pos (point-min))
+ (not (flycheck-error-level-interesting-at-pos-p pos)))
+ ;; We didn't find any error.
+ (setq pos nil))
+ (when pos
+ ;; We found an error, so move to its beginning
+ (setq pos (previous-single-char-property-change pos
+ 'flycheck-error)))))
+ pos))
+
+(defun flycheck-next-error-function (n reset)
+ "Visit the N-th error from the current point.
+
+N is the number of errors to advance by, where a negative N
+advances backwards. With non-nil RESET, advance from the
+beginning of the buffer, otherwise advance from the current
+position.
+
+Intended for use with `next-error-function'."
+ (let ((pos (flycheck-next-error-pos n reset)))
+ (if pos
+ (goto-char pos)
+ (user-error "No more Flycheck errors"))))
+
+(defun flycheck-next-error (&optional n reset)
+ "Visit the N-th error from the current point.
+
+N is the number of errors to advance by, where a negative N
+advances backwards. With non-nil RESET, advance from the
+beginning of the buffer, otherwise advance from the current
+position."
+ (interactive "P")
+ (when (consp n)
+ ;; Universal prefix argument means reset
+ (setq reset t n nil))
+ (flycheck-next-error-function n reset))
+
+(defun flycheck-previous-error (&optional n)
+ "Visit the N-th previous error.
+
+If given, N specifies the number of errors to move backwards by.
+If N is negative, move forwards instead."
+ (interactive "P")
+ (flycheck-next-error (- (or n 1))))
+
+(defun flycheck-first-error (&optional n)
+ "Visit the N-th error from beginning of the buffer.
+
+If given, N specifies the number of errors to move forward from
+the beginning of the buffer."
+ (interactive "P")
+ (flycheck-next-error n 'reset))
+
+\f
+;;; Listing errors in buffers
+(defconst flycheck-error-list-buffer "*Flycheck errors*"
+ "The name of the buffer to show error lists.")
+
+(defvar flycheck-error-list-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "f") #'flycheck-error-list-set-filter)
+ (define-key map (kbd "F") #'flycheck-error-list-reset-filter)
+ (define-key map (kbd "n") #'flycheck-error-list-next-error)
+ (define-key map (kbd "p") #'flycheck-error-list-previous-error)
+ (define-key map (kbd "g") #'flycheck-error-list-check-source)
+ (define-key map (kbd "RET") #'flycheck-error-list-goto-error)
+ map)
+ "The keymap of `flycheck-error-list-mode'.")
+
+(defconst flycheck-error-list-format
+ [("Line" 4 flycheck-error-list-entry-< :right-align t)
+ ("Col" 3 nil :right-align t)
+ ("Level" 8 flycheck-error-list-entry-level-<)
+ ("ID" 6 t)
+ ("Message (Checker)" 0 t)]
+ "Table format for the error list.")
+
+(define-derived-mode flycheck-error-list-mode tabulated-list-mode "Flycheck errors"
+ "Major mode for listing Flycheck errors.
+
+\\{flycheck-error-list-mode-map}"
+ (setq tabulated-list-format flycheck-error-list-format
+ ;; Sort by location initially
+ tabulated-list-sort-key (cons "Line" nil)
+ tabulated-list-padding 1
+ tabulated-list-entries #'flycheck-error-list-entries
+ ;; `revert-buffer' updates the mode line for us, so all we need to do is
+ ;; set the corresponding mode line construct.
+ mode-line-buffer-identification flycheck-error-list-mode-line)
+ (tabulated-list-init-header))
+
+(defvar-local flycheck-error-list-source-buffer nil
+ "The current source buffer of the error list.")
+;; Needs to permanently local to preserve the source buffer across buffer
+;; reversions
+(put 'flycheck-error-list-source-buffer 'permanent-local t)
+
+(defun flycheck-error-list-set-source (buffer)
+ "Set BUFFER as the source buffer of the error list."
+ (when (get-buffer flycheck-error-list-buffer)
+ (with-current-buffer flycheck-error-list-buffer
+ ;; Only update the source when required
+ (unless (eq buffer flycheck-error-list-source-buffer)
+ (setq flycheck-error-list-source-buffer buffer)
+ (flycheck-error-list-refresh)))))
+
+(defun flycheck-error-list-update-source ()
+ "Update the source buffer of the error list."
+ (when (not (eq (current-buffer) (get-buffer flycheck-error-list-buffer)))
+ ;; We must not update the source buffer, if the current buffer is the error
+ ;; list itself.
+ (flycheck-error-list-set-source (current-buffer))))
+
+(defun flycheck-error-list-check-source ()
+ "Trigger a syntax check in the source buffer of the error list."
+ (interactive)
+ (let ((buffer (get-buffer flycheck-error-list-source-buffer)))
+ (when (buffer-live-p buffer)
+ (with-current-buffer buffer
+ (flycheck-buffer)))))
+
+(define-button-type 'flycheck-error-list
+ 'action #'flycheck-error-list-button-goto-error
+ 'help-echo "mouse-2, RET: goto error")
+
+(defun flycheck-error-list-button-goto-error (button)
+ "Go to the error at BUTTON."
+ (flycheck-error-list-goto-error (button-start button)))
+
+(defsubst flycheck-error-list-make-cell (text &optional face)
+ "Make an error list cell with TEXT and FACE.
+
+If FACE is nil don't set a FACE on TEXT. If TEXT already has
+face properties, do not specify a FACE. Note though, that if
+TEXT gets truncated it will not inherit any previous face
+properties. If you expect TEXT to be truncated in the error
+list, do specify a FACE explicitly!"
+ (append (list text 'type 'flycheck-error-list)
+ (and face (list 'face face))))
+
+(defsubst flycheck-error-list-make-number-cell (number face)
+ "Make a table cell for a NUMBER with FACE.
+
+Convert NUMBER to string, fontify it with FACE and return the
+string with attached text properties."
+ (flycheck-error-list-make-cell
+ (if (numberp number) (number-to-string number) "")
+ face))
+
+(defun flycheck-error-list-make-last-column (message checker)
+ "Compute contents of the last error list cell.
+
+MESSAGE and CHECKER are displayed in a single column to allow the
+message to stretch arbitrarily far."
+ (let ((checker-name (propertize (symbol-name checker)
+ 'face 'flycheck-error-list-checker-name)))
+ (format (propertize "%s (%s)" 'face 'default)
+ (flycheck-flush-multiline-message message)
+ checker-name)))
+
+(defun flycheck-error-list-make-entry (error)
+ "Make a table cell for the given ERROR.
+
+Return a list with the contents of the table cell."
+ (let* ((level (flycheck-error-level error))
+ (level-face (flycheck-error-level-error-list-face level))
+ (line (flycheck-error-line error))
+ (column (flycheck-error-column error))
+ (message (or (flycheck-error-message error)
+ (format "Unknown %s" (symbol-name level))))
+ (id (flycheck-error-id error))
+ (checker (flycheck-error-checker error)))
+ (list error
+ (vector (flycheck-error-list-make-number-cell
+ line 'flycheck-error-list-line-number)
+ (flycheck-error-list-make-number-cell
+ column 'flycheck-error-list-column-number)
+ (flycheck-error-list-make-cell
+ (symbol-name (flycheck-error-level error)) level-face)
+ (flycheck-error-list-make-cell
+ (if id (format "%s" id) "")
+ 'flycheck-error-list-id)
+ (flycheck-error-list-make-cell
+ (flycheck-error-list-make-last-column message checker))))))
+
+(defun flycheck-compute-message-column-offset ()
+ "Compute the amount of space to use in `flycheck-flush-multiline-message'."
+ (let* ((widths (seq-map (lambda (fmt)
+ (pcase-let* ((`(,name ,width _ ,props) fmt)
+ (padding (plist-get props :pad-right)))
+ (cons name (+ width (or padding 1)))))
+ tabulated-list-format))
+ (before-msg (seq-take-while (lambda (fmt)
+ (not (string= (car fmt) "Message")))
+ widths)))
+ (apply #'+ tabulated-list-padding (seq-map #'cdr before-msg))))
+
+(defun flycheck-flush-multiline-message (msg)
+ "Prepare error message MSG for display in the error list.
+
+Prepend all lines of MSG except the first with enough space to
+ensure that they line up properly once the message is displayed."
+ (let* ((msg-offset (flycheck-compute-message-column-offset))
+ (spc (propertize " " 'display `(space . (:width ,msg-offset))))
+ (rep (concat "\\1" spc "\\2")))
+ (replace-regexp-in-string "\\([\r\n]+\\)\\(.\\)" rep msg)))
+
+(defun flycheck-error-list-current-errors ()
+ "Read the list of errors in `flycheck-error-list-source-buffer'."
+ (when (buffer-live-p flycheck-error-list-source-buffer)
+ (buffer-local-value 'flycheck-current-errors
+ flycheck-error-list-source-buffer)))
+
+(defun flycheck-error-list-entries ()
+ "Create the entries for the error list."
+ (-when-let* ((errors (flycheck-error-list-current-errors))
+ (filtered (flycheck-error-list-apply-filter errors)))
+ (seq-map #'flycheck-error-list-make-entry filtered)))
+
+(defun flycheck-error-list-entry-< (entry1 entry2)
+ "Determine whether ENTRY1 is before ENTRY2 by location.
+
+See `flycheck-error-<'."
+ (flycheck-error-< (car entry1) (car entry2)))
+
+(defun flycheck-error-list-entry-level-< (entry1 entry2)
+ "Determine whether ENTRY1 is before ENTRY2 by level.
+
+See `flycheck-error-level-<'."
+ (not (flycheck-error-level-< (car entry1) (car entry2))))
+
+(defvar flycheck-error-list-mode-line-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map [mode-line mouse-1]
+ #'flycheck-error-list-mouse-switch-to-source)
+ map)
+ "Keymap for error list mode line.")
+
+(defun flycheck-error-list-propertized-source-name ()
+ "Get the name of the current source buffer for the mode line.
+
+Propertize the name of the current source buffer for use in the
+mode line indication of `flycheck-error-list-mode'."
+ (let ((name (replace-regexp-in-string
+ (rx "%") "%%"
+ (buffer-name flycheck-error-list-source-buffer)
+ 'fixed-case 'literal)))
+ (propertize name 'face 'mode-line-buffer-id
+ 'mouse-face 'mode-line-highlight
+ 'help-echo "mouse-1: switch to source"
+ 'local-map flycheck-error-list-mode-line-map)))
+
+(defun flycheck-error-list-mouse-switch-to-source (event)
+ "Switch to the error list source buffer of the EVENT window."
+ (interactive "e")
+ (save-selected-window
+ (when (eventp event)
+ (select-window (posn-window (event-start event))))
+ (when (buffer-live-p flycheck-error-list-source-buffer)
+ (switch-to-buffer flycheck-error-list-source-buffer))))
+
+(defun flycheck-get-error-list-window-list (&optional all-frames)
+ "Get all windows displaying the error list.
+
+ALL-FRAMES specifies the frames to consider, as in
+`get-buffer-window-list'."
+ (-when-let (buf (get-buffer flycheck-error-list-buffer))
+ (get-buffer-window-list buf nil all-frames)))
+
+(defun flycheck-get-error-list-window (&optional all-frames)
+ "Get a window displaying the error list, or nil if none.
+
+ALL-FRAMES specifies the frames to consider, as in
+`get-buffer-window'."
+ (-when-let (buf (get-buffer flycheck-error-list-buffer))
+ (get-buffer-window buf all-frames)))
+
+(defun flycheck-error-list-recenter-at (pos)
+ "Recenter the error list at POS."
+ (dolist (window (flycheck-get-error-list-window-list t))
+ (with-selected-window window
+ (goto-char pos)
+ (recenter))))
+
+(defun flycheck-error-list-refresh ()
+ "Refresh the current error list.
+
+Add all errors currently reported for the current
+`flycheck-error-list-source-buffer', and recenter the error
+list."
+ ;; We only refresh the error list, when it is visible in a window, and we
+ ;; select this window while reverting, because Tabulated List mode attempts to
+ ;; recenter the error at the old location, so it must have the proper window
+ ;; selected.
+ (-when-let (window (flycheck-get-error-list-window t))
+ (with-selected-window window
+ (revert-buffer))
+ (run-hooks 'flycheck-error-list-after-refresh-hook)
+ (let ((preserve-pos (eq (current-buffer)
+ (get-buffer flycheck-error-list-buffer))))
+ ;; If the error list is the current buffer, don't recenter when
+ ;; highlighting
+ (flycheck-error-list-highlight-errors preserve-pos))))
+
+(defun flycheck-error-list-mode-line-filter-indicator ()
+ "Create a string representing the current error list filter."
+ (if flycheck-error-list-minimum-level
+ (format " [>= %s]" flycheck-error-list-minimum-level)
+ ""))
+
+(defun flycheck-error-list-set-filter (level)
+ "Restrict the error list to errors at level LEVEL or higher.
+
+LEVEL is either an error level symbol, or nil, to remove the filter."
+ (interactive
+ (list (read-flycheck-error-level
+ "Minimum error level (errors at lower levels will be hidden): ")))
+ (when (and level (not (flycheck-error-level-p level)))
+ (user-error "Invalid level: %s" level))
+ (-when-let (buf (get-buffer flycheck-error-list-buffer))
+ (with-current-buffer buf
+ (setq-local flycheck-error-list-minimum-level level))
+ (flycheck-error-list-refresh)
+ (flycheck-error-list-recenter-at (point-min))))
+
+(defun flycheck-error-list-reset-filter ()
+ "Remove filters and show all errors in the error list."
+ (interactive)
+ (kill-local-variable 'flycheck-error-list-minimum-level))
+
+(defun flycheck-error-list-apply-filter (errors)
+ "Filter ERRORS according to `flycheck-error-list-minimum-level'."
+ (-if-let* ((min-level flycheck-error-list-minimum-level)
+ (min-severity (flycheck-error-level-severity min-level)))
+ (seq-filter (lambda (err) (>= (flycheck-error-level-severity
+ (flycheck-error-level err))
+ min-severity))
+ errors)
+ errors))
+
+(defun flycheck-error-list-goto-error (&optional pos)
+ "Go to the location of the error at POS in the error list.
+
+POS defaults to `point'."
+ (interactive)
+ (-when-let* ((error (tabulated-list-get-id pos))
+ (buffer (flycheck-error-buffer error)))
+ (when (buffer-live-p buffer)
+ (if (eq (window-buffer) (get-buffer flycheck-error-list-buffer))
+ ;; When called from within the error list, keep the error list,
+ ;; otherwise replace the current buffer.
+ (pop-to-buffer buffer 'other-window)
+ (switch-to-buffer buffer))
+ (let ((pos (flycheck-error-pos error)))
+ (unless (eq (goto-char pos) (point))
+ ;; If widening gets in the way of moving to the right place, remove it
+ ;; and try again
+ (widen)
+ (goto-char pos)))
+ ;; Re-highlight the errors
+ (flycheck-error-list-highlight-errors 'preserve-pos))))
+
+(defun flycheck-error-list-next-error-pos (pos &optional n)
+ "Starting from POS get the N'th next error in the error list.
+
+N defaults to 1. If N is negative, search for the previous error
+instead.
+
+Get the beginning position of the N'th next error from POS, or
+nil, if there is no next error."
+ (let ((n (or n 1)))
+ (if (>= n 0)
+ ;; Search forward
+ (while (and pos (/= n 0))
+ (setq n (1- n))
+ (setq pos (next-single-property-change pos 'tabulated-list-id)))
+ ;; Search backwards
+ (while (/= n 0)
+ (setq n (1+ n))
+ ;; We explicitly give the limit here to explicitly have the minimum
+ ;; point returned, to be able to move to the first error (which starts
+ ;; at `point-min')
+ (setq pos (previous-single-property-change pos 'tabulated-list-id
+ nil (point-min)))))
+ pos))
+
+(defun flycheck-error-list-previous-error (n)
+ "Go to the N'th previous error in the error list."
+ (interactive "P")
+ (flycheck-error-list-next-error (- (or n 1))))
+
+(defun flycheck-error-list-next-error (n)
+ "Go to the N'th next error in the error list."
+ (interactive "P")
+ (let ((pos (flycheck-error-list-next-error-pos (point) n)))
+ (when (and pos (/= pos (point)))
+ (goto-char pos)
+ (save-selected-window
+ ;; Keep the error list selected, so that the user can navigate errors by
+ ;; repeatedly pressing n/p, without having to re-select the error list
+ ;; window.
+ (flycheck-error-list-goto-error)))))
+
+(defvar-local flycheck-error-list-highlight-overlays nil
+ "Error highlight overlays in the error list buffer.")
+(put 'flycheck-error-list-highlight-overlays 'permanent-local t)
+
+(defun flycheck-error-list-highlight-errors (&optional preserve-pos)
+ "Highlight errors in the error list.
+
+Highlight all errors in the error lists that are at point in the
+source buffer, and on the same line as point. Then recenter the
+error list to the highlighted error, unless PRESERVE-POS is
+non-nil."
+ (when (get-buffer flycheck-error-list-buffer)
+ (let ((current-errors (flycheck-overlay-errors-in (line-beginning-position)
+ (line-end-position))))
+ (with-current-buffer flycheck-error-list-buffer
+ (let ((old-overlays flycheck-error-list-highlight-overlays)
+ (min-point (point-max))
+ (max-point (point-min)))
+ ;; Display the new overlays first, to avoid re-display flickering
+ (setq flycheck-error-list-highlight-overlays nil)
+ (when current-errors
+ (let ((next-error-pos (point-min)))
+ (while next-error-pos
+ (let* ((beg next-error-pos)
+ (end (flycheck-error-list-next-error-pos beg))
+ (err (tabulated-list-get-id beg)))
+ (when (member err current-errors)
+ (setq min-point (min min-point beg)
+ max-point (max max-point beg))
+ (let ((ov (make-overlay beg
+ ;; Extend overlay to the beginning of
+ ;; the next line, to highlight the
+ ;; whole line
+ (or end (point-max)))))
+ (push ov flycheck-error-list-highlight-overlays)
+ (setf (overlay-get ov 'flycheck-error-highlight-overlay)
+ t)
+ (setf (overlay-get ov 'face)
+ 'flycheck-error-list-highlight)))
+ (setq next-error-pos end)))))
+ ;; Delete the old overlays
+ (seq-do #'delete-overlay old-overlays)
+ (when (and (not preserve-pos) current-errors)
+ ;; Move point to the middle error
+ (goto-char (+ min-point (/ (- max-point min-point) 2)))
+ (beginning-of-line)
+ ;; And recenter the error list at this position
+ (flycheck-error-list-recenter-at (point))))))))
+
+(defun flycheck-list-errors ()
+ "Show the error list for the current buffer."
+ (interactive)
+ (unless flycheck-mode
+ (user-error "Flycheck mode not enabled"))
+ ;; Create and initialize the error list
+ (unless (get-buffer flycheck-error-list-buffer)
+ (with-current-buffer (get-buffer-create flycheck-error-list-buffer)
+ (flycheck-error-list-mode)))
+ (flycheck-error-list-set-source (current-buffer))
+ ;; Reset the error filter
+ (flycheck-error-list-reset-filter)
+ ;; Show the error list in a window, and re-select the old window
+ (display-buffer flycheck-error-list-buffer)
+ ;; Finally, refresh the error list to show the most recent errors
+ (flycheck-error-list-refresh))
+
+(defalias 'list-flycheck-errors 'flycheck-list-errors)
+
+\f
+;;; Displaying errors in the current buffer
+(defun flycheck-display-errors (errors)
+ "Display ERRORS using `flycheck-display-errors-function'."
+ (when flycheck-display-errors-function
+ (funcall flycheck-display-errors-function errors)))
+
+(defvar-local flycheck-display-error-at-point-timer nil
+ "Timer to automatically show the error at point in minibuffer.")
+
+(defun flycheck-cancel-error-display-error-at-point-timer ()
+ "Cancel the error display timer for the current buffer."
+ (when flycheck-display-error-at-point-timer
+ (cancel-timer flycheck-display-error-at-point-timer)
+ (setq flycheck-display-error-at-point-timer nil)))
+
+(defun flycheck-display-error-at-point ()
+ "Display the all error messages at point in minibuffer."
+ (interactive)
+ ;; This function runs from a timer, so we must take care to not ignore any
+ ;; errors
+ (with-demoted-errors "Flycheck error display error: %s"
+ (flycheck-cancel-error-display-error-at-point-timer)
+ (when flycheck-mode
+ (-when-let (errors (flycheck-overlay-errors-at (point)))
+ (flycheck-display-errors errors)))))
+
+(defun flycheck-display-error-at-point-soon ()
+ "Display the first error message at point in minibuffer delayed."
+ (flycheck-cancel-error-display-error-at-point-timer)
+ (when (flycheck-overlays-at (point))
+ (setq flycheck-display-error-at-point-timer
+ (run-at-time flycheck-display-errors-delay nil 'flycheck-display-error-at-point))))
+
+\f
+;;; Functions to display errors
+(defconst flycheck-error-message-buffer "*Flycheck error messages*"
+ "The name of the buffer to show long error messages in.")
+
+(defun flycheck-error-message-buffer ()
+ "Get the buffer object to show long error messages in.
+
+Get the buffer named by variable `flycheck-error-message-buffer',
+or nil if the buffer does not exist."
+ (get-buffer flycheck-error-message-buffer))
+
+(defun flycheck-may-use-echo-area-p ()
+ "Determine whether the echo area may be used.
+
+The echo area may be used if the cursor is not in the echo area,
+and if the echo area is not occupied by minibuffer input."
+ (not (or cursor-in-echo-area (active-minibuffer-window))))
+
+(defun flycheck-display-error-messages (errors)
+ "Display the messages of ERRORS.
+
+Concatenate all non-nil messages of ERRORS separated by empty
+lines, and display them with `display-message-or-buffer', which
+shows the messages either in the echo area or in a separate
+buffer, depending on the number of lines. See Info
+node `(elisp)Displaying Messages' for more information.
+
+In the latter case, show messages in
+`flycheck-error-message-buffer'."
+ (when (and errors (flycheck-may-use-echo-area-p))
+ (let ((messages (seq-map #'flycheck-error-format-message-and-id errors)))
+ (display-message-or-buffer (string-join messages "\n\n")
+ flycheck-error-message-buffer
+ 'not-this-window))))
+
+(defun flycheck-display-error-messages-unless-error-list (errors)
+ "Show messages of ERRORS unless the error list is visible.
+
+Like `flycheck-display-error-messages', but only if the error
+list (see `flycheck-list-errors') is not visible in any window in
+the current frame."
+ (unless (flycheck-get-error-list-window 'current-frame)
+ (flycheck-display-error-messages errors)))
+
+(defun flycheck-hide-error-buffer ()
+ "Hide the Flycheck error buffer if necessary.
+
+Hide the error buffer if there is no error under point."
+ (-when-let* ((buffer (flycheck-error-message-buffer))
+ (window (get-buffer-window buffer)))
+ (unless (flycheck-overlays-at (point))
+ ;; save-selected-window prevents `quit-window' from changing the current
+ ;; buffer (see https://github.com/flycheck/flycheck/issues/648).
+ (save-selected-window
+ (quit-window nil window)))))
+
+\f
+;;; Working with errors
+(defun flycheck-copy-errors-as-kill (pos &optional formatter)
+ "Copy each error at POS into kill ring, using FORMATTER.
+
+FORMATTER is a function to turn an error into a string,
+defaulting to `flycheck-error-message'.
+
+Interactively, use `flycheck-error-format-message-and-id' as
+FORMATTER with universal prefix arg, and `flycheck-error-id' with
+normal prefix arg, i.e. copy the message and the ID with
+universal prefix arg, and only the id with normal prefix arg."
+ (interactive (list (point)
+ (pcase current-prefix-arg
+ ((pred not) #'flycheck-error-message)
+ ((pred consp) #'flycheck-error-format-message-and-id)
+ (_ #'flycheck-error-id))))
+ (let ((messages (delq nil (seq-map (or formatter #'flycheck-error-message)
+ (flycheck-overlay-errors-at pos)))))
+ (when messages
+ (seq-do #'kill-new (reverse messages))
+ (message (string-join messages "\n")))))
+
+\f
+;;; Syntax checkers using external commands
+(defun flycheck-command-argument-p (arg)
+ "Check whether ARG is a valid command argument."
+ (pcase arg
+ ((pred stringp) t)
+ ((or `source `source-inplace `source-original) t)
+ ((or `temporary-directory `temporary-file-name) t)
+ (`null-device t)
+ (`(config-file ,option-name ,config-file-var)
+ (and (stringp option-name)
+ (symbolp config-file-var)))
+ (`(config-file ,option-name ,config-file-var ,prepender)
+ (and (stringp option-name)
+ (symbolp config-file-var)
+ (symbolp prepender)))
+ (`(,(or `option `option-list) ,option-name ,option-var)
+ (and (stringp option-name)
+ (symbolp option-var)))
+ (`(,(or `option `option-list) ,option-name ,option-var ,prepender)
+ (and (stringp option-name)
+ (symbolp option-var)
+ (symbolp prepender)))
+ (`(,(or `option `option-list) ,option-name ,option-var ,prepender ,filter)
+ (and (stringp option-name)
+ (symbolp option-var)
+ (symbolp prepender)
+ (symbolp filter)))
+ (`(option-flag ,option-name ,option-var)
+ (and (stringp option-name)
+ (symbolp option-var)))
+ (`(eval ,_) t)
+ (_ nil)))
+
+;;;###autoload
+(defun flycheck-define-command-checker (symbol docstring &rest properties)
+ "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.
+
+ 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."
+ (declare (indent 1)
+ (doc-string 2))
+ (dolist (prop '(:start :interrupt :print-doc))
+ (when (plist-get properties prop)
+ (error "%s not allowed in definition of command syntax checker %s"
+ prop symbol)))
+
+ (unless (plist-get properties :error-filter)
+ ;; Default to `flycheck-sanitize-errors' as error filter
+ (setq properties (plist-put properties :error-filter
+ #'flycheck-sanitize-errors)))
+ (let ((verify-fn (plist-get properties :verify)))
+ (setq properties
+ (plist-put properties :verify
+ (lambda (checker)
+ (append (flycheck-verify-command-checker checker)
+ (and verify-fn
+ (funcall verify-fn checker)))))))
+
+ (let ((command (plist-get properties :command))
+ (patterns (plist-get properties :error-patterns))
+ (parser (or (plist-get properties :error-parser)
+ #'flycheck-parse-with-patterns))
+ (predicate (plist-get properties :predicate))
+ (standard-input (plist-get properties :standard-input)))
+
+ (unless command
+ (error "Missing :command in syntax checker %s" symbol))
+ (unless (stringp (car command))
+ (error "Command executable for syntax checker %s must be a string: %S"
+ symbol (car command)))
+ (dolist (arg (cdr command))
+ (unless (flycheck-command-argument-p arg)
+ (error "Invalid command argument %S in syntax checker %s" arg symbol)))
+ (when (and (eq parser 'flycheck-parse-with-patterns)
+ (not patterns))
+ (error "Missing :error-patterns in syntax checker %s" symbol))
+
+ (setq properties
+ ;; Construct a predicate that checks whether the executable exists, to
+ ;; guard against syntax checker tools which are not installed
+ (plist-put properties :predicate
+ (lambda ()
+ (and (flycheck-find-checker-executable symbol)
+ (or (not predicate) (funcall predicate))))))
+
+ (apply #'flycheck-define-generic-checker symbol docstring
+ :start #'flycheck-start-command-checker
+ :interrupt #'flycheck-interrupt-command-checker
+ :print-doc #'flycheck-command-checker-print-doc
+ properties)
+
+ ;; Pre-compile all errors patterns into strings, so that we don't need to do
+ ;; that on each error parse
+ (let ((patterns (seq-map (lambda (p)
+ (cons (flycheck-rx-to-string `(and ,@(cdr p))
+ 'no-group)
+ (car p)))
+ patterns)))
+ (pcase-dolist (`(,prop . ,value)
+ `((command . ,command)
+ (error-parser . ,parser)
+ (error-patterns . ,patterns)
+ (standard-input . ,standard-input)))
+ (setf (flycheck-checker-get symbol prop) value)))))
+
+(eval-and-compile
+ ;; Make this function available during byte-compilation, since we need it
+ ;; at macro expansion of `flycheck-def-executable-var'.
+ (defun flycheck-checker-executable-variable (checker)
+ "Get the executable variable of CHECKER.
+
+The executable variable is named `flycheck-CHECKER-executable'."
+ (intern (format "flycheck-%s-executable" checker))))
+
+(defun flycheck-checker-default-executable (checker)
+ "Get the default executable of CHECKER."
+ (car (flycheck-checker-get checker 'command)))
+
+(defun flycheck-checker-executable (checker)
+ "Get the command executable of CHECKER.
+
+The executable is either the value of the variable
+`flycheck-CHECKER-executable', or the default executable given in
+the syntax checker definition, if the variable is nil."
+ (let ((var (flycheck-checker-executable-variable checker)))
+ (or (and (boundp var) (symbol-value var))
+ (flycheck-checker-default-executable checker))))
+
+(defun flycheck-find-checker-executable (checker)
+ "Get the full path of the executbale of CHECKER.
+
+Return the full absolute path to the executable of CHECKER, or
+nil if the executable does not exist."
+ (funcall flycheck-executable-find (flycheck-checker-executable checker)))
+
+(defun flycheck-checker-arguments (checker)
+ "Get the command arguments of CHECKER."
+ (cdr (flycheck-checker-get checker 'command)))
+
+(defun flycheck-substitute-argument (arg checker)
+ "Substitute ARG for CHECKER.
+
+Return a list of real arguments for the executable of CHECKER,
+substituted for the symbolic argument ARG. Single arguments,
+e.g. if ARG is a literal strings, are wrapped in a list.
+
+ARG may be one of the following forms:
+
+STRING
+ Return ARG unchanged.
+
+`source', `source-inplace'
+ Create a temporary file to check and return its path. With
+ `source-inplace' create the temporary file in the same
+ directory as the original file. The value of
+ `flycheck-temp-prefix' is used as prefix of the file name.
+
+ With `source', try to retain the non-directory component of
+ the buffer's file name in the temporary file.
+
+ `source' is the preferred way to pass the input file to a
+ syntax checker. `source-inplace' should only be used if the
+ syntax checker needs other files from the source directory,
+ such as include files in C.
+
+`source-original'
+ Return the path of the actual file to check, or an empty
+ string if the buffer has no file name.
+
+ Note that the contents of the file may not be up to date
+ with the contents of the buffer to check. Do not use this
+ as primary input to a checker, unless absolutely necessary.
+
+ When using this symbol as primary input to the syntax
+ checker, add `flycheck-buffer-saved-p' to the `:predicate'.
+
+`temporary-directory'
+ Create a unique temporary directory and return its path.
+
+`temporary-file-name'
+ Return a unique temporary filename. The file is *not*
+ created.
+
+ To ignore the output of syntax checkers, try `null-device'
+ first.
+
+`null-device'
+ Return the value of `null-device', i.e the system null
+ device.
+
+ Use this option to ignore the output of a syntax checker.
+ If the syntax checker cannot handle the null device, or
+ won't write to an existing file, try `temporary-file-name'
+ instead.
+
+`(config-file OPTION VARIABLE [PREPEND-FN])'
+ Search the configuration file bound to VARIABLE with
+ `flycheck-locate-config-file' and return a list of arguments
+ that pass this configuration file to the syntax checker, or
+ nil if the configuration file was not found.
+
+ PREPEND-FN is called with the OPTION and the located
+ configuration file, and should return OPTION prepended
+ before the file, either a string or as list. If omitted,
+ PREPEND-FN defaults to `list'.
+
+`(option OPTION VARIABLE [PREPEND-FN [FILTER]])'
+ Retrieve the value of VARIABLE and return a list of
+ arguments that pass this value as value for OPTION to the
+ syntax checker.
+
+ PREPEND-FN is called with the OPTION and the value of
+ VARIABLE, and should return OPTION prepended before the
+ file, either a string or as list. If omitted, PREPEND-FN
+ defaults to `list'.
+
+ FILTER is an optional function to be applied to the value of
+ VARIABLE before prepending. This function must return nil
+ or a string. In the former case, return nil. In the latter
+ case, return a list of arguments as described above.
+
+`(option-list OPTION VARIABLE [PREPEND-FN [FILTER]])'
+ Retrieve the value of VARIABLE, which must be a list,
+ and prepend OPTION before each item in this list, using
+ PREPEND-FN.
+
+ PREPEND-FN is called with the OPTION and each item of the
+ list as second argument, and should return OPTION prepended
+ before the item, either as string or as list. If omitted,
+ PREPEND-FN defaults to `list'.
+
+ FILTER is an optional function to be applied to each item in
+ the list before prepending OPTION. It shall return the
+ option value for each item as string, or nil, if the item is
+ to be ignored.
+
+`(option-flag OPTION VARIABLE)'
+ Retrieve the value of VARIABLE and return OPTION, if the
+ value is non-nil. Otherwise return nil.
+
+`(eval FORM)'
+ Return the result of evaluating FORM in the buffer to be
+ checked. FORM must either return a string or a list of
+ strings, or nil to indicate that nothing should be
+ substituted for CELL. For all other return types, signal an
+ error
+
+ _No_ further substitutions are performed, neither in FORM
+ before it is evaluated, nor in the result of evaluating
+ FORM.
+
+In all other cases, signal an error.
+
+Note that substitution is *not* recursive. No symbols or cells
+are substituted within the body of cells!"
+ (pcase arg
+ ((pred stringp) (list arg))
+ (`source
+ (list (flycheck-save-buffer-to-temp #'flycheck-temp-file-system)))
+ (`source-inplace
+ (list (flycheck-save-buffer-to-temp #'flycheck-temp-file-inplace)))
+ (`source-original (list (or (buffer-file-name) "")))
+ (`temporary-directory (list (flycheck-temp-dir-system)))
+ (`temporary-file-name
+ (let ((directory (flycheck-temp-dir-system)))
+ (list (make-temp-name (expand-file-name "flycheck" directory)))))
+ (`null-device (list null-device))
+ (`(config-file ,option-name ,file-name-var)
+ (-when-let* ((value (symbol-value file-name-var))
+ (file-name (flycheck-locate-config-file value checker)))
+ (flycheck-prepend-with-option option-name (list file-name))))
+ (`(config-file ,option-name ,file-name-var ,prepend-fn)
+ (-when-let* ((value (symbol-value file-name-var))
+ (file-name (flycheck-locate-config-file value checker)))
+ (flycheck-prepend-with-option option-name (list file-name) prepend-fn)))
+ (`(option ,option-name ,variable)
+ (-when-let (value (symbol-value variable))
+ (unless (stringp value)
+ (error "Value %S of %S for option %s is not a string"
+ value variable option-name))
+ (flycheck-prepend-with-option option-name (list value))))
+ (`(option ,option-name ,variable ,prepend-fn)
+ (-when-let (value (symbol-value variable))
+ (unless (stringp value)
+ (error "Value %S of %S for option %s is not a string"
+ value variable option-name))
+ (flycheck-prepend-with-option option-name (list value) prepend-fn)))
+ (`(option ,option-name ,variable ,prepend-fn ,filter)
+ (-when-let (value (funcall filter (symbol-value variable)))
+ (unless (stringp value)
+ (error "Value %S of %S (filter: %S) for option %s is not a string"
+ value variable filter option-name))
+ (flycheck-prepend-with-option option-name (list value) prepend-fn)))
+ (`(option-list ,option-name ,variable)
+ (let ((value (symbol-value variable)))
+ (unless (and (listp value) (seq-every-p #'stringp value))
+ (error "Value %S of %S for option %S is not a list of strings"
+ value variable option-name))
+ (flycheck-prepend-with-option option-name value)))
+ (`(option-list ,option-name ,variable ,prepend-fn)
+ (let ((value (symbol-value variable)))
+ (unless (and (listp value) (seq-every-p #'stringp value))
+ (error "Value %S of %S for option %S is not a list of strings"
+ value variable option-name))
+ (flycheck-prepend-with-option option-name value prepend-fn)))
+ (`(option-list ,option-name ,variable ,prepend-fn ,filter)
+ (let ((value (delq nil (seq-map filter (symbol-value variable)))))
+ (unless (and (listp value) (seq-every-p #'stringp value))
+ (error "Value %S of %S for option %S is not a list of strings"
+ value variable option-name))
+ (flycheck-prepend-with-option option-name value prepend-fn)))
+ (`(option-flag ,option-name ,variable)
+ (when (symbol-value variable)
+ (list option-name)))
+ (`(eval ,form)
+ (let ((result (eval form)))
+ (cond
+ ((and (listp result) (seq-every-p #'stringp result)) result)
+ ((stringp result) (list result))
+ (t (error "Invalid result from evaluation of %S: %S" form result)))))
+ (_ (error "Unsupported argument %S" arg))))
+
+(defun flycheck-checker-substituted-arguments (checker)
+ "Get the substituted arguments of a CHECKER.
+
+Substitute each argument of CHECKER using
+`flycheck-substitute-argument'. This replaces any special
+symbols in the command."
+ (apply #'append
+ (seq-map (lambda (arg) (flycheck-substitute-argument arg checker))
+ (flycheck-checker-arguments checker))))
+
+(defun flycheck--process-send-buffer-contents-chunked (process)
+ "Send contents of current buffer to PROCESS in small batches.
+
+Send the entire buffer to the standard input of PROCESS in chunks
+of 4096 characters. Chunking is done in Emacs Lisp, hence this
+function is probably far less efficient than
+`send-process-region'. Use only when required."
+ (let ((from (point-min)))
+ (while (< from (point-max))
+ (let ((to (min (+ from 4096) (point-max))))
+ (process-send-region process from to)
+ (setq from to)))))
+
+(defvar flycheck-chunked-process-input
+ ;; Chunk process output on Windows to work around
+ ;; https://github.com/flycheck/flycheck/issues/794 and
+ ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22344. The presence of
+ ;; `w32-pipe-buffer-size' denotes an Emacs version (> Emacs 25.1 )where pipe
+ ;; writes on Windows are fixed.
+ ;;
+ ;; TODO: Remove option and chunking when dropping Emacs 24 support, see
+ ;; https://github.com/flycheck/flycheck/issues/856
+ (and (eq system-type 'windows-nt) (not (boundp 'w32-pipe-buffer-size)))
+ "If non-nil send process input in small chunks.
+
+If this variable is non-nil `flycheck-process-send-buffer' sends
+buffer contents in small chunks.
+
+Defaults to nil, except on Windows to work around Emacs bug
+#22344.")
+
+(defun flycheck-process-send-buffer (process)
+ "Send all contents of current buffer to PROCESS.
+
+Sends all contents of the current buffer to the standard input of
+PROCESS, and terminates standard input with EOF.
+
+If `flycheck-chunked-process-input' is non-nil, send buffer
+contents in chunks via
+`flycheck--process-send-buffer-contents-chunked', which see.
+Otherwise use `process-send-region' to send all contents at once
+and rely on Emacs' own buffering and chunking."
+ (save-restriction
+ (widen)
+ (if flycheck-chunked-process-input
+ (flycheck--process-send-buffer-contents-chunked process)
+ (process-send-region process (point-min) (point-max))))
+ (process-send-eof process))
+
+(defun flycheck-start-command-checker (checker callback)
+ "Start a command CHECKER with CALLBACK."
+ (let (process)
+ (condition-case err
+ (let* ((program (flycheck-find-checker-executable checker))
+ (args (flycheck-checker-substituted-arguments checker))
+ (command (funcall flycheck-command-wrapper-function
+ (cons program args)))
+ ;; Use pipes to receive output from the syntax checker. They are
+ ;; more efficient and more robust than PTYs, which Emacs uses by
+ ;; default, and since we don't need any job control features, we
+ ;; can easily use pipes.
+ (process-connection-type nil))
+ ;; We pass do not associate the process with any buffer, by
+ ;; passing nil for the BUFFER argument of `start-process'.
+ ;; Instead, we just remember the buffer being checked in a
+ ;; process property (see below). This neatly avoids all
+ ;; side-effects implied by attached a process to a buffer, which
+ ;; may cause conflicts with other packages.
+ ;;
+ ;; See https://github.com/flycheck/flycheck/issues/298 for an
+ ;; example for such a conflict.
+ (setq process (apply 'start-process (format "flycheck-%s" checker)
+ nil command))
+ (setf (process-sentinel process) #'flycheck-handle-signal)
+ (setf (process-filter process) #'flycheck-receive-checker-output)
+ (set-process-query-on-exit-flag process nil)
+ ;; Remember the syntax checker, the buffer and the callback
+ (process-put process 'flycheck-checker checker)
+ (process-put process 'flycheck-callback callback)
+ (process-put process 'flycheck-buffer (current-buffer))
+ ;; Track the temporaries created by argument substitution in the
+ ;; process itself, to get rid of the global state ASAP.
+ (process-put process 'flycheck-temporaries flycheck-temporaries)
+ (setq flycheck-temporaries nil)
+ ;; Send the buffer to the process on standard input, if enabled
+ (when (flycheck-checker-get checker 'standard-input)
+ (flycheck-process-send-buffer process))
+ ;; Return the process
+ process)
+ (error
+ ;; In case of error, clean up our resources, and report the error back to
+ ;; Flycheck
+ (flycheck-safe-delete-temporaries)
+ (when process
+ ;; No need to explicitly delete the temporary files of the process,
+ ;; because deleting runs the sentinel, which will delete them anyway.
+ (delete-process process))
+ (signal (car err) (cdr err))))))
+
+(defun flycheck-interrupt-command-checker (_checker process)
+ "Interrupt a PROCESS."
+ ;; Deleting the process always triggers the sentinel, which does the cleanup
+ (when process
+ (delete-process process)))
+
+(defun flycheck-command-checker-print-doc (checker)
+ "Print additional documentation for a command CHECKER."
+ (let ((executable (flycheck-checker-default-executable checker))
+ (config-file-var (flycheck-checker-get checker 'config-file-var))
+ (option-vars (seq-sort #'string<
+ (flycheck-checker-get checker 'option-vars))))
+ (princ "\n")
+
+ (let ((doc-start (with-current-buffer standard-output (point-max))))
+ ;; Track the start of our documentation so that we can re-indent it
+ ;; properly
+ (princ " This syntax checker executes \"")
+ (princ executable)
+ (princ "\"")
+ (when config-file-var
+ (princ ", using a configuration file from `")
+ (princ (symbol-name config-file-var))
+ (princ "'"))
+ (princ ". The executable can be overridden with `")
+ (princ (symbol-name (flycheck-checker-executable-variable checker)))
+ (princ "'.")
+
+ (with-current-buffer standard-output
+ (save-excursion
+ (fill-region-as-paragraph doc-start (point-max)))))
+ (princ "\n")
+ (when option-vars
+ (princ "\n This syntax checker can be configured with these options:\n\n")
+ (dolist (var option-vars)
+ (princ (format " * `%s'\n" var))))))
+
+(defun flycheck-verify-command-checker (checker)
+ "Verify a command CHECKER in the current buffer.
+
+Return a list of `flycheck-verification-result' objects for
+CHECKER."
+ (let ((executable (flycheck-find-checker-executable checker)))
+ (list
+ (flycheck-verification-result-new
+ :label "executable"
+ :message (if executable (format "Found at %s" executable) "Not found")
+ :face (if executable 'success '(bold error))))))
+
+\f
+;;; Process management for command syntax checkers
+(defun flycheck-receive-checker-output (process output)
+ "Receive a syntax checking PROCESS OUTPUT."
+ (push output (process-get process 'flycheck-pending-output)))
+
+(defun flycheck-get-output (process)
+ "Get the complete output of PROCESS."
+ (with-demoted-errors "Error while retrieving process output: %S"
+ (let ((pending-output (process-get process 'flycheck-pending-output)))
+ (apply #'concat (nreverse pending-output)))))
+
+(defun flycheck-handle-signal (process _event)
+ "Handle a signal from the syntax checking PROCESS.
+
+_EVENT is ignored."
+ (when (memq (process-status process) '(signal exit))
+ (let ((files (process-get process 'flycheck-temporaries))
+ (buffer (process-get process 'flycheck-buffer))
+ (callback (process-get process 'flycheck-callback)))
+ ;; Delete the temporary files
+ (seq-do #'flycheck-safe-delete files)
+ (when (buffer-live-p buffer)
+ (with-current-buffer buffer
+ (condition-case err
+ (pcase (process-status process)
+ (`signal
+ (funcall callback 'interrupted))
+ (`exit
+ (flycheck-finish-checker-process
+ (process-get process 'flycheck-checker)
+ (process-exit-status process)
+ files
+ (flycheck-get-output process) callback)))
+ ((debug error)
+ (funcall callback 'errored (error-message-string err)))))))))
+
+(defun flycheck-finish-checker-process
+ (checker exit-status files output callback)
+ "Finish a checker process from CHECKER with EXIT-STATUS.
+
+FILES is a list of files given as input to the checker. OUTPUT
+is the output of the syntax checker. CALLBACK is the status
+callback to use for reporting.
+
+Parse the OUTPUT and report an appropriate error status."
+ (let ((errors (flycheck-parse-output output checker (current-buffer))))
+ (when (and (/= exit-status 0) (not errors))
+ ;; Warn about a suspicious result from the syntax checker. We do right
+ ;; after parsing the errors, before filtering, because a syntax checker
+ ;; might report errors from other files (e.g. includes) even if there
+ ;; are no errors in the file being checked.
+ (funcall callback 'suspicious
+ (format "Checker %S returned non-zero exit code %s, but no errors from \
+output: %s\nChecker definition probably flawed." checker exit-status output)))
+ (funcall callback 'finished
+ ;; Fix error file names, by substituting them backwards from the
+ ;; temporaries
+ (seq-map (lambda (e) (flycheck-fix-error-filename e files))
+ errors))))
+
+\f
+;;; Executables of command checkers.
+(defmacro flycheck-def-executable-var (checker default-executable)
+ "Define the executable variable for CHECKER.
+
+DEFAULT-EXECUTABLE is the default executable. It is only used in
+the docstring of the variable.
+
+The variable is defined with `defcustom' in the
+`flycheck-executables' group. It's also defined to be risky as
+file-local variable, to avoid arbitrary executables being used
+for syntax checking."
+ (let ((executable-var (flycheck-checker-executable-variable checker)))
+ `(progn
+ (defcustom ,executable-var nil
+ ,(format "The executable of the %s syntax checker.
+
+Either a string containing the name or the path of the
+executable, or nil to use the default executable from the syntax
+checker declaration.
+
+The default executable is %S." checker default-executable)
+ :type '(choice (const :tag "Default executable" nil)
+ (string :tag "Name or path"))
+ :group 'flycheck-executables
+ :risky t))))
+
+(defun flycheck-set-checker-executable (checker &optional executable)
+ "Set the executable of CHECKER in the current buffer.
+
+CHECKER is a syntax checker symbol. EXECUTABLE is a string with
+the name of a executable or the path to an executable file, which
+is to be used as executable for CHECKER. If omitted or nil,
+reset the executable of CHECKER.
+
+Interactively, prompt for a syntax checker and an executable
+file, and set the executable of the selected syntax checker.
+With prefix arg, prompt for a syntax checker only, and reset the
+executable of the select checker to the default.
+
+Set the executable variable of CHECKER, that is,
+`flycheck-CHECKER-executable' to EXECUTABLE. Signal
+`user-error', if EXECUTABLE does not denote a command or an
+executable file.
+
+This command is intended for interactive use only. In Lisp, just
+`let'-bind the corresponding variable, or set it directly. Use
+`flycheck-checker-executable-variable' to obtain the executable
+variable symbol for a syntax checker."
+ (declare (interactive-only "Set the executable variable directly instead"))
+ (interactive
+ (let* ((checker (read-flycheck-checker "Syntax checker: "))
+ (default-executable (flycheck-checker-default-executable checker))
+ (executable (if current-prefix-arg
+ nil
+ (read-file-name "Executable: " nil default-executable
+ nil nil flycheck-executable-find))))
+ (list checker executable)))
+ (when (and executable (not (funcall flycheck-executable-find executable)))
+ (user-error "%s is no executable" executable))
+ (let ((variable (flycheck-checker-executable-variable checker)))
+ (set (make-local-variable variable) executable)))
+
+\f
+;;; Configuration files and options for command checkers
+(defun flycheck-register-config-file-var (var checkers)
+ "Register VAR as config file var for CHECKERS.
+
+CHECKERS is a single syntax checker or a list thereof."
+ (when (symbolp checkers)
+ (setq checkers (list checkers)))
+ (dolist (checker checkers)
+ (setf (flycheck-checker-get checker 'config-file-var) var)))
+
+;;;###autoload
+(defmacro flycheck-def-config-file-var (symbol checker &optional file-name
+ &rest custom-args)
+ "Define SYMBOL as config file variable for CHECKER, with default FILE-NAME.
+
+SYMBOL is declared as customizable variable using `defcustom', to
+provide a configuration file 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.
+
+Use this together with the `config-file' form in the `:command'
+argument to `flycheck-define-checker'."
+ ;; FIXME: We should allow multiple config files per checker as well as
+ ;; multiple checkers per config file
+ (declare (indent 3))
+ `(progn
+ (defcustom ,symbol ,file-name
+ ,(format "Configuration file for `%s'.
+
+If set to a string, locate the configuration file using the
+functions from `flycheck-locate-config-file-functions'. If the
+file is found pass it to the syntax checker as configuration
+file.
+
+If no configuration file is found, or if this variable is set to
+nil, invoke the syntax checker without a configuration file.
+
+Use this variable as file-local variable if you need a specific
+configuration file a buffer." checker)
+ :type '(choice (const :tag "No configuration file" nil)
+ (string :tag "File name or path"))
+ :group 'flycheck-config-files
+ ,@custom-args)
+ (flycheck-register-config-file-var ',symbol ',checker)))
+
+(defun flycheck-locate-config-file (filename checker)
+ "Locate the configuration file FILENAME for CHECKER.
+
+Locate the configuration file using
+`flycheck-locate-config-file-functions'.
+
+Return the absolute path of the configuration file, or nil if no
+configuration file was found."
+ (-when-let (filepath (run-hook-with-args-until-success
+ 'flycheck-locate-config-file-functions
+ filename checker))
+ (when (file-exists-p filepath)
+ filepath)))
+
+(defun flycheck-locate-config-file-by-path (filepath _checker)
+ "Locate a configuration file by a FILEPATH.
+
+If FILEPATH is a contains a path separator, expand it against the
+default directory and return it if it points to an existing file.
+Otherwise return nil.
+
+_CHECKER is ignored."
+ ;; If the path is just a plain file name, skip it.
+ (unless (string= (file-name-nondirectory filepath) filepath)
+ (let ((file-name (expand-file-name filepath)))
+ (and (file-exists-p file-name) file-name))))
+
+(defun flycheck-locate-config-file-ancestor-directories (filename _checker)
+ "Locate a configuration FILENAME in ancestor directories.
+
+If the current buffer has a file name, search FILENAME in the
+directory of the current buffer and all ancestors thereof (see
+`locate-dominating-file'). If the file is found, return its
+absolute path. Otherwise return nil.
+
+_CHECKER is ignored."
+ (-when-let* ((basefile (buffer-file-name))
+ (directory (locate-dominating-file basefile filename)))
+ (expand-file-name filename directory)))
+
+(defun flycheck-locate-config-file-home (filename _checker)
+ "Locate a configuration FILENAME in the home directory.
+
+Return the absolute path, if FILENAME exists in the user's home
+directory, or nil otherwise."
+ (let ((path (expand-file-name filename "~")))
+ (when (file-exists-p path)
+ path)))
+
+(seq-do (apply-partially #'custom-add-frequent-value
+ 'flycheck-locate-config-file-functions)
+ '(flycheck-locate-config-file-by-path
+ flycheck-locate-config-file-ancestor-directories
+ flycheck-locate-config-file-home))
+
+(defun flycheck-register-option-var (var checkers)
+ "Register an option VAR with CHECKERS.
+
+VAR is an option symbol, and CHECKERS a syntax checker symbol or
+a list thereof. Register VAR with all CHECKERS so that it
+appears in the help output."
+ (when (symbolp checkers)
+ (setq checkers (list checkers)))
+ (dolist (checker checkers)
+ (cl-pushnew var (flycheck-checker-get checker 'option-vars))))
+
+;;;###autoload
+(defmacro flycheck-def-option-var (symbol init-value checkers docstring
+ &rest custom-args)
+ "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'."
+ (declare (indent 3)
+ (doc-string 4))
+ `(progn
+ (defcustom ,symbol ,init-value
+ ,(concat docstring "
+
+This variable is an option for the following syntax checkers:
+
+"
+ (mapconcat (lambda (c) (format " - `%s'" c))
+ (if (symbolp checkers) (list checkers) checkers)
+ "\n"))
+ :group 'flycheck-options
+ ,@custom-args)
+ (flycheck-register-option-var ',symbol ',checkers)))
+
+(defun flycheck-option-int (value)
+ "Convert an integral option VALUE to a string.
+
+If VALUE is nil, return nil. Otherwise return VALUE converted to
+a string."
+ (and value (number-to-string value)))
+
+(defun flycheck-option-symbol (value)
+ "Convert a symbol option VALUE to string.
+
+If VALUE is nil return nil. Otherwise return VALUE converted to
+a string."
+ (and value (symbol-name value)))
+
+(defun flycheck-option-comma-separated-list (value &optional separator filter)
+ "Convert VALUE into a list separated by SEPARATOR.
+
+SEPARATOR is a string to separate items in VALUE, defaulting to
+\",\". FILTER is an optional function, which takes a single
+argument and returns either a string or nil.
+
+If VALUE is a list, apply FILTER to each item in VALUE, remove
+all nil items, and return a single string of all remaining items
+separated by SEPARATOR.
+
+Otherwise, apply FILTER to VALUE and return the result.
+SEPARATOR is ignored in this case."
+ (let ((filter (or filter #'identity))
+ (separator (or separator ",")))
+ (if (listp value)
+ (-when-let (value (delq nil (seq-map filter value)))
+ (string-join value separator))
+ (funcall filter value))))
+
+(defmacro flycheck-def-args-var (symbol checkers &rest custom-args)
+ "Define SYMBOL as argument variable for CHECKERS.
+
+SYMBOL is declared as customizable, risky and buffer-local
+variable using `defcustom' to provide an option for arbitrary
+arguments for the given syntax CHECKERS (either a single checker
+or a list of checkers). CUSTOM-ARGS is forwarded to `defcustom'.
+
+Use the `eval' form to splice this variable into the
+`:command'."
+ (declare (indent 2))
+ `(flycheck-def-option-var ,symbol nil ,checkers
+ "A list of additional command line arguments.
+
+The value of this variable is a list of strings with additional
+command line arguments."
+ :risky t
+ :type '(repeat (string :tag "Argument"))
+ ,@custom-args))
+
+\f
+;;; Command syntax checkers as compile commands
+(defun flycheck-checker-pattern-to-error-regexp (pattern)
+ "Convert PATTERN into an error regexp for compile.el.
+
+Return a list representing PATTERN, suitable as element in
+`compilation-error-regexp-alist'."
+ (let* ((regexp (car pattern))
+ (level (cdr pattern))
+ (level-no (flycheck-error-level-compilation-level level)))
+ (list regexp 1 2 3 level-no)))
+
+(defun flycheck-checker-compilation-error-regexp-alist (checker)
+ "Convert error patterns of CHECKER for use with compile.el.
+
+Return an alist of all error patterns of CHECKER, suitable for
+use with `compilation-error-regexp-alist'."
+ (seq-map #'flycheck-checker-pattern-to-error-regexp
+ (flycheck-checker-get checker 'error-patterns)))
+
+(defun flycheck-checker-shell-command (checker)
+ "Get a shell command for CHECKER.
+
+Perform substitution in the arguments of CHECKER, but with
+`flycheck-substitute-shell-argument'.
+
+Return the command of CHECKER as single string, suitable for
+shell execution."
+ ;; Note: Do NOT use `combine-and-quote-strings' here. Despite it's name it
+ ;; does not properly quote shell arguments, and actually breaks for special
+ ;; characters. See https://github.com/flycheck/flycheck/pull/522
+ (let* ((args (apply #'append
+ (seq-map (lambda (arg)
+ (if (memq arg '(source source-inplace source-original))
+ (list (buffer-file-name))
+ (flycheck-substitute-argument arg checker)))
+ (flycheck-checker-arguments checker))))
+ (command (mapconcat
+ #'shell-quote-argument
+ (funcall flycheck-command-wrapper-function
+ (cons (flycheck-checker-executable checker) args))
+ " ")))
+ (if (flycheck-checker-get checker 'standard-input)
+ ;; If the syntax checker expects the source from standard input add an
+ ;; appropriate shell redirection
+ (concat command " < " (shell-quote-argument (buffer-file-name)))
+ command)))
+
+(defun flycheck-compile-name (_name)
+ "Get a name for a Flycheck compilation buffer.
+
+_NAME is ignored."
+ (format "*Flycheck %s*" (buffer-file-name)))
+
+(defun flycheck-compile (checker)
+ "Run CHECKER via `compile'.
+
+CHECKER must be a valid syntax checker. Interactively, prompt
+for a syntax checker to run.
+
+Instead of highlighting errors in the buffer, this command pops
+up a separate buffer with the entire output of the syntax checker
+tool, just like `compile' (\\[compile])."
+ (interactive
+ (let ((default (flycheck-get-checker-for-buffer)))
+ (list (read-flycheck-checker "Run syntax checker as compile command: "
+ (when (flycheck-checker-get default 'command)
+ default)
+ 'command))))
+ (unless (flycheck-valid-checker-p checker)
+ (user-error "%S is not a valid syntax checker" checker))
+ (unless (buffer-file-name)
+ (user-error "Cannot compile buffers without backing file"))
+ (unless (flycheck-may-use-checker checker)
+ (user-error "Cannot use syntax checker %S in this buffer" checker))
+ (unless (flycheck-checker-executable checker)
+ (user-error "Cannot run checker %S as shell command" checker))
+ (let* ((command (flycheck-checker-shell-command checker))
+ (buffer (compilation-start command nil #'flycheck-compile-name)))
+ (with-current-buffer buffer
+ (setq-local compilation-error-regexp-alist
+ (flycheck-checker-compilation-error-regexp-alist checker)))))
+
+\f
+;;; General error parsing for command checkers
+(defun flycheck-parse-output (output checker buffer)
+ "Parse OUTPUT from CHECKER in BUFFER.
+
+OUTPUT is a string with the output from the checker symbol
+CHECKER. BUFFER is the buffer which was checked.
+
+Return the errors parsed with the error patterns of CHECKER."
+ (funcall (flycheck-checker-get checker 'error-parser) output checker buffer))
+
+(defun flycheck-fix-error-filename (err buffer-files)
+ "Fix the file name of ERR from BUFFER-FILES.
+
+Make the file name of ERR absolute. If the absolute file name of
+ERR is in BUFFER-FILES, replace it with the return value of the
+function `buffer-file-name'."
+ (flycheck-error-with-buffer err
+ (-when-let (filename (flycheck-error-filename err))
+ (when (seq-some (apply-partially #'flycheck-same-files-p
+ (expand-file-name filename))
+ buffer-files)
+ (setf (flycheck-error-filename err) (buffer-file-name)))))
+ err)
+
+\f
+;;; Error parsers for command syntax checkers
+(defun flycheck-parse-xml-region (beg end)
+ "Parse the xml region between BEG and END.
+
+Wrapper around `xml-parse-region' which transforms the return
+value of this function into one compatible to
+`libxml-parse-xml-region' by simply returning the first element
+from the node list."
+ (car (xml-parse-region beg end)))
+
+(defvar flycheck-xml-parser
+ (if (fboundp 'libxml-parse-xml-region)
+ 'libxml-parse-xml-region 'flycheck-parse-xml-region)
+ "Parse an xml string from a region.
+
+Use libxml if Emacs is built with libxml support. Otherwise fall
+back to `xml-parse-region', via `flycheck-parse-xml-region'.")
+
+(defun flycheck-parse-xml-string (xml)
+ "Parse an XML string.
+
+Return the document tree parsed from XML in the form `(ROOT ATTRS
+BODY...)'. ROOT is a symbol identifying the name of the root
+element. ATTRS is an alist of the attributes of the root node.
+BODY is zero or more body elements, either as strings (in case of
+text nodes) or as XML nodes, in the same for as the root node."
+ (with-temp-buffer
+ (insert xml)
+ (funcall flycheck-xml-parser (point-min) (point-max))))
+
+(defun flycheck-parse-checkstyle (output checker buffer)
+ "Parse Checkstyle errors from OUTPUT.
+
+Parse Checkstyle-like XML output. Use this error parser for
+checkers that have an option to output errors in this format.
+
+CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and
+the BUFFER that was checked respectively.
+
+See URL `http://checkstyle.sourceforge.net/' for information
+about Checkstyle."
+ (pcase (flycheck-parse-xml-string output)
+ (`(checkstyle ,_ . ,file-nodes)
+ (let (errors)
+ (dolist (node file-nodes)
+ (pcase node
+ (`(file ,file-attrs . ,error-nodes)
+ (dolist (node error-nodes)
+ (pcase node
+ (`(error ,error-attrs . ,_)
+ (let-alist error-attrs
+ (push (flycheck-error-new-at
+ (flycheck-string-to-number-safe .line)
+ (flycheck-string-to-number-safe .column)
+ (pcase .severity
+ (`"error" 'error)
+ (`"warning" 'warning)
+ (`"info" 'info)
+ ;; Default to error for unknown .severity
+ (_ 'error))
+ .message
+ :checker checker :id .source
+ :buffer buffer
+ :filename (cdr (assq 'name file-attrs)))
+ errors))))))))
+ (nreverse errors)))))
+
+(defun flycheck-parse-cppcheck (output checker buffer)
+ "Parse Cppcheck errors from OUTPUT.
+
+Parse Cppcheck XML v2 output.
+
+CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and
+the BUFFER that was checked respectively.
+
+See URL `http://cppcheck.sourceforge.net/' for more information
+about Cppcheck."
+ (pcase (flycheck-parse-xml-string output)
+ (`(results ,_ . ,body)
+ (let (errors)
+ (dolist (node body)
+ (pcase node
+ (`(errors ,_ . ,error-nodes)
+ (dolist (node error-nodes)
+ (pcase node
+ (`(error ,error-attrs . ,loc-nodes)
+ (let ((id (cdr (assq 'id error-attrs)))
+ (message (cdr (assq 'verbose error-attrs)))
+ (level (pcase (cdr (assq 'severity error-attrs))
+ (`"error" 'error)
+ (`"style" 'info)
+ (`"information" 'info)
+ (_ 'warning))))
+ (dolist (node loc-nodes)
+ (pcase node
+ (`(location ,loc-attrs . ,_)
+ (let-alist loc-attrs
+ (push (flycheck-error-new-at
+ (flycheck-string-to-number-safe .line)
+ nil
+ level message
+ :id id
+ :checker checker
+ :buffer buffer
+ :filename .file)
+ errors))))))))))))
+ (nreverse errors)))))
+
+(defun flycheck-parse-phpmd (output checker buffer)
+ "Parse phpmd errors from OUTPUT.
+
+CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and
+the BUFFER that was checked respectively.
+
+See URL `http://phpmd.org/' for more information about phpmd."
+ (pcase (flycheck-parse-xml-string output)
+ (`(pmd ,_ . ,body)
+ (let (errors)
+ (dolist (node body)
+ (pcase node
+ (`(file ,file-attrs . ,violation-nodes)
+ (let ((filename (cdr (assq 'name file-attrs))))
+ (dolist (node violation-nodes)
+ (pcase node
+ (`(violation ,vio-attrs ,(and message (pred stringp)))
+ (let-alist vio-attrs
+ ;; TODO: Map priority to an error level?
+ ;; TODO: Respect endline
+ (push
+ (flycheck-error-new-at
+ (flycheck-string-to-number-safe .beginline)
+ nil
+ 'warning (string-trim message)
+ :id .rule
+ :checker checker
+ :buffer buffer
+ :filename filename)
+ errors)))))))))
+ (nreverse errors)))))
+
+\f
+;;; Error parsing with regular expressions
+(defun flycheck-get-regexp (patterns)
+ "Create a single regular expression from PATTERNS."
+ (rx-to-string `(or ,@(seq-map (lambda (p) (list 'regexp (car p))) patterns))
+ 'no-group))
+
+(defun flycheck-tokenize-output-with-patterns (output patterns)
+ "Tokenize OUTPUT with PATTERNS.
+
+Split the output into error tokens, using all regular expressions
+from the error PATTERNS. An error token is simply a string
+containing a single error from OUTPUT. Such a token can then be
+parsed into a structured error by applying the PATTERNS again,
+see `flycheck-parse-errors-with-patterns'.
+
+Return a list of error tokens."
+ (let ((regexp (flycheck-get-regexp patterns))
+ (last-match 0)
+ errors)
+ (while (string-match regexp output last-match)
+ (push (match-string 0 output) errors)
+ (setq last-match (match-end 0)))
+ (reverse errors)))
+
+(defun flycheck-try-parse-error-with-pattern (err pattern checker)
+ "Try to parse a single ERR with a PATTERN for CHECKER.
+
+Return the parsed error if PATTERN matched ERR, or nil
+otherwise."
+ (let ((regexp (car pattern))
+ (level (cdr pattern)))
+ (when (string-match regexp err)
+ (let ((filename (match-string 1 err))
+ (line (match-string 2 err))
+ (column (match-string 3 err))
+ (message (match-string 4 err))
+ (id (match-string 5 err)))
+ (flycheck-error-new-at
+ (flycheck-string-to-number-safe line)
+ (flycheck-string-to-number-safe column)
+ level
+ (unless (string-empty-p message) message)
+ :id (unless (string-empty-p id) id)
+ :checker checker
+ :filename (if (or (null filename) (string-empty-p filename))
+ (buffer-file-name)
+ filename))))))
+
+(defun flycheck-parse-error-with-patterns (err patterns checker)
+ "Parse a gle ERR with error PATTERNS for CHECKER.
+
+Apply each pattern in PATTERNS to ERR, in the given order, and
+return the first parsed error."
+ ;; Try to parse patterns in the order of declaration to make sure that the
+ ;; first match wins.
+ (let (parsed-error)
+ (while (and patterns
+ (not (setq parsed-error
+ (flycheck-try-parse-error-with-pattern
+ err (car patterns) checker))))
+ (setq patterns (cdr patterns)))
+ parsed-error))
+
+(defun flycheck-parse-with-patterns (output checker buffer)
+ "Parse OUTPUT from CHECKER with error patterns.
+
+Uses the error patterns of CHECKER to tokenize the output and
+tries to parse each error token with all patterns, in the order
+of declaration. Hence an error is never matched twice by two
+different patterns. The pattern declared first always wins.
+
+_BUFFER is ignored.
+
+Return a list of parsed errors and warnings (as `flycheck-error'
+objects)."
+ (with-current-buffer buffer
+ (let ((patterns (flycheck-checker-get checker 'error-patterns)))
+ (seq-map (lambda (err)
+ (flycheck-parse-error-with-patterns err patterns checker))
+ (flycheck-tokenize-output-with-patterns output patterns)))))
+
+\f
+;;; Convenience definition of command-syntax checkers
+(defmacro flycheck-define-checker (symbol docstring &rest properties)
+ "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'."
+ (declare (indent 1)
+ (doc-string 2))
+ (let ((command (plist-get properties :command))
+ (parser (plist-get properties :error-parser))
+ (filter (plist-get properties :error-filter))
+ (predicate (plist-get properties :predicate))
+ (verify-fn (plist-get properties :verify)))
+
+ `(progn
+ (flycheck-def-executable-var ,symbol ,(car command))
+
+ (flycheck-define-command-checker ',symbol
+ ,docstring
+ :command ',command
+ ,@(when parser
+ `(:error-parser #',parser))
+ :error-patterns ',(plist-get properties :error-patterns)
+ ,@(when filter
+ `(:error-filter #',filter))
+ :modes ',(plist-get properties :modes)
+ ,@(when predicate
+ `(:predicate #',predicate))
+ :next-checkers ',(plist-get properties :next-checkers)
+ ,@(when verify-fn
+ `(:verify #',verify-fn))
+ :standard-input ',(plist-get properties :standard-input)))))
+
+\f
+;;; Built-in checkers
+(flycheck-def-args-var flycheck-gnat-args ada-gnat
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gnat-include-path nil ada-gnat
+ "A list of include directories for GNAT.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of gcc.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gnat-language-standard "2012" ada-gnat
+ "The language standard to use in GNAT.
+
+The value of this variable is either a string denoting a language
+standard, or nil, to use the default standard. When non-nil, pass
+the language standard via the `-std' option."
+ :type '(choice (const :tag "Default standard" nil)
+ (string :tag "Language standard"))
+ :safe #'stringp
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gnat-warnings
+ '("wa") ada-gnat
+ "A list of additional Ada warnings to enable in GNAT.
+
+The value of this variable is a list of strings, where each
+string is the name of a warning category to enable. By default,
+most optional warnings are recommended, as in `-gnata'.
+
+Refer to Info Node `(gnat_ugn_unw)Warning Message Control' for
+more information about GNAT warnings."
+ :type '(repeat :tag "Warnings" (string :tag "Warning name"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-define-checker ada-gnat
+ "An Ada syntax checker using GNAT.
+
+Uses the GNAT compiler from GCC. See URL
+`https://gcc.gnu.org/onlinedocs/gnat_ugn_unw/'."
+ :command ("gnatmake"
+ "-c" ; Just compile, don't bind
+ "-f" ; Force re-compilation
+ "-u" ; Compile the main file only
+ "-gnatf" ; Full error information
+ "-gnatef" ; Full source file name
+ "-D" temporary-directory
+ (option-list "-gnat" flycheck-gnat-warnings concat)
+ (option-list "-I" flycheck-gnat-include-path concat)
+ (option "-gnat" flycheck-gnat-language-standard concat)
+ (eval flycheck-gnat-args)
+ source)
+ :error-patterns
+ ((error line-start
+ (message "In file included from") " " (file-name) ":" line ":"
+ column ":"
+ line-end)
+ (info line-start (file-name) ":" line ":" column
+ ": note: " (message) line-end)
+ (warning line-start (file-name) ":" line ":" column
+ ": warning: " (message) line-end)
+ (error line-start (file-name) ":" line ":" column ;no specific error prefix in Ada
+ ": " (message) line-end))
+ :modes ada-mode)
+
+(flycheck-define-checker asciidoc
+ "A AsciiDoc syntax checker using the AsciiDoc compiler.
+
+See URL `http://www.methods.co.nz/asciidoc'."
+ :command ("asciidoc" "-o" null-device "-")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ "asciidoc: ERROR: <stdin>: Line " line ": " (message)
+ line-end)
+ (warning line-start
+ "asciidoc: WARNING: <stdin>: Line " line ": " (message)
+ line-end)
+ (info line-start
+ "asciidoc: DEPRECATED: <stdin>: Line " line ": " (message)
+ line-end))
+ :modes adoc-mode)
+
+(flycheck-def-args-var flycheck-clang-args c/c++-clang
+ :package-version '(flycheck . "0.22"))
+
+(flycheck-def-option-var flycheck-clang-blocks nil c/c++-clang
+ "Enable blocks in Clang.
+
+When non-nil, enable blocks in Clang with `-fblocks'. See URL
+`http://clang.llvm.org/docs/BlockLanguageSpec.html' for more
+information about blocks."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-clang-definitions nil c/c++-clang
+ "Additional preprocessor definitions for Clang.
+
+The value of this variable is a list of strings, where each
+string is an additional definition to pass to Clang, via the `-D'
+option."
+ :type '(repeat (string :tag "Definition"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.15"))
+
+(flycheck-def-option-var flycheck-clang-include-path nil c/c++-clang
+ "A list of include directories for Clang.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of Clang.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.14"))
+
+(flycheck-def-option-var flycheck-clang-includes nil c/c++-clang
+ "A list of additional include files for Clang.
+
+The value of this variable is a list of strings, where each
+string is a file to include before syntax checking. Relative
+paths are relative to the file being checked."
+ :type '(repeat (file :tag "Include file"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.15"))
+
+(flycheck-def-option-var flycheck-clang-language-standard nil c/c++-clang
+ "The language standard to use in Clang.
+
+The value of this variable is either a string denoting a language
+standard, or nil, to use the default standard. When non-nil,
+pass the language standard via the `-std' option."
+ :type '(choice (const :tag "Default standard" nil)
+ (string :tag "Language standard"))
+ :safe #'stringp
+ :package-version '(flycheck . "0.15"))
+(make-variable-buffer-local 'flycheck-clang-language-standard)
+
+(flycheck-def-option-var flycheck-clang-ms-extensions nil c/c++-clang
+ "Whether to enable Microsoft extensions to C/C++ in Clang.
+
+When non-nil, enable Microsoft extensions to C/C++ via
+`-fms-extensions'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.16"))
+
+(flycheck-def-option-var flycheck-clang-no-exceptions nil c/c++-clang
+ "Whether to disable exceptions in Clang.
+
+When non-nil, disable exceptions for syntax checks, via
+`-fno-exceptions'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-clang-no-rtti nil c/c++-clang
+ "Whether to disable RTTI in Clang.
+
+When non-nil, disable RTTI for syntax checks, via `-fno-rtti'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.15"))
+
+(flycheck-def-option-var flycheck-clang-pedantic nil c/c++-clang
+ "Whether to warn about language extensions in Clang.
+
+For ISO C, follows the version specified by any -std option used.
+When non-nil, disable non-ISO extensions to C/C++ via
+`-pedantic'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-def-option-var flycheck-clang-pedantic-errors nil c/c++-clang
+ "Whether to error on language extensions in Clang.
+
+For ISO C, follows the version specified by any -std option used.
+When non-nil, disable non-ISO extensions to C/C++ via
+`-pedantic-errors'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-def-option-var flycheck-clang-standard-library nil c/c++-clang
+ "The standard library to use for Clang.
+
+The value of this variable is the name of a standard library as
+string, or nil to use the default standard library.
+
+Refer to the Clang manual at URL
+`http://clang.llvm.org/docs/UsersManual.html' for more
+information about the standard library."
+ :type '(choice (const "libc++")
+ (const :tag "GNU libstdc++" "libstdc++")
+ (string :tag "Library name"))
+ :safe #'stringp
+ :package-version '(flycheck . "0.15"))
+
+(flycheck-def-option-var flycheck-clang-warnings '("all" "extra") c/c++-clang
+ "A list of additional warnings to enable in Clang.
+
+The value of this variable is a list of strings, where each string
+is the name of a warning category to enable. By default, all
+recommended warnings and some extra warnings are enabled (as by
+`-Wall' and `-Wextra' respectively).
+
+Refer to the Clang manual at URL
+`http://clang.llvm.org/docs/UsersManual.html' for more
+information about warnings."
+ :type '(choice (const :tag "No additional warnings" nil)
+ (repeat :tag "Additional warnings"
+ (string :tag "Warning name")))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.14"))
+
+(defun flycheck-c/c++-quoted-include-directory ()
+ "Get the directory for quoted includes.
+
+C/C++ compiles typicall look up includes with quotation marks in
+the directory of the file being compiled. However, since
+Flycheck uses temporary copies for syntax checking, it needs to
+explicitly determine the directory for quoted includes.
+
+This function determines the directory by looking at function
+`buffer-file-name', or if that is nil, at `default-directory'."
+ (-if-let (fn (buffer-file-name))
+ (file-name-directory fn)
+ ;; If the buffer has no file name, fall back to its default directory
+ default-directory))
+
+(flycheck-define-checker c/c++-clang
+ "A C/C++ syntax checker using Clang.
+
+See URL `http://clang.llvm.org/'."
+ :command ("clang"
+ "-fsyntax-only"
+ "-fno-color-diagnostics" ; Do not include color codes in output
+ "-fno-caret-diagnostics" ; Do not visually indicate the source
+ ; location
+ "-fno-diagnostics-show-option" ; Do not show the corresponding
+ ; warning group
+ "-iquote" (eval (flycheck-c/c++-quoted-include-directory))
+ (option "-std=" flycheck-clang-language-standard concat)
+ (option-flag "-pedantic" flycheck-clang-pedantic)
+ (option-flag "-pedantic-errors" flycheck-clang-pedantic-errors)
+ (option "-stdlib=" flycheck-clang-standard-library concat)
+ (option-flag "-fms-extensions" flycheck-clang-ms-extensions)
+ (option-flag "-fno-exceptions" flycheck-clang-no-exceptions)
+ (option-flag "-fno-rtti" flycheck-clang-no-rtti)
+ (option-flag "-fblocks" flycheck-clang-blocks)
+ (option-list "-include" flycheck-clang-includes)
+ (option-list "-W" flycheck-clang-warnings concat)
+ (option-list "-D" flycheck-clang-definitions concat)
+ (option-list "-I" flycheck-clang-include-path)
+ (eval flycheck-clang-args)
+ "-x" (eval
+ (pcase major-mode
+ (`c++-mode "c++")
+ (`c-mode "c")))
+ ;; Read from standard input
+ "-")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ (message "In file included from") " " (or "<stdin>" (file-name))
+ ":" line ":" line-end)
+ (info line-start (or "<stdin>" (file-name)) ":" line ":" column
+ ": note: " (optional (message)) line-end)
+ (warning line-start (or "<stdin>" (file-name)) ":" line ":" column
+ ": warning: " (optional (message)) line-end)
+ (error line-start (or "<stdin>" (file-name)) ":" line ":" column
+ ": " (or "fatal error" "error") ": " (optional (message)) line-end))
+ :error-filter
+ (lambda (errors)
+ (let ((errors (flycheck-sanitize-errors errors)))
+ (dolist (err errors)
+ ;; Clang will output empty messages for #error/#warning pragmas without
+ ;; messages. We fill these empty errors with a dummy message to get
+ ;; them past our error filtering
+ (setf (flycheck-error-message err)
+ (or (flycheck-error-message err) "no message")))
+ (flycheck-fold-include-levels errors "In file included from")))
+ :modes (c-mode c++-mode)
+ :next-checkers ((warning . c/c++-cppcheck)))
+
+(flycheck-def-args-var flycheck-gcc-args c/c++-gcc
+ :package-version '(flycheck . "0.22"))
+
+(flycheck-def-option-var flycheck-gcc-definitions nil c/c++-gcc
+ "Additional preprocessor definitions for GCC.
+
+The value of this variable is a list of strings, where each
+string is an additional definition to pass to GCC, via the `-D'
+option."
+ :type '(repeat (string :tag "Definition"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gcc-include-path nil c/c++-gcc
+ "A list of include directories for GCC.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of gcc.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gcc-includes nil c/c++-gcc
+ "A list of additional include files for GCC.
+
+The value of this variable is a list of strings, where each
+string is a file to include before syntax checking. Relative
+paths are relative to the file being checked."
+ :type '(repeat (file :tag "Include file"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gcc-language-standard nil c/c++-gcc
+ "The language standard to use in GCC.
+
+The value of this variable is either a string denoting a language
+standard, or nil, to use the default standard. When non-nil,
+pass the language standard via the `-std' option."
+ :type '(choice (const :tag "Default standard" nil)
+ (string :tag "Language standard"))
+ :safe #'stringp
+ :package-version '(flycheck . "0.20"))
+(make-variable-buffer-local 'flycheck-gcc-language-standard)
+
+(flycheck-def-option-var flycheck-gcc-no-exceptions nil c/c++-gcc
+ "Whether to disable exceptions in GCC.
+
+When non-nil, disable exceptions for syntax checks, via
+`-fno-exceptions'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gcc-no-rtti nil c/c++-gcc
+ "Whether to disable RTTI in GCC.
+
+When non-nil, disable RTTI for syntax checks, via `-fno-rtti'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gcc-openmp nil c/c++-gcc
+ "Whether to enable OpenMP in GCC.
+
+When non-nil, enable OpenMP for syntax checkers, via
+`-fopenmp'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.21"))
+
+(flycheck-def-option-var flycheck-gcc-pedantic nil c/c++-gcc
+ "Whether to warn about language extensions in GCC.
+
+For ISO C, follows the version specified by any -std option used.
+When non-nil, disable non-ISO extensions to C/C++ via
+`-pedantic'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-def-option-var flycheck-gcc-pedantic-errors nil c/c++-gcc
+ "Whether to error on language extensions in GCC.
+
+For ISO C, follows the version specified by any -std option used.
+When non-nil, disable non-ISO extensions to C/C++ via
+`-pedantic-errors'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-def-option-var flycheck-gcc-warnings '("all" "extra") c/c++-gcc
+ "A list of additional warnings to enable in GCC.
+
+The value of this variable is a list of strings, where each string
+is the name of a warning category to enable. By default, all
+recommended warnings and some extra warnings are enabled (as by
+`-Wall' and `-Wextra' respectively).
+
+Refer to the gcc manual at URL
+`https://gcc.gnu.org/onlinedocs/gcc/' for more information about
+warnings."
+ :type '(choice (const :tag "No additional warnings" nil)
+ (repeat :tag "Additional warnings"
+ (string :tag "Warning name")))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-define-checker c/c++-gcc
+ "A C/C++ syntax checker using GCC.
+
+Requires GCC 4.8 or newer. See URL `https://gcc.gnu.org/'."
+ :command ("gcc"
+ "-fshow-column"
+ "-fno-diagnostics-show-caret" ; Do not visually indicate the source location
+ "-fno-diagnostics-show-option" ; Do not show the corresponding
+ ; warning group
+ "-iquote" (eval (flycheck-c/c++-quoted-include-directory))
+ (option "-std=" flycheck-gcc-language-standard concat)
+ (option-flag "-pedantic" flycheck-gcc-pedantic)
+ (option-flag "-pedantic-errors" flycheck-gcc-pedantic-errors)
+ (option-flag "-fno-exceptions" flycheck-gcc-no-exceptions)
+ (option-flag "-fno-rtti" flycheck-gcc-no-rtti)
+ (option-flag "-fopenmp" flycheck-gcc-openmp)
+ (option-list "-include" flycheck-gcc-includes)
+ (option-list "-W" flycheck-gcc-warnings concat)
+ (option-list "-D" flycheck-gcc-definitions concat)
+ (option-list "-I" flycheck-gcc-include-path)
+ (eval flycheck-gcc-args)
+ "-x" (eval
+ (pcase major-mode
+ (`c++-mode "c++")
+ (`c-mode "c")))
+ ;; GCC performs full checking only when actually compiling, so
+ ;; `-fsyntax-only' is not enough. Just let it generate assembly
+ ;; code.
+ "-S" "-o" null-device
+ ;; Read from standard input
+ "-")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ (message "In file included from") " " (or "<stdin>" (file-name))
+ ":" line ":" column ":" line-end)
+ (info line-start (or "<stdin>" (file-name)) ":" line ":" column
+ ": note: " (message) line-end)
+ (warning line-start (or "<stdin>" (file-name)) ":" line ":" column
+ ": warning: " (message) line-end)
+ (error line-start (or "<stdin>" (file-name)) ":" line ":" column
+ ": " (or "fatal error" "error") ": " (message) line-end))
+ :error-filter
+ (lambda (errors)
+ (flycheck-fold-include-levels (flycheck-sanitize-errors errors)
+ "In file included from"))
+ :modes (c-mode c++-mode)
+ :next-checkers ((warning . c/c++-cppcheck)))
+
+(flycheck-def-option-var flycheck-cppcheck-checks '("style") c/c++-cppcheck
+ "Enabled checks for Cppcheck.
+
+The value of this variable is a list of strings, where each
+string is the name of an additional check to enable. By default,
+all coding style checks are enabled.
+
+See section \"Enable message\" in the Cppcheck manual at URL
+`http://cppcheck.sourceforge.net/manual.pdf', and the
+documentation of the `--enable' option for more information,
+including a list of supported checks."
+ :type '(repeat :tag "Additional checks"
+ (string :tag "Check name"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.14"))
+
+(flycheck-def-option-var flycheck-cppcheck-language-standard nil c/c++-cppcheck
+ "The language standard to use in cppcheck.
+
+The value of this variable is either a string denoting a language
+standard, or nil, to use the default standard. When non-nil,
+pass the language standard via the `-std' option."
+ :type '(choice (const :tag "Default standard" nil)
+ (string :tag "Language standard"))
+ :safe #'stringp
+ :package-version '(flycheck . "0.26"))
+(make-variable-buffer-local 'flycheck-cppcheck-language-standard)
+
+(flycheck-def-option-var flycheck-cppcheck-inconclusive nil c/c++-cppcheck
+ "Whether to enable Cppcheck inconclusive checks.
+
+When non-nil, enable Cppcheck inconclusive checks. This allows Cppcheck to
+report warnings it's not certain of, but it may result in false positives.
+
+This will have no effect when using Cppcheck 1.53 and older."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.19"))
+
+(flycheck-def-option-var flycheck-cppcheck-include-path nil c/c++-cppcheck
+ "A list of include directories for cppcheck.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of cppcheck.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-define-checker c/c++-cppcheck
+ "A C/C++ checker using cppcheck.
+
+See URL `http://cppcheck.sourceforge.net/'."
+ :command ("cppcheck" "--quiet" "--xml-version=2" "--inline-suppr"
+ (option "--enable=" flycheck-cppcheck-checks concat
+ flycheck-option-comma-separated-list)
+ (option-flag "--inconclusive" flycheck-cppcheck-inconclusive)
+ (option-list "-I" flycheck-cppcheck-include-path)
+ (option "--std=" flycheck-cppcheck-language-standard concat)
+ source)
+ :error-parser flycheck-parse-cppcheck
+ :modes (c-mode c++-mode))
+
+(flycheck-define-checker cfengine
+ "A CFEngine syntax checker using cf-promises.
+
+See URL `http://cfengine.com/'."
+ :command ("cf-promises" "-Wall" "-f"
+ ;; We must stay in the same directory to resolve @include
+ source-inplace)
+ :error-patterns
+ ((warning line-start (file-name) ":" line ":" column
+ ": warning: " (message) line-end)
+ (error line-start (file-name) ":" line ":" column
+ ": error: " (message) line-end))
+ :modes (cfengine-mode cfengine3-mode))
+
+(flycheck-def-option-var flycheck-foodcritic-tags nil chef-foodcritic
+ "A list of tags to select for Foodcritic.
+
+The value of this variable is a list of strings where each string
+is a tag expression describing Foodcritic rules to enable or
+disable, via the `--tags' option. To disable a tag, prefix it
+with `~'."
+ :type '(repeat :tag "Tags" (string :tag "Tag expression"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-define-checker chef-foodcritic
+ "A Chef cookbooks syntax checker using Foodcritic.
+
+See URL `http://acrmp.github.io/foodcritic/'."
+ ;; Use `source-inplace' to allow resource discovery with relative paths.
+ ;; foodcritic interprets these as relative to the source file, so we need to
+ ;; stay within the source tree. See
+ ;; https://github.com/flycheck/flycheck/pull/556
+ :command ("foodcritic"
+ (option-list "--tags" flycheck-foodcritic-tags)
+ source-inplace)
+ :error-patterns
+ ((error line-start (message) ": " (file-name) ":" line line-end))
+ :modes (enh-ruby-mode ruby-mode)
+ :predicate
+ (lambda ()
+ (let ((parent-dir (file-name-directory
+ (directory-file-name
+ (expand-file-name default-directory)))))
+ (or
+ ;; Chef CookBook
+ ;; http://docs.opscode.com/chef/knife.html#id38
+ (locate-dominating-file parent-dir "recipes")
+ ;; Knife Solo
+ ;; http://matschaffer.github.io/knife-solo/#label-Init+command
+ (locate-dominating-file parent-dir "cookbooks")))))
+
+(flycheck-define-checker coffee
+ "A CoffeeScript syntax checker using coffee.
+
+See URL `http://coffeescript.org/'."
+ ;; --print suppresses generation of compiled .js files
+ :command ("coffee" "--compile" "--print" "--stdio")
+ :standard-input t
+ :error-patterns
+ ((error line-start "[stdin]:" line ":" column
+ ": error: " (message) line-end))
+ :modes coffee-mode
+ :next-checkers ((warning . coffee-coffeelint)))
+
+(flycheck-def-config-file-var flycheck-coffeelintrc coffee-coffeelint
+ ".coffeelint.json"
+ :safe #'stringp)
+
+(flycheck-define-checker coffee-coffeelint
+ "A CoffeeScript style checker using coffeelint.
+
+This syntax checker requires coffeelint 1.0 or newer.
+
+See URL `http://www.coffeelint.org/'."
+ :command
+ ("coffeelint"
+ (config-file "--file" flycheck-coffeelintrc)
+ "--stdin" "--reporter" "checkstyle")
+ :standard-input t
+ :error-parser flycheck-parse-checkstyle
+ :error-filter (lambda (errors)
+ (flycheck-remove-error-file-names
+ "stdin" (flycheck-remove-error-ids
+ (flycheck-sanitize-errors errors))))
+ :modes coffee-mode)
+
+(flycheck-define-checker coq
+ "A Coq syntax checker using the Coq compiler.
+
+See URL `http://coq.inria.fr/'."
+ ;; We use coqtop in batch mode, because coqc is picky about file names.
+ :command ("coqtop" "-batch" "-load-vernac-source" source)
+ :error-patterns
+ ((error line-start "File \"" (file-name) "\", line " line
+ ;; TODO: Parse the end column, once Flycheck supports that
+ ", characters " column "-" (one-or-more digit) ":\n"
+ (or "Syntax error:" "Error:")
+ ;; Most Coq error messages span multiple lines, and end with a dot.
+ ;; There are simple one-line messages, too, though.
+ (message (or (and (one-or-more (or not-newline "\n")) ".")
+ (one-or-more not-newline)))
+ line-end))
+ :error-filter
+ (lambda (errors)
+ (dolist (err (flycheck-sanitize-errors errors))
+ (setf (flycheck-error-message err)
+ (replace-regexp-in-string (rx (1+ (syntax whitespace)) line-end)
+ "" (flycheck-error-message err)
+ 'fixedcase 'literal)))
+ (flycheck-increment-error-columns errors))
+ :modes coq-mode)
+
+(flycheck-define-checker css-csslint
+ "A CSS syntax and style checker using csslint.
+
+See URL `https://github.com/CSSLint/csslint'."
+ :command ("csslint" "--format=checkstyle-xml" source)
+ :error-parser flycheck-parse-checkstyle
+ :error-filter flycheck-dequalify-error-ids
+ :modes css-mode)
+
+(defconst flycheck-d-module-re
+ (rx "module" (one-or-more (syntax whitespace))
+ (group (one-or-more (not (syntax whitespace))))
+ (zero-or-more (syntax whitespace))
+ ";")
+ "Regular expression to match a D module declaration.")
+
+(defun flycheck-d-base-directory ()
+ "Get the relative base directory path for this module."
+ (let* ((file-name (buffer-file-name))
+ (module-file (if (string= (file-name-nondirectory file-name)
+ "package.d")
+ (directory-file-name (file-name-directory file-name))
+ file-name)))
+ (flycheck-module-root-directory
+ (flycheck-find-in-buffer flycheck-d-module-re)
+ module-file)))
+
+(flycheck-def-option-var flycheck-dmd-include-path nil d-dmd
+ "A list of include directories for dmd.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of dmd.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.18"))
+
+(flycheck-def-args-var flycheck-dmd-args d-dmd
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-define-checker d-dmd
+ "A D syntax checker using the DMD compiler.
+
+Requires DMD 2.066 or newer. See URL `http://dlang.org/'."
+ :command ("dmd"
+ "-debug" ; Compile in debug mode
+ "-o-" ; Don't generate an object file
+ "-vcolumns" ; Add columns in output
+ "-wi" ; Compilation will continue even if there are warnings
+ (eval (concat "-I" (flycheck-d-base-directory)))
+ (option-list "-I" flycheck-dmd-include-path concat)
+ (eval flycheck-dmd-args)
+ source)
+ :error-patterns
+ ((error line-start
+ (file-name) "(" line "," column "): Error: " (message)
+ line-end)
+ (warning line-start (file-name) "(" line "," column "): "
+ (or "Warning" "Deprecation") ": " (message) line-end))
+ :modes d-mode)
+
+(defconst flycheck-this-emacs-executable
+ (concat invocation-directory invocation-name)
+ "The path to the currently running Emacs executable.")
+
+(defconst flycheck-emacs-args '("-Q" "--batch")
+ "Common arguments to Emacs invocations.")
+
+(defmacro flycheck-prepare-emacs-lisp-form (&rest body)
+ "Prepare BODY for use as check form in a subprocess."
+ (declare (indent 0))
+ `(flycheck-sexp-to-string
+ '(progn
+ (defvar jka-compr-inhibit)
+ (unwind-protect
+ ;; Flycheck inhibits compression of temporary files, thus we
+ ;; must not attempt to decompress.
+ (let ((jka-compr-inhibit t))
+ ;; Strip option-argument separator from arguments, if present
+ (when (equal (car command-line-args-left) "--")
+ (setq command-line-args-left (cdr command-line-args-left)))
+ ,@body)
+ ;; Prevent Emacs from processing the arguments on its own, see
+ ;; https://github.com/flycheck/flycheck/issues/319
+ (setq command-line-args-left nil)))))
+
+(defconst flycheck-emacs-lisp-check-form
+ (flycheck-prepare-emacs-lisp-form
+ ;; Keep track of the generated bytecode files, to delete them after byte
+ ;; compilation.
+ (defvar flycheck-byte-compiled-files nil)
+ (let ((byte-compile-dest-file-function
+ (lambda (source)
+ (let ((temp-file (make-temp-file (file-name-nondirectory source))))
+ (push temp-file flycheck-byte-compiled-files)
+ temp-file))))
+ (unwind-protect
+ (byte-compile-file (car command-line-args-left))
+ (mapc (lambda (f) (ignore-errors (delete-file f)))
+ flycheck-byte-compiled-files)))))
+
+(flycheck-def-option-var flycheck-emacs-lisp-load-path nil emacs-lisp
+ "Load path to use in the Emacs Lisp syntax checker.
+
+When set to `inherit', use the `load-path' of the current Emacs
+session during syntax checking.
+
+When set to a list of strings, add each directory in this list to
+the `load-path' before invoking the byte compiler. Relative
+paths in this list are expanded against the `default-directory'
+of the buffer to check.
+
+When nil, do not explicitly set the `load-path' during syntax
+checking. The syntax check only uses the built-in `load-path' of
+Emacs in this case.
+
+Note that changing this variable can lead to wrong results of the
+syntax check, e.g. if an unexpected version of a required library
+is used."
+ :type '(choice (const :tag "Inherit current `load-path'" inherit)
+ (repeat :tag "Load path" directory))
+ :risky t
+ :package-version '(flycheck . "0.14"))
+
+(flycheck-def-option-var flycheck-emacs-lisp-initialize-packages
+ 'auto emacs-lisp
+ "Whether to initialize packages in the Emacs Lisp syntax checker.
+
+When nil, never initialize packages. When `auto', initialize
+packages only when checking `user-init-file' or files from
+`user-emacs-directory'. For any other non-nil value, always
+initialize packages.
+
+When initializing packages is enabled the `emacs-lisp' syntax
+checker calls `package-initialize' before byte-compiling the file
+to be checked. It also sets `package-user-dir' according to
+`flycheck-emacs-lisp-package-user-dir'."
+ :type '(choice (const :tag "Do not initialize packages" nil)
+ (const :tag "Initialize packages for configuration only" auto)
+ (const :tag "Always initialize packages" t))
+ :risky t
+ :package-version '(flycheck . "0.14"))
+
+(defconst flycheck-emacs-lisp-package-initialize-form
+ (flycheck-sexp-to-string
+ '(with-demoted-errors "Error during package initialization: %S"
+ (package-initialize)))
+ "Form used to initialize packages.")
+
+(defun flycheck-option-emacs-lisp-package-initialize (value)
+ "Option VALUE filter for `flycheck-emacs-lisp-initialize-packages'."
+ (let ((shall-initialize
+ (if (eq value 'auto)
+ (or (flycheck-in-user-emacs-directory-p (buffer-file-name))
+ ;; `user-init-file' is nil in non-interactive sessions. Now,
+ ;; no user would possibly use Flycheck in a non-interactive
+ ;; session, but our unit tests run non-interactively, so we
+ ;; have to handle this case anyway
+ (and user-init-file
+ (flycheck-same-files-p (buffer-file-name)
+ user-init-file)))
+ value)))
+ (when shall-initialize
+ ;; If packages shall be initialized, return the corresponding form,
+ ;; otherwise make Flycheck ignore the option by returning nil.
+ flycheck-emacs-lisp-package-initialize-form)))
+
+(flycheck-def-option-var flycheck-emacs-lisp-package-user-dir nil emacs-lisp
+ "Package directory for the Emacs Lisp syntax checker.
+
+If set to a string set `package-user-dir' to the value of this
+variable before initializing packages. If set to nil just inherit
+the value of `package-user-dir' from the running Emacs session.
+
+This variable has no effect, if
+`flycheck-emacs-lisp-initialize-packages' is nil."
+ :type '(choice (const :tag "Default package directory" nil)
+ (directory :tag "Custom package directory"))
+ :risky t
+ :package-version '(flycheck . "0.14"))
+
+(defun flycheck-option-emacs-lisp-package-user-dir (value)
+ "Option VALUE filter for `flycheck-emacs-lisp-package-user-dir'."
+ ;; Inherit the package directory from our Emacs session
+ (let ((value (or value package-user-dir)))
+ (when value
+ (flycheck-sexp-to-string `(setq package-user-dir ,value)))))
+
+(flycheck-define-checker emacs-lisp
+ "An Emacs Lisp syntax checker using the Emacs Lisp Byte compiler.
+
+See Info Node `(elisp)Byte Compilation'."
+ :command ("emacs" (eval flycheck-emacs-args)
+ (eval
+ (let ((path (pcase flycheck-emacs-lisp-load-path
+ (`inherit load-path)
+ (p (seq-map #'expand-file-name p)))))
+ (flycheck-prepend-with-option "--directory" path)))
+ (option "--eval" flycheck-emacs-lisp-package-user-dir nil
+ flycheck-option-emacs-lisp-package-user-dir)
+ (option "--eval" flycheck-emacs-lisp-initialize-packages nil
+ flycheck-option-emacs-lisp-package-initialize)
+ "--eval" (eval flycheck-emacs-lisp-check-form)
+ "--"
+ source-inplace)
+ :error-patterns
+ ((error line-start (file-name) ":" line ":" column ":Error:"
+ (message (zero-or-more not-newline)
+ (zero-or-more "\n " (zero-or-more not-newline)))
+ line-end)
+ (warning line-start (file-name) ":" line ":" column ":Warning:"
+ (message (zero-or-more not-newline)
+ (zero-or-more "\n " (zero-or-more not-newline)))
+ line-end))
+ :error-filter
+ (lambda (errors)
+ (flycheck-collapse-error-message-whitespace
+ (flycheck-sanitize-errors errors)))
+ :modes (emacs-lisp-mode lisp-interaction-mode)
+ :predicate
+ (lambda ()
+ (and
+ ;; Ensure that we only check buffers with a backing file. For buffers
+ ;; without a backing file we cannot guarantee that file names in error
+ ;; messages are properly resolved, because `byte-compile-file' emits file
+ ;; names *relative to the directory of the checked file* instead of the
+ ;; working directory. Hence our backwards-substitution will fail, because
+ ;; the checker process has a different base directory to resolve relative
+ ;; file names than the Flycheck code working on the buffer to check.
+ (buffer-file-name)
+ ;; Do not check buffers which should not be byte-compiled. The checker
+ ;; process will refuse to compile these, which would confuse Flycheck
+ (not (bound-and-true-p no-byte-compile))
+ ;; Do not check buffers used for autoloads generation during package
+ ;; installation. These buffers are too short-lived for being checked, and
+ ;; doing so causes spurious errors. See
+ ;; https://github.com/flycheck/flycheck/issues/45 and
+ ;; https://github.com/bbatsov/prelude/issues/248. We must also not check
+ ;; compilation buffers, but as these are ephemeral, Flycheck won't check
+ ;; them anyway.
+ (not (flycheck-autoloads-file-p))))
+ :next-checkers (emacs-lisp-checkdoc))
+
+(defconst flycheck-emacs-lisp-checkdoc-form
+ (flycheck-prepare-emacs-lisp-form
+ (unless (require 'elisp-mode nil 'no-error)
+ ;; TODO: Fallback for Emacs 24, remove when dropping support for 24
+ (require 'lisp-mode))
+ (require 'checkdoc)
+
+ (let ((source (car command-line-args-left))
+ ;; Remember the default directory of the process
+ (process-default-directory default-directory))
+ ;; Note that we deliberately use our custom approach even despite of
+ ;; `checkdoc-file' which was added to Emacs 25.1. While it's conceptually
+ ;; the better thing, it's implementation has too many flaws to be of use
+ ;; for us.
+ (with-temp-buffer
+ (insert-file-contents source 'visit)
+ (setq buffer-file-name source)
+ ;; And change back to the process default directory to make file-name
+ ;; back-substutition work
+ (setq default-directory process-default-directory)
+ (with-demoted-errors "Error in checkdoc: %S"
+ ;; Checkdoc needs the Emacs Lisp syntax table to parse sexps
+ ;; correctly, see https://github.com/flycheck/flycheck/issues/833
+ (with-syntax-table emacs-lisp-mode-syntax-table
+ (checkdoc-current-buffer t))
+ (with-current-buffer checkdoc-diagnostic-buffer
+ (princ (buffer-substring-no-properties (point-min) (point-max)))
+ (kill-buffer)))))))
+
+(flycheck-define-checker emacs-lisp-checkdoc
+ "An Emacs Lisp style checker using CheckDoc.
+
+The checker runs `checkdoc-current-buffer'."
+ :command ("emacs" (eval flycheck-emacs-args)
+ "--eval" (eval flycheck-emacs-lisp-checkdoc-form)
+ "--" source)
+ :error-patterns
+ ((warning line-start (file-name) ":" line ": " (message) line-end))
+ :modes (emacs-lisp-mode)
+ :predicate
+ (lambda ()
+ ;; Do not check Autoloads, Cask/Carton and dir-locals files. These files
+ ;; really don't need to follow Checkdoc conventions.
+ (not (or (flycheck-autoloads-file-p)
+ (and (buffer-file-name)
+ (member (file-name-nondirectory (buffer-file-name))
+ '("Cask" "Carton" ".dir-locals.el")))))))
+
+(dolist (checker '(emacs-lisp emacs-lisp-checkdoc))
+ (setf (car (flycheck-checker-get checker 'command))
+ flycheck-this-emacs-executable))
+
+(flycheck-def-option-var flycheck-erlang-include-path nil erlang
+ "A list of include directories for Erlang.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of erlc.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-def-option-var flycheck-erlang-library-path nil erlang
+ "A list of library directories for Erlang.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the library path of erlc.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Library directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-define-checker erlang
+ "An Erlang syntax checker using the Erlang interpreter.
+
+See URL `http://www.erlang.org/'."
+ :command ("erlc"
+ "-o" temporary-directory
+ (option-list "-I" flycheck-erlang-include-path)
+ (option-list "-pa" flycheck-erlang-library-path)
+ "-Wall"
+ source)
+ :error-patterns
+ ((warning line-start (file-name) ":" line ": Warning:" (message) line-end)
+ (error line-start (file-name) ":" line ": " (message) line-end))
+ :modes erlang-mode)
+
+(flycheck-define-checker eruby-erubis
+ "A eRuby syntax checker using the `erubis' command.
+
+See URL `http://www.kuwata-lab.com/erubis/'."
+ :command ("erubis" "-z" source)
+ :error-patterns
+ ((error line-start (file-name) ":" line ": " (message) line-end))
+ :modes (html-erb-mode rhtml-mode))
+
+(flycheck-def-args-var flycheck-gfortran-args fortran-gfortran
+ :package-version '(flycheck . "0.22"))
+
+(flycheck-def-option-var flycheck-gfortran-include-path nil fortran-gfortran
+ "A list of include directories for GCC Fortran.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of gcc.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gfortran-language-standard "f95" fortran-gfortran
+ "The language standard to use in GFortran.
+
+The value of this variable is either a string denoting a language
+standard, or nil, to use the default standard. When non-nil,
+pass the language standard via the `-std' option."
+ :type '(choice (const :tag "Default standard" nil)
+ (string :tag "Language standard"))
+ :safe #'stringp
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-def-option-var flycheck-gfortran-layout nil fortran-gfortran
+ "The source code layout to use in GFortran.
+
+The value of this variable is one of the following symbols:
+
+nil
+ Let gfortran determine the layout from the extension
+
+`free'
+ Use free form layout
+
+
+`fixed'
+ Use fixed form layout
+
+In any other case, an error is signaled.")
+
+(defun flycheck-option-gfortran-layout (value)
+ "Option VALUE filter for `flycheck-gfortran-layout'."
+ (pcase value
+ (`nil nil)
+ (`free "free-form")
+ (`fixed "fixed-form")
+ (_ (error "Invalid value for flycheck-gfortran-layout: %S" value))))
+
+(flycheck-def-option-var flycheck-gfortran-warnings '("all" "extra")
+ fortran-gfortran
+ "A list of warnings for GCC Fortran.
+
+The value of this variable is a list of strings, where each string
+is the name of a warning category to enable. By default, all
+recommended warnings and some extra warnings are enabled (as by
+`-Wall' and `-Wextra' respectively).
+
+Refer to the gfortran manual at URL
+`https://gcc.gnu.org/onlinedocs/gfortran/' for more information
+about warnings")
+
+(flycheck-define-checker fortran-gfortran
+ "An Fortran syntax checker using GCC.
+
+Uses GCC's Fortran compiler gfortran. See URL
+`https://gcc.gnu.org/onlinedocs/gfortran/'."
+ :command ("gfortran"
+ "-fsyntax-only"
+ "-fshow-column"
+ "-fno-diagnostics-show-caret" ; Do not visually indicate the source location
+ "-fno-diagnostics-show-option" ; Do not show the corresponding
+ ; warning group
+ ;; Fortran has similar include processing as C/C++
+ "-iquote" (eval (flycheck-c/c++-quoted-include-directory))
+ (option "-std=" flycheck-gfortran-language-standard concat)
+ (option "-f" flycheck-gfortran-layout concat
+ flycheck-option-gfortran-layout)
+ (option-list "-W" flycheck-gfortran-warnings concat)
+ (option-list "-I" flycheck-gfortran-include-path concat)
+ (eval flycheck-gfortran-args)
+ source)
+ :error-patterns
+ ((error line-start (file-name) ":" line (or ":" ".") column (or ": " ":\n")
+ (or (= 3 (zero-or-more not-newline) "\n") "")
+ (or "Error" "Fatal Error") ": "
+ (message) line-end)
+ (warning line-start (file-name) ":" line (or ":" ".") column (or ": " ":\n")
+ (or (= 3 (zero-or-more not-newline) "\n") "")
+ "Warning: " (message) line-end))
+ :modes (fortran-mode f90-mode))
+
+(flycheck-define-checker go-gofmt
+ "A Go syntax and style checker using the gofmt utility.
+
+See URL `http://golang.org/cmd/gofmt/'."
+ :command ("gofmt")
+ :standard-input t
+ :error-patterns
+ ((error line-start "<standard input>:" line ":" column ": " (message) line-end))
+ :modes go-mode
+ :next-checkers ((warning . go-golint)
+ ;; Fall back, if go-golint doesn't exist
+ (warning . go-vet)
+ ;; Fall back, if go-vet doesn't exist
+ (warning . go-build) (warning . go-test)
+ (warning . go-errcheck)))
+
+(flycheck-define-checker go-golint
+ "A Go style checker using Golint.
+
+See URL `https://github.com/golang/lint'."
+ :command ("golint" source)
+ :error-patterns
+ ((warning line-start (file-name) ":" line ":" column ": " (message) line-end))
+ :modes go-mode
+ :next-checkers (go-vet
+ ;; Fall back, if go-vet doesn't exist
+ go-build go-test go-errcheck))
+
+(flycheck-def-option-var flycheck-go-vet-print-functions nil go-vet
+ "A list of print-like functions for `go tool vet'.
+
+Go vet will check these functions for format string problems and
+issues, such as a mismatch between the number of formats used,
+and the number of arguments given.
+
+Each entry is in the form Name:N where N is the zero-based
+argument position of the first argument involved in the print:
+either the format or the first print argument for non-formatted
+prints. For example, if you have Warn and Warnf functions that
+take an io.Writer as their first argument, like Fprintf,
+-printfuncs=Warn:1,Warnf:1 "
+ :type '(repeat :tag "print-like functions"
+ (string :tag "function"))
+ :safe #'flycheck-string-list-p)
+
+(flycheck-define-checker go-vet
+ "A Go syntax checker using the `go tool vet' command.
+
+See URL `http://golang.org/cmd/go/' and URL
+`http://godoc.org/golang.org/x/tools/cmd/vet'."
+ :command ("go" "tool" "vet"
+ (option "-printfuncs=" flycheck-go-vet-print-functions concat
+ flycheck-option-comma-separated-list)
+ source)
+ :error-patterns
+ ((warning line-start (file-name) ":" line ": " (message) line-end))
+ :modes go-mode
+ ;; We must explicitly check whether the "vet" tool is available
+ :predicate (lambda ()
+ (let ((go (flycheck-checker-executable 'go-vet)))
+ (member "vet" (ignore-errors (process-lines go "tool")))))
+ :next-checkers (go-build
+ go-test
+ ;; Fall back if `go build' or `go test' can be used
+ go-errcheck)
+ :verify-fn (lambda (_)
+ (let ((have-vet (member "vet" (ignore-errors
+ (process-lines go "tool")))))
+ (list
+ (flycheck-verification-result-new
+ :label "go tool vet"
+ :message (if have-vet "present" "missing")
+ :face (if have-vet 'success '(bold error)))))))
+
+(flycheck-def-option-var flycheck-go-build-install-deps nil go-build
+ "Whether to install dependencies in `go build'.
+
+If non-nil automatically install dependencies with `go build'
+while syntax checking."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.25"))
+
+(flycheck-def-option-var flycheck-go-build-tags nil go-build
+ "A list of tags for `go build'.
+
+Each item is a string with a tag to be given to `go build'."
+ :type '(repeat (string :tag "Tag"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.25"))
+
+(flycheck-define-checker go-build
+ "A Go syntax and type checker using the `go build' command.
+
+See URL `http://golang.org/cmd/go'."
+ ;; We need to use `temporary-file-name' instead of `null-device',
+ ;; because Go can't write to the null device.
+ ;; See https://github.com/golang/go/issues/4851
+ :command ("go" "build"
+ (option-flag "-i" flycheck-go-build-install-deps)
+ ;; multiple tags are listed as "dev debug ..."
+ (option-list "-tags=" flycheck-go-build-tags concat)
+ ;; TODO: Use `null-device' instead. Go 1.6 can write to /dev/null
+ ;; (and NUL on Windows) now, see
+ ;; https://github.com/flycheck/flycheck/issues/838.
+ "-o" temporary-file-name)
+ :error-patterns
+ ((error line-start (file-name) ":" line ":"
+ (optional column ":") " "
+ (message (one-or-more not-newline)
+ (zero-or-more "\n\t" (one-or-more not-newline)))
+ line-end))
+ :modes go-mode
+ :predicate (lambda ()
+ (and (flycheck-buffer-saved-p)
+ (not (string-suffix-p "_test.go" (buffer-file-name)))))
+ :next-checkers ((warning . go-errcheck)))
+
+(flycheck-define-checker go-test
+ "A Go syntax and type checker using the `go test' command.
+
+See URL `http://golang.org/cmd/go'."
+ ;; This command builds the test executable and leaves it in the current
+ ;; directory. Unfortunately 'go test -c' does not have the '-o' option.
+ :command ("go" "test" "-c")
+ :error-patterns
+ ((error line-start (file-name) ":" line ": "
+ (message (one-or-more not-newline)
+ (zero-or-more "\n\t" (one-or-more not-newline)))
+ line-end))
+ :modes go-mode
+ :predicate
+ (lambda () (and (flycheck-buffer-saved-p)
+ (string-suffix-p "_test.go" (buffer-file-name))))
+ :next-checkers ((warning . go-errcheck)))
+
+(defun flycheck-go-package-name (&optional file-name gopath)
+ "Determine the package name for FILE-NAME and GOPATH.
+
+FILE-NAME defaults to function `buffer-file-name'. GOPATH
+defaults to $GOPATH.
+
+Return the package name for FILE-NAME, or nil if FILE-NAME is not
+part of any package or if GOPATH is nil."
+ (-when-let* ((gopath (or gopath (getenv "GOPATH")))
+ (file-name (or file-name (buffer-file-name))))
+ (let ((gosrc (file-name-as-directory (expand-file-name "src/" gopath)))
+ (file-name (expand-file-name file-name)))
+ (when (string-prefix-p gosrc file-name)
+ ;; The file is part of a package, so determine the package name, as
+ ;; relative file name to the GO source directory
+ (directory-file-name ; Remove trailing /
+ (file-relative-name (file-name-directory file-name) gosrc))))))
+
+(flycheck-define-checker go-errcheck
+ "A Go checker for unchecked errors.
+
+See URL `https://github.com/kisielk/errcheck'."
+ :command ("errcheck" (eval (flycheck-go-package-name)))
+ :error-patterns
+ ((warning line-start
+ (file-name) ":" line ":" column (or (one-or-more "\t") ": ")
+ (message)
+ line-end))
+ :error-filter
+ (lambda (errors)
+ (let ((errors (flycheck-sanitize-errors errors))
+ (gosrc (expand-file-name "src/" (getenv "GOPATH"))))
+ (dolist (err errors)
+ ;; File names are relative to the Go source directory, so we need to
+ ;; unexpand and re-expand them
+ (setf (flycheck-error-filename err)
+ (expand-file-name
+ ;; Get the relative name back, since Flycheck has already
+ ;; expanded the name for us
+ (file-relative-name (flycheck-error-filename err))
+ ;; And expand it against the Go source directory
+ gosrc))
+ (-when-let (message (flycheck-error-message err))
+ ;; Improve the messages reported by errcheck to make them more clear.
+ (setf (flycheck-error-message err)
+ (format "Ignored `error` returned from `%s`" message)))))
+ errors)
+ :modes go-mode
+ :predicate
+ (lambda ()
+ ;; We need a valid package name, since errcheck only works on entire
+ ;; packages, and can't check individual Go files.
+ (and (flycheck-buffer-saved-p) (flycheck-go-package-name))))
+
+(flycheck-define-checker groovy
+ "A groovy syntax checker using groovy compiler API.
+
+See URL `http://www.groovy-lang.org'."
+ :command ("groovy" "-e"
+ "import org.codehaus.groovy.control.*
+
+file = new File(args[0])
+unit = new CompilationUnit()
+unit.addSource(file)
+
+try {
+ unit.compile(Phases.CONVERSION)
+} catch (MultipleCompilationErrorsException e) {
+ e.errorCollector.write(new PrintWriter(System.out, true), null)
+}
+"
+ source)
+ :error-patterns
+ ((error line-start (file-name) ": " line ":" (message)
+ " @ line " line ", column " column "." line-end))
+ :modes groovy-mode)
+
+(flycheck-define-checker haml
+ "A Haml syntax checker using the Haml compiler.
+
+See URL `http://haml.info'."
+ :command ("haml" "-c" "--stdin")
+ :standard-input t
+ :error-patterns
+ ((error line-start "Syntax error on line " line ": " (message) line-end))
+ :modes haml-mode)
+
+(flycheck-define-checker handlebars
+ "A Handlebars syntax checker using the Handlebars compiler.
+
+See URL `http://handlebarsjs.com/'."
+ :command ("handlebars" "-i-")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ "Error: Parse error on line " line ":" (optional "\r") "\n"
+ (zero-or-more not-newline) "\n" (zero-or-more not-newline) "\n"
+ (message) line-end))
+ :modes (handlebars-mode handlebars-sgml-mode web-mode)
+ :predicate
+ (lambda ()
+ (if (eq major-mode 'web-mode)
+ ;; Check if this is a handlebars file since web-mode does not store the
+ ;; non-canonical engine name
+ (let* ((regexp-alist (bound-and-true-p web-mode-engine-file-regexps))
+ (pattern (cdr (assoc "handlebars" regexp-alist))))
+ (and pattern (buffer-file-name)
+ (string-match-p pattern (buffer-file-name))))
+ t)))
+
+(defconst flycheck-haskell-module-re
+ (rx line-start (zero-or-more (or "\n" (any space)))
+ "module" (one-or-more (or "\n" (any space)))
+ (group (one-or-more (not (any space "(" "\n")))))
+ "Regular expression for a Haskell module name.")
+
+(flycheck-def-args-var flycheck-ghc-args (haskell-stack-ghc haskell-ghc)
+ :package-version '(flycheck . "0.22"))
+
+(flycheck-def-option-var flycheck-ghc-no-user-package-database nil haskell-ghc
+ "Whether to disable the user package database in GHC.
+
+When non-nil, disable the user package database in GHC, via
+`-no-user-package-db'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.16"))
+
+(flycheck-def-option-var flycheck-ghc-package-databases nil haskell-ghc
+ "Additional module databases for GHC.
+
+The value of this variable is a list of strings, where each
+string is a directory of a package database. Each package
+database is given to GHC via `-package-db'."
+ :type '(repeat (directory :tag "Package database"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.16"))
+
+(flycheck-def-option-var flycheck-ghc-search-path nil
+ (haskell-stack-ghc haskell-ghc)
+ "Module search path for (Stack) GHC.
+
+The value of this variable is a list of strings, where each
+string is a directory containing Haskell modules. Each directory
+is added to the GHC search path via `-i'."
+ :type '(repeat (directory :tag "Module directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.16"))
+
+(flycheck-def-option-var flycheck-ghc-language-extensions nil
+ (haskell-stack-ghc haskell-ghc)
+ "Language extensions for (Stack) GHC.
+
+The value of this variable is a list of strings, where each
+string is a Haskell language extension, as in the LANGUAGE
+pragma. Each extension is enabled via `-X'."
+ :type '(repeat (string :tag "Language extension"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.19"))
+
+(defvar flycheck-haskell-ghc-cache-directory nil
+ "The cache directory for `ghc' output.")
+
+(defun flycheck-haskell-ghc-cache-directory ()
+ "Get the cache location for `ghc' output.
+
+If no cache directory exists yet, create one and return it.
+Otherwise return the previously used cache directory."
+ (setq flycheck-haskell-ghc-cache-directory
+ (or flycheck-haskell-ghc-cache-directory
+ (make-temp-file "flycheck-haskell-ghc-cache" 'directory))))
+
+(flycheck-define-checker haskell-stack-ghc
+ "A Haskell syntax and type checker using `stack ghc'.
+
+See URL `https://github.com/commercialhaskell/stack'."
+ :command ("stack" "ghc" "--" "-Wall" "-no-link"
+ "-outputdir" (eval (flycheck-haskell-ghc-cache-directory))
+ (option-list "-X" flycheck-ghc-language-extensions concat)
+ (option-list "-i" flycheck-ghc-search-path concat)
+ (eval (concat
+ "-i"
+ (flycheck-module-root-directory
+ (flycheck-find-in-buffer flycheck-haskell-module-re))))
+ (eval flycheck-ghc-args)
+ "-x" (eval
+ (pcase major-mode
+ (`haskell-mode "hs")
+ (`literate-haskell-mode "lhs")))
+ source)
+ :error-patterns
+ ((warning line-start (file-name) ":" line ":" column ":"
+ (or " " "\n ") "Warning:" (optional "\n")
+ (message
+ (one-or-more " ") (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))
+ line-end)
+ (error line-start (file-name) ":" line ":" column ":"
+ (or (message (one-or-more not-newline))
+ (and "\n"
+ (message
+ (one-or-more " ") (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))))
+ line-end))
+ :error-filter
+ (lambda (errors)
+ (flycheck-sanitize-errors (flycheck-dedent-error-messages errors)))
+ :modes (haskell-mode literate-haskell-mode)
+ :next-checkers ((warning . haskell-hlint)))
+
+(flycheck-define-checker haskell-ghc
+ "A Haskell syntax and type checker using ghc.
+
+See URL `http://www.haskell.org/ghc/'."
+ :command ("ghc" "-Wall" "-no-link"
+ "-outputdir" (eval (flycheck-haskell-ghc-cache-directory))
+ (option-flag "-no-user-package-db"
+ flycheck-ghc-no-user-package-database)
+ (option-list "-package-db" flycheck-ghc-package-databases)
+ (option-list "-i" flycheck-ghc-search-path concat)
+ ;; Include the parent directory of the current module tree, to
+ ;; properly resolve local imports
+ (eval (concat
+ "-i"
+ (flycheck-module-root-directory
+ (flycheck-find-in-buffer flycheck-haskell-module-re))))
+ (option-list "-X" flycheck-ghc-language-extensions concat)
+ (eval flycheck-ghc-args)
+ "-x" (eval
+ (pcase major-mode
+ (`haskell-mode "hs")
+ (`literate-haskell-mode "lhs")))
+ source)
+ :error-patterns
+ ((warning line-start (file-name) ":" line ":" column ":"
+ (or " " "\n ") "Warning:" (optional "\n")
+ (message
+ (one-or-more " ") (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))
+ line-end)
+ (error line-start (file-name) ":" line ":" column ":"
+ (or (message (one-or-more not-newline))
+ (and "\n"
+ (message
+ (one-or-more " ") (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))))
+ line-end))
+ :error-filter
+ (lambda (errors)
+ (flycheck-sanitize-errors (flycheck-dedent-error-messages errors)))
+ :modes (haskell-mode literate-haskell-mode)
+ :next-checkers ((warning . haskell-hlint)))
+
+(flycheck-def-config-file-var flycheck-hlintrc haskell-hlint "HLint.hs"
+ :safe #'stringp)
+
+(flycheck-def-args-var flycheck-hlint-args haskell-hlint
+ :package-version '(flycheck . "0.25"))
+
+(flycheck-def-option-var flycheck-hlint-language-extensions
+ nil haskell-hlint
+ "Extensions list to enable for hlint.
+
+The value of this variable is a list of strings, where each
+string is a name of extension to enable in
+hlint (e.g. \"QuasiQuotes\")."
+ :type '(repeat :tag "Extensions" (string :tag "Extension"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-def-option-var flycheck-hlint-ignore-rules
+ nil haskell-hlint
+ "Ignore rules list for hlint checks.
+
+The value of this variable is a list of strings, where each
+string is an ignore rule (e.g. \"Use fmap\")."
+ :type '(repeat :tag "Ignore rules" (string :tag "Ignore rule"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-def-option-var flycheck-hlint-hint-packages
+ nil haskell-hlint
+ "Hint packages to include for hlint checks.
+
+The value of this variable is a list of strings, where each
+string is a default hint package (e.g. (\"Generalise\"
+\"Default\" \"Dollar\"))."
+ :type '(repeat :tag "Hint packages" (string :tag "Hint package"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-define-checker haskell-hlint
+ "A Haskell style checker using hlint.
+
+See URL `https://github.com/ndmitchell/hlint'."
+ :command ("hlint"
+ (option-list "-X" flycheck-hlint-language-extensions concat)
+ (option-list "-i=" flycheck-hlint-ignore-rules concat)
+ (option-list "-h" flycheck-hlint-hint-packages concat)
+ (config-file "-h" flycheck-hlintrc)
+ (eval flycheck-hlint-args)
+ source-inplace)
+ :error-patterns
+ ((info line-start
+ (file-name) ":" line ":" column
+ ": Suggestion: "
+ (message (one-or-more (and (one-or-more (not (any ?\n))) ?\n)))
+ line-end)
+ (warning line-start
+ (file-name) ":" line ":" column
+ ": Warning: "
+ (message (one-or-more (and (one-or-more (not (any ?\n))) ?\n)))
+ line-end)
+ (error line-start
+ (file-name) ":" line ":" column
+ ": Error: "
+ (message (one-or-more (and (one-or-more (not (any ?\n))) ?\n)))
+ line-end))
+ :modes (haskell-mode literate-haskell-mode))
+
+(flycheck-def-config-file-var flycheck-tidyrc html-tidy ".tidyrc"
+ :safe #'stringp)
+
+(flycheck-define-checker html-tidy
+ "A HTML syntax and style checker using Tidy.
+
+See URL `https://github.com/w3c/tidy-html5'."
+ :command ("tidy" (config-file "-config" flycheck-tidyrc) "-e" "-q")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ "line " line
+ " column " column
+ " - Error: " (message) line-end)
+ (warning line-start
+ "line " line
+ " column " column
+ " - Warning: " (message) line-end))
+ :modes (html-mode nxhtml-mode))
+
+(flycheck-define-checker jade
+ "A Jade syntax checker using the Jade compiler.
+
+See URL `http://jade-lang.com'."
+ :command ("jade")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ "Error: Jade:" line (zero-or-more not-newline) "\n"
+ (one-or-more (and (zero-or-more not-newline) "|"
+ (zero-or-more not-newline) "\n"))
+ (zero-or-more not-newline) "\n" (message) line-end))
+ :modes jade-mode)
+
+(flycheck-def-config-file-var flycheck-jshintrc javascript-jshint ".jshintrc"
+ :safe #'stringp)
+
+(flycheck-def-option-var flycheck-jshint-extract-javascript nil
+ javascript-jshint
+ "Whether jshint should extract Javascript from HTML.
+
+If nil no extract rule is given to jshint. If `auto' only
+extract Javascript if a HTML file is detected. If `always' or
+`never' extract Javascript always or never respectively.
+
+Refer to the jshint manual at the URL
+`http://jshint.com/docs/cli/#flags' for more information."
+ :type
+ '(choice (const :tag "No extraction rule" nil)
+ (const :tag "Try to extract Javascript when detecting HTML files"
+ auto)
+ (const :tag "Always try to extract Javascript" always)
+ (const :tag "Never try to extract Javascript" never))
+ :safe #'symbolp
+ :package-version '(flycheck . "0.26"))
+
+(flycheck-define-checker javascript-jshint
+ "A Javascript syntax and style checker using jshint.
+
+See URL `http://www.jshint.com'."
+ :command ("jshint" "--reporter=checkstyle"
+ "--filename" source-original
+ (config-file "--config" flycheck-jshintrc)
+ (option "--extract=" flycheck-jshint-extract-javascript
+ concat flycheck-option-symbol)
+ "-")
+ :standard-input t
+ :error-parser flycheck-parse-checkstyle
+ :error-filter
+ (lambda (errors)
+ (flycheck-remove-error-file-names
+ "stdin" (flycheck-dequalify-error-ids errors)))
+ :modes (js-mode js2-mode js3-mode)
+ :next-checkers ((warning . javascript-jscs)))
+
+(flycheck-def-option-var flycheck-eslint-rulesdir nil javascript-eslint
+ "The directory of custom rules for ESLint.
+
+The value of this variable is either a string containing the path
+to a directory with custom rules, or nil, to not give any custom
+rules to ESLint.
+
+Refer to the ESLint manual at URL
+`https://github.com/eslint/eslint/tree/master/docs/command-line-interface#--rulesdir'
+for more information about the custom directory."
+ :type '(choice (const :tag "No custom rules directory" nil)
+ (directory :tag "Custom rules directory"))
+ :safe #'stringp
+ :package-version '(flycheck . "0.16"))
+
+(flycheck-def-config-file-var flycheck-eslintrc javascript-eslint nil
+ :safe #'stringp
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-define-checker javascript-eslint
+ "A Javascript syntax and style checker using eslint.
+
+See URL `https://github.com/eslint/eslint'."
+ :command ("eslint" "--format=checkstyle"
+ (config-file "--config" flycheck-eslintrc)
+ (option "--rulesdir" flycheck-eslint-rulesdir)
+ "--stdin" "--stdin-filename" source-original)
+ :standard-input t
+ :error-parser flycheck-parse-checkstyle
+ :error-filter (lambda (errors)
+ (seq-do (lambda (err)
+ ;; Parse error ID from the error message
+ (setf (flycheck-error-message err)
+ (replace-regexp-in-string
+ (rx " ("
+ (group (one-or-more (not (any ")"))))
+ ")" string-end)
+ (lambda (s)
+ (setf (flycheck-error-id err)
+ (match-string 1 s))
+ "")
+ (flycheck-error-message err))))
+ (flycheck-sanitize-errors errors))
+ errors)
+ :modes (js-mode js-jsx-mode js2-mode js2-jsx-mode js3-mode)
+ :next-checkers ((warning . javascript-jscs)))
+
+(flycheck-def-config-file-var flycheck-gjslintrc javascript-gjslint ".gjslintrc"
+ :safe #'stringp)
+
+(flycheck-define-checker javascript-gjslint
+ "A Javascript syntax and style checker using Closure Linter.
+
+See URL `https://developers.google.com/closure/utilities'."
+ :command ("gjslint" "--unix_mode"
+ (config-file "--flagfile" flycheck-gjslintrc)
+ source)
+ :error-patterns ((warning
+ line-start (file-name) ":" line ":("
+ (id (one-or-more digit)) ") " (message) line-end))
+ :modes (js-mode js2-mode js3-mode)
+ :next-checkers ((warning . javascript-jscs)))
+
+(defun flycheck-parse-jscs (output checker buffer)
+ "Parse JSCS OUTPUT from CHECKER and BUFFER.
+
+Like `flycheck-parse-checkstyle', but catches errors about no
+configuration found and prevents to be reported as a suspicious
+error."
+ (if (string-match-p (rx string-start "No configuration found") output)
+ (let ((message "No JSCS configuration found. Set `flycheck-jscsrc' for JSCS"))
+ (list (flycheck-error-new-at 1 nil 'warning message
+ :checker checker
+ :buffer buffer
+ :filename (buffer-file-name buffer))))
+ (flycheck-parse-checkstyle output checker buffer)))
+
+(flycheck-def-config-file-var flycheck-jscsrc javascript-jscs ".jscsrc"
+ :safe #'stringp
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-define-checker javascript-jscs
+ "A Javascript style checker using JSCS.
+
+See URL `http://www.jscs.info'."
+ :command ("jscs" "--reporter=checkstyle"
+ (config-file "--config" flycheck-jscsrc)
+ "-")
+ :standard-input t
+ :error-parser flycheck-parse-jscs
+ :error-filter (lambda (errors)
+ (flycheck-remove-error-ids
+ (flycheck-sanitize-errors
+ (flycheck-remove-error-file-names "input" errors))))
+ :modes (js-mode js-jsx-mode js2-mode js2-jsx-mode js3-mode))
+
+(flycheck-define-checker javascript-standard
+ "A Javascript code and style checker for the (Semi-)Standard Style.
+
+This checker works with `standard' and `semistandard', defaulting
+to the former. To use it with the latter, set
+`flycheck-javascript-standard-executable' to `semistandard'.
+
+See URL `https://github.com/feross/standard' and URL
+`https://github.com/Flet/semistandard'."
+ :command ("standard" "--stdin")
+ :standard-input t
+ :error-patterns
+ ((error line-start " <text>:" line ":" column ":" (message) line-end))
+ :modes (js-mode js-jsx-mode js2-mode js2-jsx-mode js3-mode))
+
+(flycheck-define-checker json-jsonlint
+ "A JSON syntax and style checker using jsonlint.
+
+See URL `https://github.com/zaach/jsonlint'."
+ ;; We can't use standard input for jsonlint, because it doesn't output errors
+ ;; anymore when using -c -q with standard input :/
+ :command ("jsonlint" "-c" "-q" source)
+ :error-patterns
+ ((error line-start
+ (file-name)
+ ": line " line
+ ", col " column ", "
+ (message) line-end))
+ :error-filter
+ (lambda (errors)
+ (flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
+ :predicate
+ (lambda ()
+ (or
+ (eq major-mode 'json-mode)
+ (and (buffer-file-name)
+ (string= (file-name-extension (buffer-file-name)) "json")))))
+
+(flycheck-define-checker json-python-json
+ "A JSON syntax checker using Python json.tool module.
+
+See URL `https://docs.python.org/3.5/library/json.html#command-line-interface'."
+ :command ("python" "-m" "json.tool" source
+ ;; Send the pretty-printed output to the null device
+ null-device)
+ :error-patterns
+ ((error line-start
+ (message) ": line " line " column " column
+ ;; Ignore the rest of the line which shows the char position.
+ (one-or-more not-newline)
+ line-end))
+ :predicate
+ (lambda ()
+ (or
+ (eq major-mode 'json-mode)
+ (and (buffer-file-name)
+ (string= (file-name-extension (buffer-file-name)) "json")))))
+
+(flycheck-define-checker less
+ "A LESS syntax checker using lessc.
+
+At least version 1.4 of lessc is required.
+
+See URL `http://lesscss.org'."
+ :command ("lessc" "--lint" "--no-color"
+ "-")
+ :standard-input t
+ :error-patterns
+ ((error line-start (one-or-more word) ":"
+ (message)
+ " in - on line " line
+ ", column " column ":"
+ line-end))
+ :modes less-css-mode)
+
+(flycheck-def-config-file-var flycheck-luacheckrc luacheck ".luacheckrc"
+ :safe #'stringp
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-define-checker luacheck
+ "A Lua syntax checker using luacheck.
+
+See URL `https://github.com/mpeterv/luacheck'."
+ :command ("luacheck"
+ (config-file "--config" flycheck-luacheckrc)
+ "--formatter" "plain"
+ "--codes" ; Show warning codes
+ "--no-color"
+ ;; Read from standard input
+ "-")
+ :standard-input t
+ :error-patterns
+ ((warning line-start "stdin:" line ":" column
+ ": (" (id "W" (one-or-more digit)) ") "
+ (message) line-end)
+ (error line-start "stdin:" line ":" column ":"
+ ;; `luacheck' before 0.11.0 did not output codes for errors, hence
+ ;; the ID is optional here
+ (optional " (" (id "E" (one-or-more digit)) ") ")
+ (message) line-end))
+ :modes lua-mode)
+
+(flycheck-define-checker lua
+ "A Lua syntax checker using the Lua compiler.
+
+See URL `http://www.lua.org/'."
+ :command ("luac" "-p" "-")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ ;; Skip the name of the luac executable.
+ (minimal-match (zero-or-more not-newline))
+ ": stdin:" line ": " (message) line-end))
+ :modes lua-mode)
+
+(flycheck-def-option-var flycheck-perl-include-path nil perl
+ "A list of include directories for Perl.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of Perl.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-define-checker perl
+ "A Perl syntax checker using the Perl interpreter.
+
+See URL `http://www.perl.org'."
+ :command ("perl" "-w" "-c"
+ (option-list "-I" flycheck-perl-include-path))
+ :standard-input t
+ :error-patterns
+ ((error line-start (minimal-match (message))
+ " at - line " line
+ (or "." (and ", " (zero-or-more not-newline))) line-end))
+ :modes (perl-mode cperl-mode)
+ :next-checkers (perl-perlcritic))
+
+(flycheck-def-option-var flycheck-perlcritic-severity nil perl-perlcritic
+ "The message severity for Perl Critic.
+
+The value of this variable is a severity level as integer, for
+the `--severity' option to Perl Critic."
+ :type '(integer :tag "Severity level")
+ :safe #'integerp
+ :package-version '(flycheck . "0.18"))
+
+(flycheck-def-config-file-var flycheck-perlcriticrc perl-perlcritic
+ ".perlcriticrc"
+ :safe #'stringp
+ :package-version '(flycheck . "0.26"))
+
+(flycheck-define-checker perl-perlcritic
+ "A Perl syntax checker using Perl::Critic.
+
+See URL `https://metacpan.org/pod/Perl::Critic'."
+ :command ("perlcritic" "--no-color" "--verbose" "%f/%l/%c/%s/%p/%m (%e)\n"
+ (config-file "--profile" flycheck-perlcriticrc)
+ (option "--severity" flycheck-perlcritic-severity nil
+ flycheck-option-int))
+ :standard-input t
+ :error-patterns
+ ((info line-start
+ "STDIN/" line "/" column "/" (any "1") "/"
+ (id (one-or-more (not (any "/")))) "/" (message)
+ line-end)
+ (warning line-start
+ "STDIN/" line "/" column "/" (any "234") "/"
+ (id (one-or-more (not (any "/")))) "/" (message)
+ line-end)
+ (error line-start
+ "STDIN/" line "/" column "/" (any "5") "/"
+ (id (one-or-more (not (any "/")))) "/" (message)
+ line-end))
+ :modes (cperl-mode perl-mode))
+
+(flycheck-define-checker php
+ "A PHP syntax checker using the PHP command line interpreter.
+
+See URL `http://php.net/manual/en/features.commandline.php'."
+ :command ("php" "-l" "-d" "error_reporting=E_ALL" "-d" "display_errors=1"
+ "-d" "log_errors=0")
+ :standard-input t
+ :error-patterns
+ ((error line-start (or "Parse" "Fatal" "syntax") " error" (any ":" ",") " "
+ (message) " in - on line " line line-end))
+ :modes (php-mode php+-mode)
+ :next-checkers ((warning . php-phpmd)
+ (warning . php-phpcs)))
+
+(flycheck-def-option-var flycheck-phpmd-rulesets
+ '("cleancode" "codesize" "controversial" "design" "naming" "unusedcode")
+ php-phpmd
+ "The rule sets for PHP Mess Detector.
+
+Set default rule sets and custom rule set files.
+
+See section \"Using multiple rule sets\" in the PHP Mess Detector
+manual at URL `http://phpmd.org/documentation/index.html'."
+ :type '(repeat :tag "rule sets"
+ (string :tag "A filename or rule set"))
+ :safe #'flycheck-string-list-p)
+
+(flycheck-define-checker php-phpmd
+ "A PHP style checker using PHP Mess Detector.
+
+See URL `http://phpmd.org/'."
+ :command ("phpmd" source "xml"
+ (eval (flycheck-option-comma-separated-list
+ flycheck-phpmd-rulesets)))
+ :error-parser flycheck-parse-phpmd
+ :modes (php-mode php+-mode)
+ :next-checkers (php-phpcs))
+
+(flycheck-def-option-var flycheck-phpcs-standard nil php-phpcs
+ "The coding standard for PHP CodeSniffer.
+
+When nil, use the default standard from the global PHP
+CodeSniffer configuration. When set to a string, pass the string
+to PHP CodeSniffer which will interpret it as name as a standard,
+or as path to a standard specification."
+ :type '(choice (const :tag "Default standard" nil)
+ (string :tag "Standard name or file"))
+ :safe #'stringp)
+
+(flycheck-define-checker php-phpcs
+ "A PHP style checker using PHP_CodeSniffer.
+
+See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
+ :command ("phpcs" "--report=checkstyle"
+ (option "--standard=" flycheck-phpcs-standard concat))
+ :standard-input t
+ :error-parser flycheck-parse-checkstyle
+ :error-filter
+ (lambda (errors)
+ (flycheck-sanitize-errors
+ (flycheck-remove-error-file-names "STDIN" errors)))
+ :modes (php-mode php+-mode))
+
+(flycheck-define-checker processing
+ "Processing command line tool.
+
+See https://github.com/processing/processing/wiki/Command-Line"
+ :command ("processing-java" "--force"
+ ;; Don't change the order of these arguments, processing is pretty
+ ;; picky
+ (eval (concat "--sketch=" (file-name-directory (buffer-file-name))))
+ (eval (concat "--output=" (flycheck-temp-dir-system)))
+ "--build")
+ :error-patterns
+ ((error line-start (file-name) ":" line ":" column
+ (zero-or-more (or digit ":")) (message) line-end))
+ :modes processing-mode
+ ;; This syntax checker needs a file name
+ :predicate (lambda () (buffer-file-name)))
+
+(flycheck-define-checker puppet-parser
+ "A Puppet DSL syntax checker using puppet's own parser.
+
+See URL `http://puppetlabs.com/'."
+ :command ("puppet" "parser" "validate" "--color=false")
+ :standard-input t
+ :error-patterns
+ (
+ ;; Patterns for Puppet 4
+ (error line-start "Error: Could not parse for environment "
+ (one-or-more (in "a-z" "0-9" "_")) ":"
+ (message) " at line " line ":" column line-end)
+ ;; Errors from Puppet < 4
+ (error line-start
+ ;; Skip over the path of the Puppet executable
+ (minimal-match (zero-or-more not-newline))
+ ": Could not parse for environment " (one-or-more word)
+ ": " (message (minimal-match (zero-or-more anything)))
+ " at " (file-name "/" (zero-or-more not-newline)) ":" line line-end))
+ :modes puppet-mode
+ :next-checkers ((warning . puppet-lint)))
+
+(flycheck-def-config-file-var flycheck-puppet-lint-rc puppet-lint
+ ".puppet-lint.rc"
+ :safe #'stringp
+ :package-version '(flycheck . "0.26"))
+
+(flycheck-def-option-var flycheck-puppet-lint-disabled-checks nil puppet-lint
+ "Disabled checkers for `puppet-lint'.
+
+The value of this variable is a list of strings, where each
+string is the name of a check to disable (e.g. \"80chars\" or
+\"double_quoted_strings\").
+
+See URL `http://puppet-lint.com/checks/' for a list of all checks
+and their names."
+ :type '(repeat (string :tag "Check Name"))
+ :package-version '(flycheck . "0.26"))
+
+(defun flycheck-puppet-lint-disabled-arg-name (check)
+ "Create an argument to disable a puppetlint CHECK."
+ (concat "--no-" check "-check"))
+
+(flycheck-define-checker puppet-lint
+ "A Puppet DSL style checker using puppet-lint.
+
+See URL `http://puppet-lint.com/'."
+ ;; We must check the original file, because Puppetlint is quite picky on the
+ ;; names of files and there place in the directory structure, to comply with
+ ;; Puppet's autoload directory layout. For instance, a class foo::bar is
+ ;; required to be in a file foo/bar.pp. Any other place, such as a Flycheck
+ ;; temporary file will cause an error.
+ :command ("puppet-lint"
+ (config-file "--config" flycheck-puppet-lint-rc)
+ "--log-format"
+ "%{path}:%{linenumber}:%{kind}: %{message} (%{check})"
+ (option-list "" flycheck-puppet-lint-disabled-checks concat
+ flycheck-puppet-lint-disabled-arg-name)
+ source-original)
+ :error-patterns
+ ((warning line-start (file-name) ":" line ":warning: " (message) line-end)
+ (error line-start (file-name) ":" line ":error: " (message) line-end))
+ :modes puppet-mode
+ ;; Since we check the original file, we can only use this syntax checker if
+ ;; the buffer is actually linked to a file, and if it is not modified.
+ :predicate flycheck-buffer-saved-p)
+
+(flycheck-def-config-file-var flycheck-flake8rc python-flake8 ".flake8rc"
+ :safe #'stringp)
+
+(flycheck-def-option-var flycheck-flake8-error-level-alist
+ '(("^E9.*$" . error) ; Syntax errors from pep8
+ ("^F82.*$" . error) ; undefined variables from pyflakes
+ ("^F83.*$" . error) ; Duplicate arguments from flake8
+ ("^D.*$" . info) ; Docstring issues from flake8-pep257
+ ("^N.*$" . info) ; Naming issues from pep8-naming
+ )
+ python-flake8
+ "An alist mapping flake8 error IDs to Flycheck error levels.
+
+Each item in this list is a cons cell `(PATTERN . LEVEL)' where
+PATTERN is a regular expression matched against the error ID, and
+LEVEL is a Flycheck error level symbol.
+
+Each PATTERN is matched in the order of appearance in this list
+against the error ID. If it matches the ID, the level of the
+corresponding error is set to LEVEL. An error that is not
+matched by any PATTERN defaults to warning level.
+
+The default value of this option matches errors from flake8
+itself and from the following flake8 plugins:
+
+- pep8-naming
+- flake8-pep257
+
+You may add your own mappings to this option in order to support
+further flake8 plugins."
+ :type '(repeat (cons (regexp :tag "Error ID pattern")
+ (symbol :tag "Error level")))
+ :package-version '(flycheck . "0.22"))
+
+(flycheck-def-option-var flycheck-flake8-maximum-complexity nil python-flake8
+ "The maximum McCabe complexity of methods.
+
+If nil, do not check the complexity of methods. If set to an
+integer, report any complexity greater than the value of this
+variable as warning.
+
+If set to an integer, this variable overrules any similar setting
+in the configuration file denoted by `flycheck-flake8rc'."
+ :type '(choice (const :tag "Do not check McCabe complexity" nil)
+ (integer :tag "Maximum complexity"))
+ :safe #'integerp)
+
+(flycheck-def-option-var flycheck-flake8-maximum-line-length nil python-flake8
+ "The maximum length of lines.
+
+If set to an integer, the value of this variable denotes the
+maximum length of lines, overruling any similar setting in the
+configuration file denoted by `flycheck-flake8rc'. An error will
+be reported for any line longer than the value of this variable.
+
+If set to nil, use the maximum line length from the configuration
+file denoted by `flycheck-flake8rc', or the PEP 8 recommendation
+of 79 characters if there is no configuration with this setting."
+ :type '(choice (const :tag "Default value")
+ (integer :tag "Maximum line length in characters"))
+ :safe #'integerp)
+
+(defun flycheck-flake8-fix-error-level (err)
+ "Fix the error level of ERR.
+
+Update the error level of ERR according to
+`flycheck-flake8-error-level-alist'."
+ (pcase-dolist (`(,pattern . ,level) flycheck-flake8-error-level-alist)
+ (when (string-match-p pattern (flycheck-error-id err))
+ (setf (flycheck-error-level err) level)))
+ err)
+
+(flycheck-define-checker python-flake8
+ "A Python syntax and style checker using Flake8.
+
+Requires Flake8 2.0 or newer. See URL
+`https://pypi.python.org/pypi/flake8'."
+ :command ("flake8"
+ "--format=default"
+ (config-file "--config" flycheck-flake8rc)
+ (option "--max-complexity" flycheck-flake8-maximum-complexity nil
+ flycheck-option-int)
+ (option "--max-line-length" flycheck-flake8-maximum-line-length nil
+ flycheck-option-int)
+ "-")
+ :standard-input t
+ :error-filter (lambda (errors)
+ (let ((errors (flycheck-sanitize-errors errors)))
+ (seq-do #'flycheck-flake8-fix-error-level errors)
+ errors))
+ :error-patterns
+ ((warning line-start
+ "stdin:" line ":" (optional column ":") " "
+ (id (one-or-more (any alpha)) (one-or-more digit)) " "
+ (message (one-or-more not-newline))
+ line-end))
+ :modes python-mode)
+
+(flycheck-def-config-file-var flycheck-pylintrc python-pylint
+ ".pylintrc"
+ :safe #'stringp)
+
+(flycheck-def-option-var flycheck-pylint-use-symbolic-id t python-pylint
+ "Whether to use pylint message symbols or message codes.
+
+A pylint message has both an opaque identifying code (such as `F0401') and a
+more meaningful symbolic code (such as `import-error'). This option governs
+which should be used and reported to the user."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.25"))
+
+(flycheck-define-checker python-pylint
+ "A Python syntax and style checker using Pylint.
+
+This syntax checker requires Pylint 1.0 or newer.
+
+See URL `http://www.pylint.org/'."
+ ;; -r n disables the scoring report
+ :command ("pylint" "-r" "n"
+ "--msg-template"
+ (eval (if flycheck-pylint-use-symbolic-id
+ "{path}:{line}:{column}:{C}:{symbol}:{msg}"
+ "{path}:{line}:{column}:{C}:{msg_id}:{msg}"))
+ (config-file "--rcfile" flycheck-pylintrc)
+ ;; Need `source-inplace' for relative imports (e.g. `from .foo
+ ;; import bar'), see https://github.com/flycheck/flycheck/issues/280
+ source-inplace)
+ :error-filter
+ (lambda (errors)
+ (flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
+ :error-patterns
+ ((error line-start (file-name) ":" line ":" column ":"
+ (or "E" "F") ":"
+ (id (one-or-more (not (any ":")))) ":"
+ (message) line-end)
+ (warning line-start (file-name) ":" line ":" column ":"
+ (or "W" "R") ":"
+ (id (one-or-more (not (any ":")))) ":"
+ (message) line-end)
+ (info line-start (file-name) ":" line ":" column ":"
+ "C:" (id (one-or-more (not (any ":")))) ":"
+ (message) line-end))
+ :modes python-mode)
+
+(flycheck-define-checker python-pycompile
+ "A Python syntax checker using Python's builtin compiler.
+
+See URL `https://docs.python.org/3.4/library/py_compile.html'."
+ :command ("python" "-m" "py_compile" source)
+ :error-patterns
+ ;; Python 2.7
+ ((error line-start " File \"" (file-name) "\", line " line "\n"
+ (= 2 (zero-or-more not-newline) "\n")
+ "SyntaxError: " (message) line-end)
+ (error line-start "Sorry: IndentationError: "
+ (message) "(" (file-name) ", line " line ")"
+ line-end)
+ ;; 2.6
+ (error line-start "SyntaxError: ('" (message (one-or-more (not (any "'"))))
+ "', ('" (file-name (one-or-more (not (any "'")))) "', "
+ line ", " column ", " (one-or-more not-newline) line-end))
+ :modes python-mode)
+
+(flycheck-def-option-var flycheck-lintr-caching t r-lintr
+ "Whether to enable caching in lintr.
+
+By default, lintr caches all expressions in a file and re-checks
+only those that have changed. Setting this option to nil
+disables caching in case there are problems."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-def-option-var flycheck-lintr-linters "default_linters" r-lintr
+ "Linters to use with lintr.
+
+The value of this variable is a string containing an R
+expression, which selects linters for lintr."
+ :type 'string
+ :risky t
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-define-checker r-lintr
+ "An R style and syntax checker using the lintr package.
+
+See URL `https://github.com/jimhester/lintr'."
+ :command ("R" "--slave" "--restore" "--no-save" "-e"
+ (eval (concat
+ "library(lintr);"
+ "try(lint(commandArgs(TRUE)"
+ ", cache=" (if flycheck-lintr-caching "TRUE" "FALSE")
+ ", " flycheck-lintr-linters
+ "))"))
+ "--args" source)
+ :error-patterns
+ ((info line-start (file-name) ":" line ":" column ": style: " (message)
+ line-end)
+ (warning line-start (file-name) ":" line ":" column ": warning: " (message)
+ line-end)
+ (error line-start (file-name) ":" line ":" column ": error: " (message)
+ line-end))
+ :modes ess-mode
+ ;; Don't check ESS files which do not contain R
+ :predicate (lambda () (equal ess-language "S")))
+
+(flycheck-define-checker rpm-rpmlint
+ "A RPM SPEC file syntax checker using rpmlint.
+
+See URL `http://sourceforge.net/projects/rpmlint/'."
+ :command ("rpmlint" source)
+ :error-patterns
+ ((error line-start
+ (file-name) ":" (optional line ":") " E: " (message)
+ line-end)
+ (warning line-start
+ (file-name) ":" (optional line ":") " W: " (message)
+ line-end))
+ :error-filter
+ ;; Add fake line numbers if they are missing in the lint output
+ (lambda (errors)
+ (dolist (err errors)
+ (unless (flycheck-error-line err)
+ (setf (flycheck-error-line err) 1)))
+ errors)
+ :modes (sh-mode rpm-spec-mode)
+ :predicate (lambda () (or (not (eq major-mode 'sh-mode))
+ ;; In `sh-mode', we need the proper shell
+ (eq sh-shell 'rpm))))
+
+(defun flycheck-locate-sphinx-source-directory ()
+ "Locate the Sphinx source directory for the current buffer.
+
+Return the source directory, or nil, if the current buffer is not
+part of a Sphinx project."
+ (-when-let* ((filename (buffer-file-name))
+ (dir (locate-dominating-file filename "conf.py")))
+ (expand-file-name dir)))
+
+(flycheck-define-checker rst
+ "A ReStructuredText (RST) syntax checker using Docutils.
+
+See URL `http://docutils.sourceforge.net/'."
+ ;; We need to use source-inplace to properly resolve relative paths in
+ ;; include:: directives
+ :command ("rst2pseudoxml.py" "--report=2" "--halt=5"
+ ;; Read from standard input and throw output away
+ "-" null-device)
+ :standard-input t
+ :error-patterns
+ ((warning line-start "<stdin>:" line ": (WARNING/2) " (message) line-end)
+ (error line-start "<stdin>:" line
+ ": (" (or "ERROR/3" "SEVERE/4") ") "
+ (message) line-end))
+ :modes rst-mode)
+
+(flycheck-def-option-var flycheck-sphinx-warn-on-missing-references t rst-sphinx
+ "Whether to warn about missing references in Sphinx.
+
+When non-nil (the default), warn about all missing references in
+Sphinx via `-n'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.17"))
+
+(flycheck-define-checker rst-sphinx
+ "A ReStructuredText (RST) syntax checker using Sphinx.
+
+Requires Sphinx 1.2 or newer. See URL `http://sphinx-doc.org'."
+ :command ("sphinx-build" "-b" "pseudoxml"
+ "-q" "-N" ; Reduced output and no colors
+ (option-flag "-n" flycheck-sphinx-warn-on-missing-references)
+ (eval (flycheck-locate-sphinx-source-directory))
+ temporary-directory ; Redirect the output to a temporary
+ ; directory
+ source-original) ; Sphinx needs the original document
+ :error-patterns
+ ((warning line-start (file-name) ":" line ": WARNING: " (message) line-end)
+ (error line-start
+ (file-name) ":" line
+ ": " (or "ERROR" "SEVERE") ": "
+ (message) line-end))
+ :modes rst-mode
+ :predicate (lambda () (and (flycheck-buffer-saved-p)
+ (flycheck-locate-sphinx-source-directory))))
+
+(flycheck-def-config-file-var flycheck-rubocoprc ruby-rubocop ".rubocop.yml"
+ :safe #'stringp)
+
+(flycheck-def-option-var flycheck-rubocop-lint-only nil ruby-rubocop
+ "Whether to only report code issues in Rubocop.
+
+When non-nil, only report code issues in Rubocop, via `--lint'.
+Otherwise report style issues as well."
+ :safe #'booleanp
+ :type 'boolean
+ :package-version '(flycheck . "0.16"))
+
+(flycheck-define-checker ruby-rubocop
+ "A Ruby syntax and style checker using the RuboCop tool.
+
+You need at least RuboCop 0.34 for this syntax checker.
+
+See URL `http://batsov.com/rubocop/'."
+ :command ("rubocop" "--display-cop-names" "--format" "emacs"
+ ;; Explicitly disable caching to prevent Rubocop 0.35.1 and earlier
+ ;; from caching standard input. Later versions of Rubocop
+ ;; automatically disable caching with --stdin, see
+ ;; https://github.com/flycheck/flycheck/issues/844 and
+ ;; https://github.com/bbatsov/rubocop/issues/2576
+ "--cache" "false"
+ (config-file "--config" flycheck-rubocoprc)
+ (option-flag "--lint" flycheck-rubocop-lint-only)
+ ;; Rubocop takes the original file name as argument when reading
+ ;; from standard input
+ "--stdin" source-original)
+ :standard-input t
+ :error-patterns
+ ((info line-start (file-name) ":" line ":" column ": C: "
+ (optional (id (one-or-more (not (any ":")))) ": ") (message) line-end)
+ (warning line-start (file-name) ":" line ":" column ": W: "
+ (optional (id (one-or-more (not (any ":")))) ": ") (message)
+ line-end)
+ (error line-start (file-name) ":" line ":" column ": " (or "E" "F") ": "
+ (optional (id (one-or-more (not (any ":")))) ": ") (message)
+ line-end))
+ :modes (enh-ruby-mode ruby-mode)
+ :next-checkers ((warning . ruby-rubylint)))
+
+;; Default to `nil' to let Rubylint find its configuration file by itself, and
+;; to maintain backwards compatibility with older Rubylint and Flycheck releases
+(flycheck-def-config-file-var flycheck-rubylintrc ruby-rubylint nil
+ :safe #'stringp)
+
+(flycheck-define-checker ruby-rubylint
+ "A Ruby syntax and code analysis checker using ruby-lint.
+
+Requires ruby-lint 2.0 or newer. To use `flycheck-rubylintrc',
+ruby-lint 2.0.2 or newer is required. See URL
+`https://github.com/YorickPeterse/ruby-lint'."
+ :command ("ruby-lint" "--presenter=syntastic"
+ (config-file "--config" flycheck-rubylintrc)
+ source)
+ ;; Ruby Lint can't read from standard input
+ :error-patterns
+ ((info line-start
+ (file-name) ":I:" line ":" column ": " (message) line-end)
+ (warning line-start
+ (file-name) ":W:" line ":" column ": " (message) line-end)
+ (error line-start
+ (file-name) ":E:" line ":" column ": " (message) line-end))
+ :modes (enh-ruby-mode ruby-mode))
+
+(flycheck-define-checker ruby
+ "A Ruby syntax checker using the standard Ruby interpreter.
+
+Please note that the output of different Ruby versions and
+implementations varies wildly. This syntax checker supports
+current versions of MRI and JRuby, but may break when used with
+other implementations or future versions of these
+implementations.
+
+Please consider using `ruby-rubocop' or `ruby-rubylint' instead.
+
+See URL `https://www.ruby-lang.org/'."
+ :command ("ruby" "-w" "-c")
+ :standard-input t
+ :error-patterns
+ ;; These patterns support output from JRuby, too, to deal with RVM or Rbenv
+ ((error line-start "SyntaxError in -:" line ": " (message) line-end)
+ (warning line-start "-:" line ":" (optional column ":")
+ " warning: " (message) line-end)
+ (error line-start "-:" line ": " (message) line-end))
+ :modes (enh-ruby-mode ruby-mode)
+ :next-checkers ((warning . ruby-rubylint)))
+
+(flycheck-define-checker ruby-jruby
+ "A Ruby syntax checker using the JRuby interpreter.
+
+This syntax checker is very primitive, and may break on future
+versions of JRuby.
+
+Please consider using `ruby-rubocop' or `ruby-rubylint' instead.
+
+See URL `http://jruby.org/'."
+ :command ("jruby" "-w" "-c")
+ :standard-input t
+ :error-patterns
+ ((error line-start "SyntaxError in -:" line ": " (message) line-end)
+ (warning line-start "-:" line " warning: " (message) line-end)
+ (error line-start "-:" line ": " (message) line-end))
+ :modes (enh-ruby-mode ruby-mode)
+ :next-checkers ((warning . ruby-rubylint)))
+
+(flycheck-def-args-var flycheck-rust-args (rust-cargo rust)
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-def-option-var flycheck-rust-check-tests t (rust-cargo rust)
+ "Whether to check test code in Rust.
+
+When non-nil, `rustc' is passed the `--test' flag, which will
+check any code marked with the `#[cfg(test)]' attribute and any
+functions marked with `#[test]'. Otherwise, `rustc' is not passed
+`--test' and test code will not be checked. Skipping `--test' is
+necessary when using `#![no_std]', because compiling the test
+runner requires `std'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '("flycheck" . "0.19"))
+
+(flycheck-def-option-var flycheck-rust-crate-root nil rust
+ "A path to the crate root for the current buffer.
+
+The value of this variable is either a string with the path to
+the crate root for the current buffer, or nil if the current buffer
+is a crate. A relative path is relative to the current buffer.
+
+If this variable is non nil the current buffer will only be checked
+if it is not modified, i.e. after it has been saved."
+ :type 'string
+ :package-version '(flycheck . "0.20")
+ :safe #'stringp)
+(make-variable-buffer-local 'flycheck-rust-crate-root)
+
+(flycheck-def-option-var flycheck-rust-crate-type "lib" (rust-cargo rust)
+ "The type of the Rust Crate to check.
+
+The value of this variable is a string denoting the crate type,
+for the `--crate-type' flag."
+ :type 'string
+ :safe #'stringp
+ :package-version '("flycheck" . "0.20"))
+(make-variable-buffer-local 'flycheck-rust-crate-type)
+
+(flycheck-def-option-var flycheck-rust-library-path nil (rust-cargo rust)
+ "A list of library directories for Rust.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the library path of Rust.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Library directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.18"))
+
+(flycheck-define-checker rust-cargo
+ "A Rust syntax checker using Cargo.
+
+This syntax checker needs Cargo with rustc subcommand."
+ :command ("cargo" "rustc"
+ (eval (if (string= flycheck-rust-crate-type "lib") "--lib" nil))
+ "--" "-Z" "no-trans"
+ (option-flag "--test" flycheck-rust-check-tests)
+ (option-list "-L" flycheck-rust-library-path concat)
+ (eval flycheck-rust-args))
+ :error-patterns
+ ((error line-start (file-name) ":" line ":" column ": "
+ (one-or-more digit) ":" (one-or-more digit) " error: "
+ (or
+ ;; Multiline errors
+ (and (message (minimal-match (one-or-more anything)))
+ " [" (id "E" (one-or-more digit)) "]")
+ (message))
+ line-end)
+ (warning line-start (file-name) ":" line ":" column ": "
+ (one-or-more digit) ":" (one-or-more digit) " warning: "
+ (message) line-end)
+ (info line-start (file-name) ":" line ":" column ": "
+ (one-or-more digit) ":" (one-or-more digit) " " (or "note" "help") ": "
+ (message) line-end))
+ :modes rust-mode
+ :predicate (lambda ()
+ ;; Since we build the entire project with cargo rustc we require
+ ;; that the buffer is saved. And of course, we also need a Cargo
+ ;; file :)
+ (and (flycheck-buffer-saved-p)
+ (locate-dominating-file (buffer-file-name) "Cargo.toml"))))
+
+(flycheck-define-checker rust
+ "A Rust syntax checker using Rust compiler.
+
+This syntax checker needs Rust 1.0.0 alpha or newer.
+
+See URL `http://www.rust-lang.org'."
+ :command ("rustc" "-Z" "no-trans"
+ (option "--crate-type" flycheck-rust-crate-type)
+ (option-flag "--test" flycheck-rust-check-tests)
+ (option-list "-L" flycheck-rust-library-path concat)
+ (eval flycheck-rust-args)
+ (eval (or flycheck-rust-crate-root
+ (flycheck-substitute-argument 'source-inplace 'rust))))
+ :error-patterns
+ ((error line-start (file-name) ":" line ":" column ": "
+ (one-or-more digit) ":" (one-or-more digit) " error: "
+ (or
+ ;; Multiline errors
+ (and (message (minimal-match (one-or-more anything)))
+ " [" (id "E" (one-or-more digit)) "]")
+ (message))
+ line-end)
+ (warning line-start (file-name) ":" line ":" column ": "
+ (one-or-more digit) ":" (one-or-more digit) " warning: "
+ (message) line-end)
+ (info line-start (file-name) ":" line ":" column ": "
+ (one-or-more digit) ":" (one-or-more digit) " " (or "note" "help") ": "
+ (message) line-end))
+ :modes rust-mode
+ :predicate (lambda ()
+ (and (not flycheck-rust-crate-root) (flycheck-buffer-saved-p))))
+
+(defvar flycheck-sass-scss-cache-directory nil
+ "The cache directory for `sass' and `scss'.")
+
+(defun flycheck-sass-scss-cache-location ()
+ "Get the cache location for `sass' and `scss'.
+
+If no cache directory exists yet, create one and return it.
+Otherwise return the previously used cache directory."
+ (setq flycheck-sass-scss-cache-directory
+ (or flycheck-sass-scss-cache-directory
+ (make-temp-file "flycheck-sass-scss-cache" 'directory))))
+
+(flycheck-def-option-var flycheck-sass-compass nil sass
+ "Whether to enable the Compass CSS framework.
+
+When non-nil, enable the Compass CSS framework, via `--compass'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.16"))
+
+(flycheck-define-checker sass
+ "A Sass syntax checker using the Sass compiler.
+
+See URL `http://sass-lang.com'."
+ :command ("sass"
+ "--cache-location" (eval (flycheck-sass-scss-cache-location))
+ (option-flag "--compass" flycheck-sass-compass)
+ "--check" "--stdin")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ (or "Syntax error: " "Error: ")
+ (message (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))
+ (optional "\r") "\n" (one-or-more " ") "on line " line
+ " of standard input"
+ line-end)
+ (warning line-start
+ "WARNING: "
+ (message (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))
+ (optional "\r") "\n" (one-or-more " ") "on line " line
+ " of " (one-or-more not-newline)
+ line-end))
+ :modes sass-mode)
+
+(flycheck-define-checker scala
+ "A Scala syntax checker using the Scala compiler.
+
+See URL `http://www.scala-lang.org/'."
+ :command ("scalac" "-Ystop-after:parser" source)
+ :error-patterns
+ ((error line-start (file-name) ":" line ": error: " (message) line-end))
+ :modes scala-mode
+ :next-checkers ((warning . scala-scalastyle)))
+
+(flycheck-def-config-file-var flycheck-scalastylerc scala-scalastyle nil
+ :safe #'stringp
+ :package-version '(flycheck . "0.20"))
+
+(flycheck-define-checker scala-scalastyle
+ "A Scala style checker using scalastyle.
+
+Note that this syntax checker is not used if
+`flycheck-scalastyle-jar' or `flycheck-scalastylerc' are nil or
+point to non-existing files.
+
+See URL `http://www.scalastyle.org'."
+ :command ("scalastyle"
+ (config-file "-c" flycheck-scalastylerc)
+ source)
+ :error-patterns
+ ((error line-start "error file=" (file-name) " message="
+ (message) " line=" line (optional " column=" column) line-end)
+ (warning line-start "warning file=" (file-name) " message="
+ (message) " line=" line (optional " column=" column) line-end))
+ :error-filter (lambda (errors)
+ (flycheck-sanitize-errors
+ (flycheck-increment-error-columns errors)))
+ :modes scala-mode
+ :predicate
+ ;; Inhibit this syntax checker if the JAR or the configuration are unset or
+ ;; missing
+ (lambda () (and flycheck-scalastylerc
+ (flycheck-locate-config-file flycheck-scalastylerc
+ 'scala-scalastyle)))
+ :verify (lambda (checker)
+ (list
+ (flycheck-verification-result-new
+ :label "Configuration file"
+ :message (cond
+ ((not flycheck-scalastylerc)
+ "`flycheck-scalastyletrc' not set")
+ ((not (flycheck-locate-config-file flycheck-scalastylerc
+ checker))
+ (format "file %s not found" flycheck-scalastylerc))
+ (t "found"))
+ :face (cond
+ ((not flycheck-scalastylerc) '(bold warning))
+ ((not (flycheck-locate-config-file flycheck-scalastylerc
+ checker))
+ '(bold error))
+ (t 'success))))))
+
+(defconst flycheck-scss-lint-checkstyle-re
+ (rx "cannot load such file" (1+ not-newline) "scss_lint_reporter_checkstyle")
+ "Regular expression to parse missing checkstyle error.")
+
+(defun flycheck-parse-scss-lint (output checker buffer)
+ "Parse SCSS-Lint OUTPUT from CHECKER and BUFFER.
+
+Like `flycheck-parse-checkstyle', but catches errors about
+missing checkstyle reporter from SCSS-Lint."
+ (if (string-match-p flycheck-scss-lint-checkstyle-re output)
+ (list (flycheck-error-new-at
+ 1 nil 'error "Checkstyle reporter for SCSS-Lint missing.
+Please run gem install scss_lint_reporter_checkstyle"
+ :checker checker
+ :buffer buffer
+ :filename (buffer-file-name buffer)))
+ (flycheck-parse-checkstyle output checker buffer)))
+
+(flycheck-def-config-file-var flycheck-scss-lintrc scss-lint ".scss-lint.yml"
+ :safe #'stringp
+ :package-version '(flycheck . "0.23"))
+
+(flycheck-define-checker scss-lint
+ "A SCSS syntax checker using SCSS-Lint.
+
+Needs SCSS-Lint 0.43.2 or newer.
+
+See URL `https://github.com/brigade/scss-lint'."
+ :command ("scss-lint"
+ "--require=scss_lint_reporter_checkstyle"
+ "--format=Checkstyle"
+ (config-file "--config" flycheck-scss-lintrc)
+ "--stdin-file-path" source-original "-")
+ :standard-input t
+ ;; We cannot directly parse Checkstyle XML, since for some mysterious reason
+ ;; SCSS-Lint doesn't have a built-in Checkstyle reporter, and instead ships it
+ ;; as an addon which might not be installed. We use a custom error parser to
+ ;; check whether the addon is missing and turn that into a special kind of
+ ;; Flycheck error.
+ :error-parser flycheck-parse-scss-lint
+ :modes scss-mode
+ :verify (lambda (checker)
+ (let* ((executable (flycheck-find-checker-executable checker))
+ (reporter-missing
+ (and executable
+ (with-temp-buffer
+ (call-process executable nil t nil
+ "--require=scss_lint_reporter_checkstyle")
+ (goto-char (point-min))
+ (re-search-forward
+ flycheck-scss-lint-checkstyle-re
+ nil 'no-error)))))
+ (when executable
+ (list
+ (flycheck-verification-result-new
+ :label "checkstyle reporter"
+ :message (if reporter-missing
+ "scss_lint_reporter_checkstyle missing"
+ "present")
+ :face (if reporter-missing
+ '(bold error)
+ 'success)))))))
+
+(flycheck-def-option-var flycheck-scss-compass nil scss
+ "Whether to enable the Compass CSS framework.
+
+When non-nil, enable the Compass CSS framework, via `--compass'."
+ :type 'boolean
+ :safe #'booleanp
+ :package-version '(flycheck . "0.16"))
+
+(flycheck-define-checker scss
+ "A SCSS syntax checker using the SCSS compiler.
+
+See URL `http://sass-lang.com'."
+ :command ("scss"
+ "--cache-location" (eval (flycheck-sass-scss-cache-location))
+ (option-flag "--compass" flycheck-scss-compass)
+ "--check" "--stdin")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ (or "Syntax error: " "Error: ")
+ (message (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))
+ (optional "\r") "\n" (one-or-more " ") "on line " line
+ " of standard input"
+ line-end)
+ (warning line-start
+ "WARNING: "
+ (message (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))
+ (optional "\r") "\n" (one-or-more " ") "on line " line
+ " of an unknown file"
+ line-end))
+ :modes scss-mode)
+
+(flycheck-define-checker sh-bash
+ "A Bash syntax checker using the Bash shell.
+
+See URL `http://www.gnu.org/software/bash/'."
+ :command ("bash" "--norc" "-n" "--")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ ;; The name/path of the bash executable
+ (one-or-more (not (any ":"))) ":"
+ ;; A label "line", possibly localized
+ (one-or-more (not (any digit)))
+ line (zero-or-more " ") ":" (zero-or-more " ")
+ (message) line-end))
+ :modes sh-mode
+ :predicate (lambda () (eq sh-shell 'bash))
+ :next-checkers ((warning . sh-shellcheck)))
+
+(flycheck-define-checker sh-posix-dash
+ "A POSIX Shell syntax checker using the Dash shell.
+
+See URL `http://gondor.apana.org.au/~herbert/dash/'."
+ :command ("dash" "-n")
+ :standard-input t
+ :error-patterns
+ ((error line-start (one-or-more (not (any ":"))) ": " line ": " (message)))
+ :modes sh-mode
+ :predicate (lambda () (eq sh-shell 'sh))
+ :next-checkers ((warning . sh-shellcheck)))
+
+(flycheck-define-checker sh-posix-bash
+ "A POSIX Shell syntax checker using the Bash shell.
+
+See URL `http://www.gnu.org/software/bash/'."
+ :command ("bash" "--posix" "--norc" "-n" "--")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ ;; The name/path of the bash executable
+ (one-or-more (not (any ":"))) ":"
+ ;; A label "line", possibly localized
+ (one-or-more (not (any digit)))
+ line (zero-or-more " ") ":" (zero-or-more " ")
+ (message) line-end))
+ :modes sh-mode
+ :predicate (lambda () (eq sh-shell 'sh))
+ :next-checkers ((warning . sh-shellcheck)))
+
+(flycheck-define-checker sh-zsh
+ "A Zsh syntax checker using the Zsh shell.
+
+See URL `http://www.zsh.org/'."
+ :command ("zsh" "--no-exec" "--no-globalrcs" "--no-rcs" source)
+ :error-patterns
+ ((error line-start (file-name) ":" line ": " (message) line-end))
+ :modes sh-mode
+ :predicate (lambda () (eq sh-shell 'zsh))
+ :next-checkers ((warning . sh-shellcheck)))
+
+(defconst flycheck-shellcheck-supported-shells '(bash ksh88 sh)
+ "Shells supported by ShellCheck.")
+
+(flycheck-def-option-var flycheck-shellcheck-excluded-warnings nil sh-shellcheck
+ "A list of excluded warnings for ShellCheck.
+
+The value of this variable is a list of strings, where each
+string is a warning code to be excluded from ShellCheck reports.
+By default, no warnings are excluded."
+ :type '(repeat :tag "Excluded warnings"
+ (string :tag "Warning code"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.21"))
+
+(flycheck-define-checker sh-shellcheck
+ "A shell script syntax and style checker using Shellcheck.
+
+See URL `https://github.com/koalaman/shellcheck/'."
+ :command ("shellcheck"
+ "--format" "checkstyle"
+ "--shell" (eval (symbol-name sh-shell))
+ (option "--exclude" flycheck-shellcheck-excluded-warnings list
+ flycheck-option-comma-separated-list)
+ "-")
+ :standard-input t
+ :error-parser flycheck-parse-checkstyle
+ :error-filter
+ (lambda (errors)
+ (flycheck-remove-error-file-names
+ "-" (flycheck-dequalify-error-ids errors)))
+ :modes sh-mode
+ :predicate (lambda () (memq sh-shell flycheck-shellcheck-supported-shells))
+ :verify (lambda (_)
+ (let ((supports-shell (memq sh-shell
+ flycheck-shellcheck-supported-shells)))
+ (list
+ (flycheck-verification-result-new
+ :label (format "Shell %s supported" sh-shell)
+ :message (if supports-shell "yes" "no")
+ :face (if supports-shell 'success '(bold warning)))))))
+
+(flycheck-define-checker slim
+ "A Slim syntax checker using the Slim compiler.
+
+See URL `http://slim-lang.com'."
+ :command ("slimrb" "--compile")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ "Slim::Parser::SyntaxError:" (message) (optional "\r") "\n "
+ "STDIN, Line " line (optional ", Column " column)
+ line-end))
+ :modes slim-mode)
+
+(flycheck-define-checker sql-sqlint
+ "A SQL syntax checker using the sqlint tool.
+
+See URL `https://github.com/purcell/sqlint'."
+ :command ("sqlint")
+ :standard-input t
+ :error-patterns
+ ((warning line-start "stdin:" line ":" column ":WARNING "
+ (message (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))
+ line-end)
+ (error line-start "stdin:" line ":" column ":ERROR "
+ (message (one-or-more not-newline)
+ (zero-or-more "\n"
+ (one-or-more " ")
+ (one-or-more not-newline)))
+ line-end))
+ :modes (sql-mode))
+
+(flycheck-def-config-file-var flycheck-chktexrc tex-chktex ".chktexrc"
+ :safe #'stringp)
+
+(flycheck-define-checker tex-chktex
+ "A TeX and LaTeX syntax and style checker using chktex.
+
+See URL `http://www.nongnu.org/chktex/'."
+ :command ("chktex"
+ (config-file "--localrc" flycheck-chktexrc)
+ ;; Compact error messages, and no version information, and execute
+ ;; \input statements
+ "--verbosity=0" "--quiet" "--inputfiles")
+ :standard-input t
+ :error-patterns
+ ((warning line-start "stdin:" line ":" column ":"
+ (id (one-or-more digit)) ":" (message) line-end))
+ :error-filter
+ (lambda (errors)
+ (flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
+ :modes (latex-mode plain-tex-mode))
+
+(flycheck-define-checker tex-lacheck
+ "A LaTeX syntax and style checker using lacheck.
+
+See URL `http://www.ctan.org/pkg/lacheck'."
+ :command ("lacheck" source-inplace)
+ :error-patterns
+ ((warning line-start
+ "\"" (file-name) "\", line " line ": " (message)
+ line-end))
+ :modes latex-mode)
+
+(flycheck-define-checker texinfo
+ "A Texinfo syntax checker using makeinfo.
+
+See URL `http://www.gnu.org/software/texinfo/'."
+ :command ("makeinfo" "-o" null-device "-")
+ :standard-input t
+ :error-patterns
+ ((warning line-start
+ "-:" line (optional ":" column) ": " "warning: " (message)
+ line-end)
+ (error line-start
+ "-:" line (optional ":" column) ": " (message)
+ line-end))
+ :modes texinfo-mode)
+
+(flycheck-def-option-var flycheck-verilator-include-path nil verilog-verilator
+ "A list of include directories for Verilator.
+
+The value of this variable is a list of strings, where each
+string is a directory to add to the include path of Verilator.
+Relative paths are relative to the file being checked."
+ :type '(repeat (directory :tag "Include directory"))
+ :safe #'flycheck-string-list-p
+ :package-version '(flycheck . "0.24"))
+
+(flycheck-define-checker verilog-verilator
+ "A Verilog syntax checker using the Verilator Verilog HDL simulator.
+
+See URL `http://www.veripool.org/wiki/verilator'."
+ :command ("verilator" "--lint-only" "-Wall"
+ (option-list "-I" flycheck-verilator-include-path concat)
+ source)
+ :error-patterns
+ ((warning line-start "%Warning-" (zero-or-more not-newline) ": "
+ (file-name) ":" line ": " (message) line-end)
+ (error line-start "%Error: " (file-name) ":"
+ line ": " (message) line-end))
+ :modes verilog-mode)
+
+(flycheck-define-checker xml-xmlstarlet
+ "A XML syntax checker and validator using the xmlstarlet utility.
+
+See URL `http://xmlstar.sourceforge.net/'."
+ ;; Validate standard input with verbose error messages, and do not dump
+ ;; contents to standard output
+ :command ("xmlstarlet" "val" "--err" "--quiet" "-")
+ :standard-input t
+ :error-patterns
+ ((error line-start "-:" line "." column ": " (message) line-end))
+ :modes (xml-mode nxml-mode))
+
+(flycheck-define-checker xml-xmllint
+ "A XML syntax checker and validator using the xmllint utility.
+
+The xmllint is part of libxml2, see URL
+`http://www.xmlsoft.org/'."
+ :command ("xmllint" "--noout" "-")
+ :standard-input t
+ :error-patterns
+ ((error line-start "-:" line ": " (message) line-end))
+ :modes (xml-mode nxml-mode))
+
+(flycheck-define-checker yaml-jsyaml
+ "A YAML syntax checker using JS-YAML.
+
+See URL `https://github.com/nodeca/js-yaml'."
+ :command ("js-yaml")
+ :standard-input t
+ :error-patterns
+ ((error line-start
+ (or "JS-YAML" "YAMLException") ": "
+ (message) " at line " line ", column " column ":"
+ line-end))
+ :modes yaml-mode)
+
+(flycheck-define-checker yaml-ruby
+ "A YAML syntax checker using Ruby's YAML parser.
+
+This syntax checker uses the YAML parser from Ruby's standard
+library.
+
+See URL `http://www.ruby-doc.org/stdlib-2.0.0/libdoc/yaml/rdoc/YAML.html'."
+ :command ("ruby" "-ryaml" "-e" "begin;
+ YAML.load(STDIN); \
+ rescue Exception => e; \
+ STDERR.puts \"stdin:#{e}\"; \
+ end")
+ :standard-input t
+ :error-patterns
+ ((error line-start "stdin:" (zero-or-more not-newline) ":" (message)
+ "at line " line " column " column line-end))
+ :modes yaml-mode)
+
+(provide 'flycheck)
+
+;; Local Variables:
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; flycheck.el ends here
--- /dev/null
+This is flycheck.info, produced by makeinfo version 5.2 from
+flycheck.texi.
+
+Modern on-the-fly syntax checking for GNU Emacs 24.
+
+ Copyright © 2014-2016 Sebastian Wiesner
+
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation License,
+ Version 1.3 or any later version published by the Free Software
+ Foundation; with no Invariant Sections, no Front-Cover Texts, and
+ no Back-Cover Texts. A copy of the license is included in the
+ section entitled “GNU Free Documentation License”.
+
+ A copy of the license is also available from the Free Software
+ Foundation Web site at <http://www.gnu.org/licenses/fdl.html>.
+
+ Alternatively, you may copy, distribute and/or modify this
+ documentation under the terms of the Creative Commons
+ Attribution-ShareAlike 4.0 International Public License. A copy of
+ the license can be obtained at
+ <https://creativecommons.org/licenses/by-sa/4.0/legalcode>.
+INFO-DIR-SECTION Emacs
+START-INFO-DIR-ENTRY
+* Flycheck: (flycheck). Modern on-the-fly syntax checking
+END-INFO-DIR-ENTRY
+
+\1f
+File: flycheck.info, Node: Top, Next: Introduction, Up: (dir)
+
+Flycheck
+********
+
+Modern on-the-fly syntax checking for GNU Emacs 24.
+
+ Copyright © 2014-2016 Sebastian Wiesner
+
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation License,
+ Version 1.3 or any later version published by the Free Software
+ Foundation; with no Invariant Sections, no Front-Cover Texts, and
+ no Back-Cover Texts. A copy of the license is included in the
+ section entitled “GNU Free Documentation License”.
+
+ A copy of the license is also available from the Free Software
+ Foundation Web site at <http://www.gnu.org/licenses/fdl.html>.
+
+ Alternatively, you may copy, distribute and/or modify this
+ documentation under the terms of the Creative Commons
+ Attribution-ShareAlike 4.0 International Public License. A copy of
+ the license can be obtained at
+ <https://creativecommons.org/licenses/by-sa/4.0/legalcode>.
+
+ Flycheck is a modern GNU Emacs package that provides on-the-fly
+syntax checking for buffers. It is intended as replacement for the
+older Flymake package which is built into Emacs.
+
+ *Note Introduction::, for more information about Flycheck. For
+installations instructions and a quick tutorial, *note Installation::
+and *note Quickstart:: respectively. *Note Usage::, for a detailed user
+guide.
+
+* Menu:
+
+* Introduction:: An introduction to Flycheck
+* Installation:: How to install Flycheck
+* Quickstart:: A quick Flycheck tutorial
+* Usage:: How to use Flycheck
+* Syntax checker definitions:: How to add new syntax checkers to Flycheck
+* Flycheck hooks:: How to hook into Flycheck
+* Flycheck API:: API documentation
+* Supported languages:: A list of supported languages
+* Getting Help:: How to obtain help about Flycheck
+* GNU Free Documentation License:: How to copy this manual
+* Main Index:: Index of Flycheck concepts
+* Key Index:: Index of all keybindings
+* Function and Variable Index:: Index of commands, options and types
+
+\1f
+File: flycheck.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top
+
+1 Introduction
+**************
+
+Flycheck provides modern on-the-fly syntax checking extension for GNU
+Emacs 24, intended as replacement for the older Flymake extension which
+is part of GNU Emacs.
+
+ Flycheck runs various linting tools and services to automatically
+check the contents of buffers while you are typing, and reports warnings
+and errors directly in the buffer, in the mode line and in an optional
+error list. You can navigate errors and warnings in the current buffer,
+show the corresponding messages, and copy errors to the kill ring.
+
+ • Over 40 languages with more than 70 checkers. *Note Supported
+ languages::.
+ • Fully automatic, fail-safe, on-the-fly syntax checking in buffers
+ • In-buffer error highlighting, with fringe indicators
+ • Error navigation
+ • Auto-updating error list
+ • Many customisation options
+ • A comprehensive manual
+ • A simple API to add support for new languages and tools
+ • A “doesn’t get in your way guarantee”
+
+\1f
+File: flycheck.info, Node: Installation, Next: Quickstart, Prev: Introduction, Up: Top
+
+2 Installation
+**************
+
+2.1 Prerequisites
+=================
+
+Flycheck needs GNU Emacs 24. Older releases of GNU Emacs or other
+flavours of Emacs (e.g. XEmacs, Aquamacs, etc.) are _not_ supported.
+
+ Flycheck works best on Unix-like operating systems. It is
+extensively tested on Linux and OS X.
+
+ Flycheck does not explicitly support Windows, but tries to maintain
+Windows compatibility and should generally work fine on Windows, too.
+However, we can neither answer questions about Windows nor fix bugs that
+only occur on Windows without the help of active Windows users. Please
+watch out for known Windows issues
+(https://github.com/flycheck/flycheck/labels/B-Windows%20only)!
+
+2.2 Syntax checking tools
+=========================
+
+Flycheck does _not_ check buffers itself. It relies on _external_
+programs to check buffers, which need to be installed separately. *Note
+Supported languages::, for a list of required programs for each language
+supported by Flycheck.
+
+ Most of these programs are available in the package repositories of
+Linux distributions, or with the standard package managers of specific
+programming languages (e.g. Rubygems, NPM, Cabal, etc.)
+
+2.3 Installation
+================
+
+Install Flycheck via Emacs’ built-in package manager, from the MELPA
+Stable (http://stable.melpa.org) repository:
+
+ M-x package-install RET flycheck
+
+ Alternatively, you may use the MELPA (http://melpa.org) repository,
+which hosts the most recent development version. Note that these
+repositories are not included in GNU Emacs by default.
+
+ You need to enable them explicitly, by adding the following to your
+init file:
+
+ (require 'package)
+ (add-to-list 'package-archives
+ '("melpa" . "http://melpa.org/packages/") t)
+ (package-initialize)
+
+ If you don’t know where your init file is take a look at the value of
+the variable ‘user-init-file’ with ‘C-h v user-init-file’.
+
+\1f
+File: flycheck.info, Node: Quickstart, Next: Usage, Prev: Installation, Up: Top
+
+3 Quickstart
+************
+
+3.1 Install and enable Flycheck
+===============================
+
+To get started with Flycheck, enable it by adding the following to your
+init file:
+
+ (add-hook 'after-init-hook #'global-flycheck-mode)
+
+ If you don’t know where your init file is take a look at the value of
+the variable ‘user-init-file’ with ‘C-h v user-init-file’.
+
+3.2 Install syntax checker tools
+================================
+
+Next you need to install syntax checking tools for the major modes you
+are using. For instance, for Python you may want to install Pylint
+(http://pylint.org):
+
+ $ pip install pylint
+
+ For Ruby, you might want to use Rubocop
+(https://github.com/bbatsov/rubocop) and ruby-lint
+(https://github.com/YorickPeterse/ruby-lint):
+
+ $ gem install rubocop ruby-lint
+
+ *Note Supported languages::, for a complete list of all languages
+that Flycheck supports.
+
+3.3 Check syntax in a buffer
+============================
+
+Now switch to a Python or Ruby Mode buffer and run ‘M-x
+flycheck-verify-setup’ to check whether Flycheck is correctly setup.
+
+ If everything is fine Flycheck will now check syntax using these
+tools, when you visit a buffer in any of these languages. Syntax
+checking happens _automatically_ when you save the buffer or make any
+changes. Flycheck highlights errors and warnings in the buffer,
+indicates them in the fringe, and reports their numbers in the mode
+line.
+
+ You can also manually check a buffer with ‘C-c ! c’
+(‘flycheck-buffer’).
+
+3.4 Navigate and list errors
+============================
+
+Use ‘C-c ! n’ (‘flycheck-next-error’) and ‘C-c ! p’
+(‘flycheck-previous-error’) to navigate between error locations. If you
+keep the point at an error location, Flycheck will show the error
+message in the echo area after a short delay. You can also hover error
+locations with the mouse and see the error message in a tooltip.
+
+ To get an overview of all errors and warnings in the current buffer,
+type ‘C-c ! l’ (‘flycheck-list-errors’) to pop up a list of all errors
+in your current buffer. The error list updates automatically when you
+fix errors or introduce new ones, or when you switch to another buffer.
+
+3.5 More features
+=================
+
+All Flycheck commands are available in the Emacs menu at ‘Syntax
+checking’ in the ‘Tools’ menu.
+
+ The same menu is also available by clicking on the mode line lighter
+of Flycheck.
+
+\1f
+File: flycheck.info, Node: Usage, Next: Syntax checker definitions, Prev: Quickstart, Up: Top
+
+4 Usage
+*******
+
+This chapter explains the usage of Flycheck in-depth.
+
+ *Note:* All commands in this chapter are documented with their
+default key prefix ‘C-c !’. You can customise this prefix with
+‘flycheck-keymap-prefix’, but remember your custom prefix while reading
+this chapter.
+
+* Menu:
+
+* Checking buffers:: How buffers are checked
+* Syntax checkers:: Tools used to check a buffer
+* Reporting results:: How results of checks are reported
+* Navigating errors:: How to navigate to Flycheck errors
+* Displaying errors:: How to display error messages
+* Killing errors:: How to put error messages into the kill ring
+* Listing errors:: How to show a list of all errors
+* Mode line display:: How to interpret Flycheck’s mode line
+* Configuring checkers:: How to configure syntax checkers
+
+\1f
+File: flycheck.info, Node: Checking buffers, Next: Syntax checkers, Up: Usage
+
+4.1 Checking buffers
+====================
+
+The minor mode ‘flycheck-mode’ enables syntax checking in a single
+buffer. ‘global-flycheck-mode’ automatically enables ‘flycheck-mode’
+all buffers whenever possible. You can exclude specific major modes
+from ‘global-flycheck-mode’ with ‘flycheck-global-modes’.
+
+ *Note:* ‘global-flycheck-mode’ does not enable ‘flycheck-mode’ for
+remote or encrypted files. The former is flaky and might be very slow,
+and the latter would leak confidential data to temporary directories.
+You may still check syntax in these buffers by manually enabling
+‘flycheck-mode’ with ‘M-x flycheck-mode’. However, this is _not_
+recommended for said reasons.
+
+ Add the following code to your init file to enable syntax checking
+permanently:
+
+ (add-hook 'after-init-hook #'global-flycheck-mode)
+
+ When ‘flycheck-mode’ is enabled, Flycheck automatically checks a
+buffer whenever
+
+ • the buffer is saved,
+ • new lines are inserted,
+ • or a short time after you stopped to make changes to the buffer.
+
+ You can customise this behaviour by changing
+‘flycheck-check-syntax-automatically’:
+
+ -- User Option: flycheck-check-syntax-automatically
+ A list of events that trigger a new syntax check in the current
+ buffer:
+
+ ‘save’
+ Check the buffer immediately after it was saved.
+ ‘idle-change’
+ Check the buffer a short time after the last change to the
+ buffer. The delay is customisable with
+ ‘flycheck-idle-change-delay’.
+ ‘new-line’
+ Check the buffer immediately after a new line was inserted.
+ ‘mode-enabled’
+ Check the buffer immediately after Flycheck Mode was enabled.
+
+ For instance, with the following code in your init file Flycheck
+ will only check the buffer when it is saved, but never while you
+ are making changes to the buffer:
+
+ (setq flycheck-check-syntax-automatically '(mode-enabled save))
+
+ In addition to automatic syntax checking you can always check the
+current buffer manually:
+
+‘C-c ! c’
+‘M-x flycheck-buffer’
+ Check syntax in the current buffer.
+
+*Note:* If syntax checking does not work, please check your setup:
+
+‘C-c ! v’
+‘M-x flycheck-verify-setup’
+ Popup a buffer with information about the Flycheck setup for the
+ current buffer.
+
+ Lists the syntax checkers available for the current buffer,
+ together with potential problems in their setup.
+
+ During syntax checks Flycheck creates temporary files to feed to
+contents of the current buffer to external programs. You can change the
+prefix used for the names of these temporary files with
+‘flycheck-temp-prefix’.
+
+\1f
+File: flycheck.info, Node: Syntax checkers, Next: Reporting results, Prev: Checking buffers, Up: Usage
+
+4.2 Syntax checkers
+===================
+
+Flycheck does not check buffers by itself, but relies on external
+_syntax checkers_. When checking a buffer Flycheck automatically
+selects the best syntax checker from ‘flycheck-checkers’:
+
+ -- User Option: flycheck-checkers
+ A list of all syntax checkers available for syntax checking.
+
+ A syntax checker in this list is a _registered_ syntax checker.
+
+ Flycheck may apply further syntax checkers to the current buffer, if
+the selected syntax checker _chains_ to other syntax checkers. For
+instance, the ‘emacs-lisp’ syntax checker, which checks Emacs Lisp with
+Emacs’ byte compiler, _chains_ to the ‘emacs-lisp-checkdoc’ syntax
+checker, which checks Emacs Lisp for violations of documentation
+conventions, *note (elisp)Documentation Tips::. In Emacs Lisp buffers,
+Flycheck will first use ‘emacs-lisp’, and then ‘emacs-lisp-checkdoc’.
+
+ Flycheck ignores chained checkers which are not contained in
+‘flycheck-checkers’.
+
+ Like everything else in GNU Emacs, syntax checkers have online
+documentation as well. If you are interested what major modes a
+particular syntax checker in ‘flycheck-checkers’ supports, or what tool
+it uses, type <C-c ! ?>:
+
+‘C-c ! ?’
+‘M-x flycheck-describe-checker’
+ Prompt for a syntax checker and show its documentation.
+
+ The documentation includes the name of the program or service used
+ by the syntax checker, a list of major modes in which the checker
+ will be used, and a list of its options.
+
+ Instead of letting Flycheck select a syntax checker automatically you
+can also explicitly tell Flycheck which checker to use for the current
+buffer, by manually selecting a specific syntax checker:
+
+‘C-c ! s’
+‘M-x flycheck-select-checker’
+ Prompt for a syntax checker and select this syntax checker for the
+ current buffer.
+
+‘C-u C-c ! s’
+‘C-u M-x flycheck-select-checker’ Remove any manual
+ syntax checker selection for the current buffer, and let Flycheck
+ automatically select a syntax checker from ‘flycheck-checkers’
+ again.
+
+ You can also select a syntax checker via the variable
+‘flycheck-checker’. In fact, ‘flycheck-select-checker’ just sets this
+variable accordingly:
+
+ -- Variable: flycheck-checker
+ A syntax checker to use for the current buffer.
+
+ If nil (the default), Flycheck will automatically select the best
+ checker from ‘flycheck-checkers’.
+
+ If set to a syntax checker, Flycheck will use this syntax checker
+ for the current buffer, and never automatically select any other.
+ Flycheck still runs chained checkers, though.
+
+ If the syntax checker selected by this variable does not work in
+ the current buffer, Flycheck signals an error.
+
+ You can set this variable locally. For instance, if your Python
+ project mandates Flake8 (http://flake8.readthedocs.org/en/2.2.3/)
+ as a syntax checker, you can tell Flycheck to only use the
+ corresponding checker ‘python-flake8’ in Python files of your
+ project by setting ‘flycheck-checker’ as a directory-local variable
+ in the top-level directory of your project with ‘M-x
+ add-dir-local-variable RET python-mode RET flycheck-checker RET
+ python-flake8’. *Note (emacs)Directory Variables::, for more
+ information about directory variables.
+
+ Occasionally you may want to disable specific syntax checkers
+completely, so that they can never be used at all, neither via automatic
+nor via manual selection:
+
+‘C-c ! x’
+‘M-x flycheck-disable-checker’
+ Prompt for a syntax checker to disable in the current buffer.
+
+‘C-u C-c ! x’
+‘C-u M-x flycheck-disable-checker’
+ Prompt for a syntax checker to re-enable in the current buffer.
+
+ This is particularly useful if you want to disable syntax checkers
+that are chained after others. For instance, if you do not care for
+documentation conventions of Emacs Lisp you may not need for the
+‘emacs-lisp-checkdoc’ checker, so you can disable it for the current
+buffer with <M-x flycheck-disable-checker RET emacs-lisp-checkdoc>.
+
+ ‘flycheck-disable-checker’ actually sets the buffer-local value of
+the ‘flycheck-disabled-checkers’ option:
+
+ -- User Option: flycheck-disabled-checkers
+ A list of disabled syntax checkers. Flycheck will _never_ use
+ disabled syntax checkers to check a buffer.
+
+ You can customise this variable with <M-x customize-variable RET
+ flycheck-disabled-checkers> or set its default value in your init
+ file to permanently disable specific checkers. For instance, to
+ permanently disable Clang for all C/C++ buffers:
+
+ (setq-default flycheck-disabled-checkers '(c/c++-clang))
+
+ You can also disable checkers via local variables. For instance,
+ to disable ‘emacs-lisp-checkdoc’ for your entire project, add it to
+ ‘flycheck-disabled-checkers’ in the ‘.dir-locals.el’ file of your
+ project:
+
+ ((emacs-lisp-mode (flycheck-disabled-checkers emacs-lisp-checkdoc)))
+
+ *Note (emacs)Directory Variables::, for more information about
+ directory variables.
+
+\1f
+File: flycheck.info, Node: Reporting results, Next: Navigating errors, Prev: Syntax checkers, Up: Usage
+
+4.3 Reporting results of syntax checking
+========================================
+
+When a syntax check in the current buffer has finished, Flycheck reports
+the results of the syntax checkers used by the check in the current
+buffer:
+
+ • It highlights errors and warnings reported by a syntax checking in
+ the buffer according to ‘flycheck-highlighting-mode’,
+ • and indicates these locations in the fringe according to
+ ‘flycheck-indication-mode’.
+
+ -- User Option: flycheck-highlighting-mode
+ How Flycheck highlights errors and warnings in the buffer:
+
+ ‘lines’
+ Highlight the whole line, ignoring any column information.
+ ‘columns’
+ Highlight the column of the error, if the error has a column,
+ otherwise behave as ‘lines’.
+ ‘symbols’
+ Highlight the symbol at the error column, if any, otherwise
+ behave like ‘columns’. This is default
+ ‘sexps’
+ Highlight the expression at the error column, if any,
+ otherwise behave like ‘columns’. *Warning:* ‘sexps’ can be
+ _very_ slow in some major modes, notably the built-in
+ ‘python-mode’.
+ ‘nil’
+ Do not highlight errors at all.
+
+ Flycheck uses the ‘flycheck-error’, ‘flycheck-warning’ and
+ ‘flycheck-info’ faces to highlight errors, warnings and info
+ messages respectively.
+
+ -- User Option: flycheck-indication-mode
+ How Flycheck indicates errors and warnings:
+
+ ‘left-fringe’
+ ‘right-fringe’
+ Indicate errors in the left or right fringe respectively.
+ *Note (emacs)Fringes::, for more information about fringes.
+
+ Flycheck uses the ‘flycheck-fringe-error’,
+ ‘flycheck-fringe-warning’, and ‘flycheck-fringe-info’ faces
+ for the indicators for the corresponding error levels.
+ ‘nil’
+ Do not indicate errors and warnings.
+
+ To avoid flooding a buffer with excessive reports, Flycheck discards
+any reports and _disables_ the corresponding syntax checker
+subsequently, if the total number of reported errors of any level
+exceeds the value of ‘flycheck-checker-error-threshold’.
+
+ You can explicitly clear with the ‘flycheck-clear’ command.
+
+\1f
+File: flycheck.info, Node: Navigating errors, Next: Displaying errors, Prev: Reporting results, Up: Usage
+
+4.4 Navigating errors
+=====================
+
+By default, Flycheck integrates into standard error navigation commands
+of Emacs: ‘M-g n’ (‘next-error’) and ‘M-g p’ (‘previous-error’) will
+navigate between Flycheck warnings and errors in the current buffer.
+*Note (emacs)Compilation Mode::, for more information about these
+commands. You can disable this integration by setting
+‘flycheck-standard-error-navigation’ to nil, and re-enabling
+‘flycheck-mode’ afterwards.
+
+ *Note:* With standard error navigation _visible_ compilation buffers
+(e.g. from M-x compile, M-x grep, M-x occur, etc.) take precedence
+over Flycheck errors.
+
+ Flycheck provides an independent set of navigation commands which
+will always navigate Flycheck errors in the current buffer, regardless
+of visible compilation buffers and ‘flycheck-standard-error-navigation’:
+
+‘C-c ! n’
+‘M-x flycheck-next-error’
+ Jump to the next error.
+
+ With prefix argument, jump forwards by as many errors as specified
+ by the prefix argument, e.g. ‘M-3 C-c ! n’ will move to the 3rd
+ error from the current point. With negative prefix argument, move
+ to previous errors instead. Signal an error, if there are no more
+ Flycheck errors.
+
+‘C-c ! p’
+‘M-x flycheck-previous-error’
+ Jump to the previous Flycheck error.
+
+ With prefix argument, jump backwards by as many errors as specified
+ by the prefix argument, e.g. ‘M-3 C-c ! p’ will move to the 3rd
+ error before the current point. With negative prefix argument,
+ move to next errors instead. Signal an error, if there are no more
+ Flycheck errors.
+
+‘M-x flycheck-first-error’
+ Jump to the first Flycheck error.
+
+ With prefix argument, jump forwards to by as many errors as
+ specified by the prefix argument, e.g. ‘M-3 M-x
+ flycheck-first-error’ moves to the 3rd error from the beginning of
+ the buffer. With negative prefix argument, move to the last error
+ instead.
+
+ By default, these commands consider all errors in the current buffer.
+With ‘flycheck-navigation-minimum-level’ you can restrict them to errors
+above certain levels:
+
+ -- User Option: flycheck-navigation-minimum-level
+ The minimum levels of errors to consider for navigation.
+
+ If set to an error level, only navigate to errors whose level is as
+ least as severe as this one. If nil, navigate to all errors.
+
+\1f
+File: flycheck.info, Node: Displaying errors, Next: Killing errors, Prev: Navigating errors, Up: Usage
+
+4.5 Displaying errors
+=====================
+
+When the point moves to an error location Flycheck automatically
+displays the error at point after a short delay:
+
+ -- User Option: flycheck-display-errors-delay
+ The number of seconds to wait before displaying the error at point.
+ Floating point numbers can express fractions of seconds.
+
+ You can also display errors at point explicitly with ‘C-c ! h’:
+
+‘C-c ! h’
+‘M-x flycheck-display-error-at-point’
+ Show the error(s) at point.
+
+ By default Flycheck shows the error message and the error ID in the
+echo area, but you can customise how Flycheck displays errors with
+‘flycheck-display-errors-function’:
+
+ -- User Option: flycheck-display-errors-function
+ A function to display errors. The function is called with a list
+ of Flycheck error objects to display. *Note Errors::, for more
+ information about these objects.
+
+ Flycheck provides some built-in display functions:
+
+ -- Function: flycheck-display-error-messages
+ Show error messages and IDs in the echo area.
+
+ -- Function: flycheck-display-error-messages-unless-error-list
+ Like ‘flycheck-display-error-messages’, but does not show anything
+ if the error list is visible. *Note Listing errors::, for more
+ information about the error list.
+
+ Alternatively the flycheck-pos-tip
+(https://github.com/flycheck/flycheck-pos-tip) extension provides an
+display function which shows error messages in a graphical popup.
+
+ In addition to this display mechanism, Flycheck adds a tooltip to
+each error which appears when you hover the error location with the
+mouse pointer. You can force Emacs to show the contents of the tooltip
+in the echo area with ‘C-h .’ (‘display-local-help’).
+
+ The contents of this tooltip are created with
+‘flycheck-help-echo-function’:
+
+ -- User Option: flycheck-help-echo-function
+ A function to compute the contents of the error tooltips.
+
+ By default Flycheck adds the error message and the error ID of all
+ errors at point to the tooltip contents.
+
+\1f
+File: flycheck.info, Node: Killing errors, Next: Listing errors, Prev: Displaying errors, Up: Usage
+
+4.6 Killing errors
+==================
+
+You can also put error messages into the kill ring:
+
+‘C-c ! C-w’
+‘M-x flycheck-copy-errors-as-kill’
+ Copy all Flycheck error messages at point into the kill ring.
+
+ Each error message is killed _separately_, so ‘C-y’ (‘yank’) only
+ yanks a single error message. You can use ‘M-y’ (‘yank-pop’) to
+ cycle between the killed messages after yanking the first one.
+
+‘C-u C-c ! C-w’
+‘C-u M-x flycheck-copy-errors-as-kill’
+ Copy all Flycheck error messages at point, including their IDs.
+
+‘M-0 C-c ! C-w’
+‘M-0 M-x flycheck-copy-errors-as-kill’
+ Copy the IDs of the errors at point.
+
+\1f
+File: flycheck.info, Node: Listing errors, Next: Mode line display, Prev: Killing errors, Up: Usage
+
+4.7 Listing errors
+==================
+
+To get an overview of all errors in the current buffer you can popup an
+error list:
+
+‘C-c ! l’
+‘M-x flycheck-list-errors’
+‘M-x list-flycheck-errors’
+ List all errors in the current buffer.
+
+ The error list automatically refreshes itself after a syntax check.
+ It also follows the current buffer and window, and automatically
+ updates to show the errors of the new buffer if you switch to
+ another buffer or window. After each refresh the hook
+ ‘flycheck-error-list-after-refresh-hook’.
+
+ In the error list window the following keybindings are available:
+
+‘n’
+ Move to the next error.
+‘p’
+ Move to the previous error.
+‘f’
+ Filter the list, showing only errors whose level is above a
+ threshold of your choice.
+‘F’
+ Remove all filters.
+‘q’
+ Hide the error list window.
+‘RET’
+ Jump to the location of the error at point.
+‘g’
+ Refresh the error list, by triggering a new syntax check in the
+ associated buffer.
+‘S’
+ Sort the error list by the column at point. Press repeatedly to
+ inverse the sorting order.
+
+ For instance, you can sort errors by their level by moving the
+ point onto the text of the ‘Level’ column, and then pressing ‘S’.
+ You can achieve the same effect by clicking on the column header.
+
+ By default, the error list shows all errors in the current buffer.
+In addition to filtering manually, you can restrict it to errors above
+certain levels with ‘flycheck-error-list-minimum-level’:
+
+ -- User Option: flycheck-error-list-minimum-level
+ The minimum level of errors to display in the error list.
+
+ If set to an error level, only displays errors whose error level is
+ at least as severe as this one in the error list. If nil, display
+ all errors.
+
+ When you move the point in the current buffer while the error list is
+visible, all errors on the current line are highlighted in the error
+list with the ‘flycheck-error-list-highlight’ face.
+
+\1f
+File: flycheck.info, Node: Mode line display, Next: Configuring checkers, Prev: Listing errors, Up: Usage
+
+4.8 Mode line display
+=====================
+
+Flycheck always indicates its current state in the mode line, with one
+of the following strings:
+
+‘FlyC’
+ There are no errors in the current buffer.
+‘FlyC*’
+ Flycheck currently checks the current buffer.
+‘FlyC:3/5’
+ There are three errors and five warnings in the current buffer.
+‘FlyC-’
+ Flycheck did not find any syntax checker for the current buffer.
+ Try ‘C-c ! v’ (‘flycheck-verify-setup’) to find out why.
+‘FlyC!’
+ The syntax check failed. Inspect the ‘*Messages*’ buffer for more
+ information about the failure.
+‘FlyC?’
+ The syntax check had a dubious result. The definition of the
+ syntax checker may be flawed. Inspect the ‘*Messages*’ buffer for
+ details.
+
+ This indicator should *never* appear for built-in syntax checkers.
+If it does, please consider reporting an issue to the Flycheck
+developers. *Note Issues::, for more information.
+
+ The 3rd party extension flycheck-color-mode-line
+(https://github.com/flycheck/flycheck-color-mode-line) automatically
+changes the background colour of the mode line according to the results
+of the last syntax check.
+
+\1f
+File: flycheck.info, Node: Configuring checkers, Prev: Mode line display, Up: Usage
+
+4.9 Configuring syntax checkers
+===============================
+
+Flycheck provides a rich interface to configure syntax checkers. There
+are three different kinds of options for syntax checkers:
+
+ • _Syntax checker options_ which directly change specific settings of
+ syntax checkers,
+ • _syntax checker configuration files_ which point syntax checkers to
+ configuration files which can comprehensively configure a syntax
+ checker, and
+ • _syntax checker executables_ which change the executables that
+ Flycheck runs for syntax checkers.
+
+4.9.1 Syntax checker options
+----------------------------
+
+Man syntax checkers can be configured via individual options. For
+instance, the ‘flycheck-flake8-maximum-line-length’ tells the
+‘python-flake8’ syntax checker about the maximum number of characters
+allowed on a line. Use the command ‘flycheck-describe-checker’ to see
+what options a syntax checker provides. Type ‘M-x customize-group RET
+flycheck-options’ to get a list of all available options.
+
+ Options are mainly intended to be set per file or per project via
+file or directory variables. *Note (emacs)File Variables::, and *note
+(emacs)Directory Variables:: respectively, for more information.
+
+ For instance, if you the following file variables section at the end
+of a Python file, the ‘python-flake8’ syntax checker will warn about
+lines longer than 100 characters, rather than the default limit of 80
+characters:
+
+ # Local Variables:
+ # flycheck-flake8-maximum-line-length: 100
+ # End:
+
+4.9.2 Syntax checker configuration files
+----------------------------------------
+
+Some syntax checkers also read configuration files. These syntax
+checkers have an associated _configuration file variable_ which
+specifies the path to the configuration file. All configuration file
+variables are customisable via ‘M-x customize-group RET
+flycheck-config-files’.
+
+ If the value of a configuration file variable is nil, Flycheck will
+not use any configuration file for the corresponding syntax checker. If
+it is a string, however, Flycheck tries to locate an appropriate
+configuration file, with the following procedure:
+
+ 1. If the value contains a directory separator, expand the path
+ against the ‘default-directory’ of the current buffer.
+ 2. If the buffer has a file name, search the buffer’s directory and
+ any ancestor directories up to the root directory for the
+ configuration file.
+ 3. Eventually try to find the configuration file in the user’s home
+ directory.
+
+ If any of these steps returns an existing file, this file is given to
+the syntax checker. For instance, assume you edit the file
+‘foo/bar/hello.py’ in the following project layout:
+
+ .
+ ├── .pylintrc
+ ├── README.rst
+ ├── foo
+ │ ├── __init__.py
+ │ └── bar
+ │ ├── __init__.py
+ │ └── hello.py
+ └── setup.py
+
+ When using the ‘python-pylint’ syntax checker, Flycheck would find
+the file ‘.pylintrc’ and pass it to ‘pylint’. This file could then
+contain project-wide style settings for your Python code.
+
+ You can change the default procedure for locating configuration files
+by adding or replacing functions in
+‘flycheck-locate-config-file-functions’:
+
+ -- User Option: flycheck-locate-config-file-functions
+ Functions to locate configuration files.
+
+ Each function accepts two arguments VALUE and CHECKER. VALUE is
+ the value of the configuration file variable, and CHECKER is the
+ syntax checker to locate a configuration file for. The function
+ shall either return a string with the absolute path to an existing
+ configuration file, or nil if it could not locate the file.
+
+ Flycheck calls the functions in order of appearance, until the
+ first function returns nil. If all functions return nil, no
+ configuration file is given to the syntax checker.
+
+ *Note:* The formats of configuration files are specific to each
+syntax checker. Please consult the documentation of the corresponding
+checker tool for information about the configuration file format
+understood by the tool.
+
+ Like syntax checker options (*note Syntax checker options::) you can
+set these variables with file or directory variables. *Note (emacs)File
+Variables::, and *note (emacs)Directory Variables:: respectively, for
+more information.
+
+4.9.3 Syntax checker executables
+--------------------------------
+
+Occasionally, you need to point Flycheck to a different executable when
+running a syntax checker. For instance, you might want to use ‘gcc-4.9’
+to check your C code, or use ‘pylint’ from a specific virtualenv.
+
+ For these situations, each syntax checker has a buffer-local,
+customizable variable named ‘flycheck-CHECKER-executable’, where CHECKER
+is the name of the syntax checker. The value of this variable is either
+nil, or a string. In the former case, Flycheck uses the default
+executable from the syntax checker definition when executing the syntax
+checker. In the latter case, it uses the value of the variable as
+executable.
+
+ You can either set these variables directly in your init file, or
+change them interactively:
+
+‘C-c ! e’
+‘M-x flycheck-set-checker-executable’
+ Set the executable of a syntax checker in the current buffer.
+
+ Prompt for a syntax checker and an executable file, and set the
+ executable variable of the syntax checker.
+‘C-u C-c ! e’
+‘C-u M-x flycheck-set-checker-executable’
+ Reset the executable of a syntax checker in the current buffer.
+
+ Prompt for a syntax checker and reset its executable to the
+ default.
+
+\1f
+File: flycheck.info, Node: Syntax checker definitions, Next: Flycheck hooks, Prev: Usage, Up: Top
+
+5 Syntax checker definitions
+****************************
+
+This chapter explains how to add new syntax checkers and how to extend
+built-in syntax checkers, by example. *Note Flycheck API::, for a
+detailed reference on the involved types, functions and macros.
+
+ If you define a new syntax checker or have an extension to a built-in
+syntax checker, please report it to Flycheck (*note Issues::), so that
+we can consider it for inclusion to make it available to all other users
+of Flycheck.
+
+* Menu:
+
+* Defining syntax checkers:: How to define new syntax checkers
+* Finding error patterns:: How to find error patterns for a checker
+* Trying new checkers:: How to try a new syntax checker
+* Registering new checkers:: How to register for automatic selection
+* Parsing structured output:: How to parse structured output like XML
+* Passing configuration to checkers:: How to make syntax checkers configurable
+* Controlling use of checkers:: How to control when checkers are used
+* Applying multiple checkers:: How to use more than one checker per buffer
+
+\1f
+File: flycheck.info, Node: Defining syntax checkers, Next: Finding error patterns, Up: Syntax checker definitions
+
+5.1 Defining syntax checkers
+============================
+
+Flycheck provides the macro ‘flycheck-define-checker’ to define a new
+syntax checker. The following example defines a simple syntax checker
+for the popular Rubocop (http://batsov.com/rubocop/) tool for Ruby:
+
+ (flycheck-define-checker ruby-rubocop
+ "A Ruby syntax and style checker using the RuboCop tool.
+
+ See URL `http://batsov.com/rubocop/'."
+ :command ("rubocop" "--display-cop-names" "--format" "emacs"
+ (config-file "--config" flycheck-rubocoprc)
+ (option-flag "--lint" flycheck-rubocop-lint-only)
+ "--stdin" source-original)
+ :standard-input t
+ :error-patterns
+ ((info line-start (file-name) ":" line ":" column ": C: "
+ (optional (id (one-or-more (not (any ":")))) ": ") (message) line-end)
+ (warning line-start (file-name) ":" line ":" column ": W: "
+ (optional (id (one-or-more (not (any ":")))) ": ") (message)
+ line-end)
+ (error line-start (file-name) ":" line ":" column ": " (or "E" "F") ": "
+ (optional (id (one-or-more (not (any ":")))) ": ") (message)
+ line-end))
+ :modes (enh-ruby-mode ruby-mode)
+ :next-checkers ((warning . ruby-rubylint)))
+
+ The first argument to ‘flycheck-define-checker’ is the _name_ of a
+syntax checker, by which we can refer to this particular syntax checker.
+
+ Next comes the _docstring_, which should provide a bit of information
+about the syntax checker. It’s a good idea to provide a link to the
+homepage of the syntax checker tool here. You can view this docstring
+in Emacs with ‘flycheck-describe-checker’ at ‘C-c ! ?’, e.g. ‘C-c ! ?
+ruby-rubocop’.
+
+ Eventually we specify the _properties_ of the new syntax checker.
+These properties tell Flycheck when to use your new syntax checker, how
+to run it, and how to parse its output:
+
+ • The ‘:command’ specifies the command Flycheck should run to check
+ the buffer. It’s a simple list containing the executable and its
+ arguments.
+
+ In the example above we pass a couple of arguments to ‘rubocop’ to
+ configure its output format. Next come two options: The special
+ ‘config-file’ cell takes the name of a configuration file from the
+ given variable, searches it and passes the path—if found—to the
+ syntax checker. The ‘option-flag’ cell passes the given argument
+ to the syntax checker if the given variable is non-nil.
+
+ At last we specify ‘--stdin’ to make Rubocop read source code from
+ standard input. The special ‘source-original’ symbol gives the
+ name of the file being checked to Rubocop; Rubocop uses this name
+ in its error output.
+
+ For a complete list of all special symbols refer to the function
+ ‘flycheck-substitute-argument’.
+
+ • ‘:standard-input t’ makes Flycheck send the contents of the buffer
+ via standard input. This is the preferred way to pass buffer
+ contents to syntax checkers.
+
+ For syntax checkers that can’t read from standard input Flycheck
+ provides the special ‘source’ and ‘source-inplace’ argument symbols
+ for the ‘:command’ property. These argument symbols create
+ temporary files in the system temp directory or beneath the
+ original file respectively and give pass them to the syntax checker
+ upon invocation.
+
+ • The ‘:error-patterns’ tell Flycheck how to parse the output of the
+ command in order to obtain error locations. Each pattern has a
+ _level_, followed by ‘rx’ forms which specify a regular expression
+ to find an error in the output of the command.
+
+ Flycheck understands three error levels by default: ‘error’ is for
+ critical errors that absolutely require the user’s attention (e.g.
+ syntax errors), ‘warning’ is for issues that can be ignored, but
+ should not (e.g. unused variables), and ‘info’ is for other
+ messages that provide information about the buffer, but do not
+ immediately require action from the user.
+ ‘flycheck-define-error-level’ lets you define custom error levels.
+
+ Flycheck provides special ‘rx’ forms to extract the relevant
+ information from each error:
+
+ • The ‘(file-name)’ and ‘(message)’ forms match a sequence of
+ any character save new line as file name and message of the
+ error. Both optionally accept further ‘rx’ forms, to specify
+ an alternative regular expression to match the file name or
+ the message, for instance to parse multi-line error messages.
+ • The ‘line’ and ‘column’ forms match a sequence of one or more
+ digits as line and column respectively of the error.
+
+ See the docstring of the function ‘rx’, for a list of all standard
+ ‘rx’ forms, and the docstring of the function
+ ‘flycheck-rx-to-string’ for a list of all special Flycheck forms.
+
+ • The ‘:modes’ property denotes the major modes in which Flycheck may
+ use this syntax checker. ‘rubocop’ checks Ruby code, so the
+ ‘:modes’ of our example specify ‘ruby-mode’ and ‘enh-ruby-mode’.
+
+\1f
+File: flycheck.info, Node: Finding error patterns, Next: Trying new checkers, Prev: Defining syntax checkers, Up: Syntax checker definitions
+
+5.2 Finding the right error patterns
+====================================
+
+Finding the right error patterns is the hardest part of a syntax checker
+definition. For a first version, you just run the tool on a file, look
+at its output and write a regular expression to match it. ‘M-x shell’
+comes handy here.
+
+ However, as you start to debug and refine your patterns, this quickly
+becomes cumbersome. Flycheck provides an easier way to test a syntax
+checker: Evaluate the syntax checker definition with ‘C-M-x’ and run
+‘flycheck-compile’.
+
+‘C-c ! C-c’
+‘M-x flycheck-compile’
+ Run a syntax checker on the current buffer in a fresh Compilation
+ Mode buffer. Prompt for a syntax checker to run.
+
+ This command runs the command like a normal syntax check would do,
+but instead of highlighting errors within the buffer it shows a new
+buffer in Compilation Mode, which contains the entire output of the
+command and highlights everything that matches a pattern. You can then
+refine the error pattern, and iterate through this process until the
+error pattern is complete.
+
+ The ‘re-builder’ tool can help you to quickly develop patterns for
+ the current output. It lets you interactively develop a regular
+ expression while continously matching the current expression
+ against the buffer contents. Start ‘re-builder’ with ‘M-x
+ re-builder’, and switch to the ‘rx’ syntax with ‘C-c TAB’. Then
+ type your ‘rx’ expression into the small window at the bottom, and
+ observe how the matching parts of the buffer are highlighted.
+
+ Note that ‘re-builder’ does _not_ support the special Flycheck ‘rx’
+ forms available in ‘:error-patterns’. As such, you cannot directly
+ type a Flycheck expression into ‘re-builder’.
+
+ Sometimes however an output format doesn’t lend itself to error
+patterns. In this case, you need to write a more sophisticated parser
+yourself. *Note Parsing structured output::, for more information.
+
+\1f
+File: flycheck.info, Node: Trying new checkers, Next: Registering new checkers, Prev: Finding error patterns, Up: Syntax checker definitions
+
+5.3 Trying a new syntax checker
+===============================
+
+After evaluating a syntax checker definition you can try whether it
+works for normal syntax checks by selecting it manually with ‘C-c ! s’
+or ‘M-x flycheck-select-checker’. If anything breaks, you can unselect
+the syntax checker again with ‘C-u C-c ! s’ and fix the error without
+further affecting Flycheck.
+
+ Once you have confirmed that your new syntax checker works
+flawlessly, you can make it available for automatic syntax checking by
+registering it.
+
+\1f
+File: flycheck.info, Node: Registering new checkers, Next: Parsing structured output, Prev: Trying new checkers, Up: Syntax checker definitions
+
+5.4 Registering new syntax checkers
+===================================
+
+To register a new syntax checker for automatic syntax checking, just add
+it to ‘flycheck-checkers’:
+
+ (add-to-list 'flycheck-checkers 'python-pylint)
+
+ Flycheck will try all syntax checkers in this variable when checking
+a buffer automatically, and check the buffer with the first syntax
+checker in this list whose ‘:modes’ contains the current major mode.
+
+ Do _not_ use ‘flycheck-checker’ and ‘flycheck-select-checker’ to
+ enable your own syntax checker in Flycheck extensions. They are
+ reserved for _user customization_.
+
+ Specifically, please do _not_ provide a hook function which selects
+ the syntax checker explicitly by assigning to ‘flycheck-checker’ or
+ by calling ‘flycheck-select-checker’. In other words, this is
+ *bad*:
+
+ (defun enable-my-new-syntax-checker ()
+ (setq flycheck-checker 'my-new-syntax-checker)
+ (flycheck-buffer))
+
+ (add-hook 'my-major-mode-hook #'enable-my-new-syntax-checker)
+
+ This circumvents the entire automatic selection of Flycheck, and
+ prevents the user from effectively customizing Flycheck.
+
+ Instead, just register your syntax checker in ‘flycheck-checkers’
+ and let Flycheck automatically pick the best syntax checker. In
+ other words, this is *good*:
+
+ (add-to-list 'flycheck-checkers 'my-new-syntax-checker)
+
+\1f
+File: flycheck.info, Node: Parsing structured output, Next: Passing configuration to checkers, Prev: Registering new checkers, Up: Syntax checker definitions
+
+5.5 Parsing structured output
+=============================
+
+If your syntax checker tool offers some structured output format as
+alternative to human-readable free text, you can use an ‘:error-parser’
+function instead of writing an error pattern. For instance, JSHint
+(http://www.jshint.com/) offers the widely spread Checkstyle XML output
+format which Flycheck supports out of the box:
+
+ (flycheck-define-checker javascript-jshint
+ "A JavaScript syntax and style checker using jshint.
+
+ See URL `http://www.jshint.com'."
+ :command ("jshint" "--checkstyle-reporter" source)
+ :error-parser flycheck-parse-checkstyle
+ :modes (js-mode js2-mode js3-mode))
+
+ As you can see, there are no patterns in this definition. Instead
+Flycheck calls the function ‘flycheck-parse-checkstyle’ to parse the
+output. This function parses the XML to extract the errors. It’s
+built-in into Flycheck, so if your tool supports Checkstyle XML, error
+parsing comes _for free_ in Flycheck. *Note Error parsers::, for more
+information about error parsers.
+
+\1f
+File: flycheck.info, Node: Passing configuration to checkers, Next: Controlling use of checkers, Prev: Parsing structured output, Up: Syntax checker definitions
+
+5.6 Passing options and configuration files to syntax checkers
+==============================================================
+
+Many linting tools provide a rich set of options to configure their
+analysis. Flycheck makes it easy to define proper Emacs options and map
+them to options of commands.
+
+ For instance, the Rubocop (https://github.com/bbatsov/rubocop) tool
+checks Ruby for semantic and stylistic issues. Since style is mainly a
+matter of taste, it has a special linting mode in which all stylistic
+checks are disabled (error patterns omitted for readability):
+
+ (flycheck-define-checker ruby-rubocop
+ "A Ruby syntax and style checker using the RuboCop tool.
+
+ See URL `http://batsov.com/rubocop/'."
+ :command ("rubocop" "--format" "emacs"
+ (option-flag "--lint" flycheck-rubocop-lint-only)
+ source)
+ :error-patterns ...
+ :modes (ruby-mode))
+
+ Note the special ‘option-flag’ argument, which splices the value of
+the boolean Emacs option ‘flycheck-rubocop-lint-only’ into the command:
+If the variable is non-nil, Flycheck adds the ‘--lint’ option to the
+final command line, otherwise Flycheck omits the entire argument.
+
+ Flycheck also supports other special ‘option-’ arguments for plain
+values or lists of values. *Note Argument Substitution::, for a list of
+all special arguments.
+
+ Flycheck also provides a convenience macro ‘flycheck-def-option-var’
+to declare these options:
+
+ (flycheck-def-option-var flycheck-rubocop-lint-only nil ruby-rubocop
+ "Whether to only report code issues in Rubocop.
+
+ When non-nil, only report code issues in Rubocop, via `--lint'.
+ Otherwise report style issues as well."
+ :safe #'booleanp
+ :type 'boolean)
+
+ Essentially, this macro is just a wrapper around the built-in
+‘defcustom’, which additionally keeps track of the syntax checker the
+option belongs to, and adds the option to the appropriate custom group.
+You can pass arbitrary custom keywords to this macro as we did in this
+example: ‘:type’ marks this option as boolean flag, and ‘:safe’ allows
+the use as file-local variable, if the value is boolean. *Note Syntax
+checker options::, for more information about syntax checker
+configuration, and *note Checker configuration::, for the corresponding
+API reference.
+
+ By a similar mechanism you can also pass paths to configuration files
+to a syntax checker tool. The aforementioned Pylint
+(http://www.pylint.org/) reads a configuration file for instance:
+
+ (flycheck-define-checker python-pylint
+ "A Python syntax and style checker using Pylint.
+
+ This syntax checker requires Pylint 1.0 or newer.
+
+ See URL `http://www.pylint.org/'."
+ ;; -r n disables the scoring report
+ :command ("pylint" "-r" "n"
+ "--msg-template" "{path}:{line}:{column}:{C}:{msg} ({msg_id})"
+ (config-file "--rcfile" flycheck-pylintrc)
+ source)
+ :error-patterns ...
+ :modes python-mode)
+
+ The special ‘config-file’ argument passes a configuration file from
+‘flycheck-pylintrc’ to ‘pylint’, if the value of the variable is
+non-nil.
+
+ Flycheck provides a sophisticated logic to find an appropriate
+configuration file. *Note Syntax checker configuration files::, for
+more information about syntax checker configuration, and *note Checker
+configuration::, for the corresponding API reference.
+
+\1f
+File: flycheck.info, Node: Controlling use of checkers, Next: Applying multiple checkers, Prev: Passing configuration to checkers, Up: Syntax checker definitions
+
+5.7 Controlling the use of a syntax checker
+===========================================
+
+If you need more control about when a syntax checker is used for syntax
+checking, you can supply a custom ‘:predicate’ function. Consider the
+following syntax checker for Zsh scripts in Sh Mode:
+
+ (flycheck-define-checker sh-zsh
+ "A Zsh syntax checker using the Zsh shell.
+
+ See URL `http://www.zsh.org/'."
+ :command ("zsh" "-n" "-d" "-f" source)
+ :error-patterns
+ ((error line-start (file-name) ":" line ": " (message) line-end))
+ :modes sh-mode
+ :predicate (lambda () (eq sh-shell 'zsh)))
+
+ Sh Mode also supports Bash and other shells besides Zsh, so we
+additionally provide a ‘:predicate’ that checks whether the current
+buffer has the right shell.
+
+ You can even omit ‘:modes’ and only use a predicate to determine
+whether a syntax checker is applicable for the current buffer.
+
+\1f
+File: flycheck.info, Node: Applying multiple checkers, Prev: Controlling use of checkers, Up: Syntax checker definitions
+
+5.8 Applying multiple syntax checkers
+=====================================
+
+Frequently, we would like to use multiple syntax checkers in a buffer.
+For instance, we might want to check the syntax of a script with
+‘sh-zsh’ from the previous section, and then use Shellcheck
+(https://github.com/koalaman/shellcheck/) to check for questionable code
+such as unquoted variable expansions, if there are no syntax errors.
+Flycheck supports this scenario by _chaining_ syntax checkers.
+
+ Suppose we defined a syntax checker for Shellcheck called
+SH-SHELLCHECK as follows:
+
+ (flycheck-define-checker sh-shellcheck
+ "A shell script syntax and style checker using Shellcheck.
+
+ See URL `https://github.com/koalaman/shellcheck/'."
+ :command ("shellcheck" "-f" "checkstyle"
+ "-s" (eval (symbol-name sh-shell))
+ source)
+ :modes sh-mode
+ :error-parser flycheck-parse-checkstyle)
+
+ Note how we use the special ‘eval’ argument to put the result of an
+arbitrary Emacs Lisp expression into the command line of ‘shellcheck’,
+in order to tell Shellcheck what shell the script is written for.
+
+ We can now arrange for this syntax checker to be used after ‘sh-zsh’
+with ‘flycheck-add-next-checker’:
+
+ (flycheck-add-next-checker 'sh-zsh '(warning . sh-shellcheck))
+
+ The first item of the cons cell in the second argument is the
+_maximum error level_ in the buffer, for which ‘sh-shellcheck’ is still
+applicable. With ‘warning’ Flycheck will run ‘sh-shellcheck’ after
+‘sh-zsh’ if there are ‘warning’ or ‘info’ level errors from ‘sh-zsh’,
+but not if there are any errors with level ‘error’, such as syntax
+errors.
+
+ Flycheck will only use a chained syntax checker if it is registered
+in ‘flycheck-checkers’, so we need to register our new syntax checker
+(*note Registering new checkers::):
+
+ (add-to-list 'flycheck-checkers 'sh-shellcheck 'append)
+
+ Note that unlike before we _append_ the new syntax checker at the end
+of ‘flycheck-checkers’. This ensures that Flycheck does not try
+‘sh-shellcheck’ _before_ ‘sh-zsh’. Flycheck tries all syntax checkers
+in this list in _order of appearance_, so if you add your new chained
+syntax checker at the beginning, it will likely be used right away,
+before any prior syntax checkers.
+
+ You also can specify chained syntax checkers directly in
+‘flycheck-define-checker’ with the ‘:next-checkers’ property. Instead
+of calling ‘flycheck-add-next-checker’, we could also have added this
+property to the definition of ‘sh-zsh’:
+
+ (flycheck-define-checker sh-zsh
+ "A Zsh syntax checker using the Zsh shell.
+
+ See URL `http://www.zsh.org/'."
+ :command ("zsh" "-n" "-d" "-f" source)
+ :error-patterns ...
+ :modes sh-mode
+ :predicate (lambda () (eq sh-shell 'zsh))
+ :next-checkers ((warning . sh-shellcheck)))
+
+ If you control the definition of both syntax checkers, this style is
+_preferable_ to ‘flycheck-add-next-checker’. Use the latter only if you
+cannot change the definition of the prior syntax checker.
+
+\1f
+File: flycheck.info, Node: Flycheck hooks, Next: Flycheck API, Prev: Syntax checker definitions, Up: Top
+
+6 Flycheck hooks
+****************
+
+This chapter gives you a brief overview over Flycheck’s rich hook
+interface, which you can use for your own extensions.
+
+6.1 Status changes
+==================
+
+‘flycheck-before-syntax-check-hook’ and
+‘flycheck-after-syntax-check-hook’ run before and after syntax checks,
+and let you update your Emacs instance according to Flycheck’s state.
+For instance, flycheck-color-mode-line
+(https://github.com/flycheck/flycheck-color-mode-line) uses these hooks
+to colour your mode-line according to the result of the last syntax
+check. Additionally, ‘flycheck-status-changed-functions’ runs on every
+single status change of Flycheck, and provides a fine-grained reporting
+about what Flycheck is currently doing.
+
+6.2 Executables and commands
+============================
+
+Flycheck uses the function given by the option
+‘flycheck-executable-find’ to search for executables, and passes all
+syntax checker commands through ‘flycheck-command-wrapper-function’
+before running them. These features let you adapt Flycheck to search
+executables and run commands in sandboxed environments such as ‘bundle
+exec’ or ‘nix-shell’.
+
+6.3 Error processing
+====================
+
+The functions in ‘flycheck-process-error-functions’ are used to process
+new errors reported by a Flycheck syntax checker. Add to this hook to
+get informed about each error reported in a Flycheck buffer. In fact,
+Flycheck uses this hook itself: The standard value
+‘flycheck-add-overlay’ is responsible for adding error highlighting to
+the buffer. As a consequence, you can _entirely opt out_ from
+highlighting with a custom hook.
+
+6.4 Error display
+=================
+
+The function ‘flycheck-display-errors-function’ is called to display an
+error at point. The flycheck-pos-tip
+(https://github.com/flycheck/flycheck-pos-tip) extension uses this hook
+to show errors in a GUI popup like conventional IDEs do.
+
+\1f
+File: flycheck.info, Node: Flycheck API, Next: Supported languages, Prev: Flycheck hooks, Up: Top
+
+7 Flycheck API
+**************
+
+TODO: The API documentation still needs to be written.
+
+* Menu:
+
+* Command syntax checkers:: Syntax checkers with external commands
+* Errors:: Error representation in Flycheck
+
+\1f
+File: flycheck.info, Node: Command syntax checkers, Next: Errors, Up: Flycheck API
+
+7.1 Command syntax checkers
+===========================
+
+* Menu:
+
+* Argument Substitution:: Argument substitution in syntax checker commands
+* Checker configuration:: Configuration for command checkers
+* Error parsers:: Parsing structured output formats
+
+\1f
+File: flycheck.info, Node: Argument Substitution, Next: Checker configuration, Up: Command syntax checkers
+
+7.1.1 Argument substitution
+---------------------------
+
+\1f
+File: flycheck.info, Node: Checker configuration, Next: Error parsers, Prev: Argument Substitution, Up: Command syntax checkers
+
+7.1.2 Configuration options and files
+-------------------------------------
+
+\1f
+File: flycheck.info, Node: Error parsers, Prev: Checker configuration, Up: Command syntax checkers
+
+7.1.3 Error parsers
+-------------------
+
+\1f
+File: flycheck.info, Node: Errors, Prev: Command syntax checkers, Up: Flycheck API
+
+7.2 Errors
+==========
+
+\1f
+File: flycheck.info, Node: Supported languages, Next: Getting Help, Prev: Flycheck API, Up: Top
+
+Appendix A Supported languages
+******************************
+
+This chapter lists the languages supported by Flycheck. 3rd party
+extensions may provide for more languages; please take a look at our
+list of extensions (http://www.flycheck.org/extensions.html) for more
+information.
+
+ Each language has one or more syntax checkers, whose names follow a
+convention of ‘LANGUAGE-TOOL’ where LANGUAGE is the programming language
+checked by the checker, and TOOL the name of the checker tool.
+
+ The syntax checkers are listed in the order they are applied to a
+buffer. Use ‘C-c ! ?’ (‘flycheck-describe-checker’) to obtain more
+information about a syntax checker, and ‘C-h v’ (‘describe-variable’) to
+read the complete docstring of any option.
+
+ Flycheck supports the following languages:
+
+ • *note Ada::
+ • *note AsciiDoc::
+ • *note C/C++::
+ • *note CFEngine::
+ • *note Chef::
+ • *note Coffeescript::
+ • *note Coq::
+ • *note CSS::
+ • *note D::
+ • *note Emacs Lisp::
+ • *note Erlang::
+ • *note ERuby::
+ • *note Fortran::
+ • *note Go::
+ • *note Groovy::
+ • *note Haml::
+ • *note Handlebars::
+ • *note Haskell::
+ • *note HTML::
+ • *note Jade::
+ • *note Javascript::
+ • *note JSON::
+ • *note Less::
+ • *note Lua::
+ • *note Perl::
+ • *note PHP::
+ • *note Processing::
+ • *note Puppet::
+ • *note Python::
+ • *note R::
+ • *note RPM Spec::
+ • *note reStructuredText::
+ • *note Ruby::
+ • *note Rust::
+ • *note Sass::
+ • *note Scala::
+ • *note SCSS::
+ • *note Shell scripting languages::
+ • *note Slim::
+ • *note SQL::
+ • *note TeX/LaTeX::
+ • *note Texinfo::
+ • *note Verilog::
+ • *note XML::
+ • *note YAML::
+
+Ada
+===
+
+ • ‘ada-gnat’ (GNAT (https://gcc.gnu.org/onlinedocs/gnat_ugn_unw/)),
+ with the following options:
+
+ ‘flycheck-gnat-args’
+ A list of additional arguments to GNAT.
+ ‘flycheck-gnat-include-path’
+ A list of include directories for GNAT. Relative paths are
+ relative to the file being checked.
+ ‘flycheck-gnat-language-standard’
+ The language standard to use in GNAT, as string.
+ ‘flycheck-gnat-warnings’
+ A list of additional warnings to enable in GNAT. Each item is
+ the name of a warning category to enable.
+
+AsciiDoc
+========
+
+ • ‘asciidoc’ (AsciiDoc (http://www.methods.co.nz/asciidoc))
+
+C/C++
+=====
+
+ 1. ‘c/c++-clang’ (syntax and type check with Clang
+ (http://clang.llvm.org/)) or ‘c/c++-gcc’ (syntax and type check
+ with GCC (https://gcc.gnu.org/)), and
+ 2. ‘c/c++-cppcheck’ (style and error check with cppcheck
+ (http://cppcheck.sourceforge.net/)).
+
+ ‘c/c++-clang’ and ‘c/c++-gcc’ provide the following options:
+
+‘flycheck-clang-args’
+‘flycheck-gcc-args’
+ A list of additional arguments for Clang/GCC.
+‘flycheck-clang-blocks’
+ Whether to enable blocks in Clang.
+‘flycheck-clang-definitions’
+‘flycheck-gcc-definitions’
+ A list of additional preprocessor definitions for Clang/GCC.
+‘flycheck-clang-include-path’
+‘flycheck-gcc-include-path’
+ A list of include directories for Clang/GCC, relative to the file
+ being checked.
+‘flycheck-clang-includes’
+‘flycheck-gcc-includes’
+ A list of additional include files for Clang/GCC, relative to the
+ file being checked.
+‘flycheck-clang-language-standard’
+‘flycheck-gcc-language-standard’
+ The language standard to use in Clang/GCC, as string, via the
+ ‘-std’ option.
+‘flycheck-clang-ms-extensions’
+ Whether to enable Microsoft extensions to C/C++ in Clang.
+‘flycheck-clang-no-exceptions’
+‘flycheck-gcc-no-exceptions’
+ Whether to disable exceptions in Clang/GCC.
+‘flycheck-clang-no-rtti’
+‘flycheck-gcc-no-rtti’
+ Whether to disable RTTI in Clang/GCC, via ‘-fno-rtti’.
+‘flycheck-clang-standard-library’
+ The name of the standard library to use for Clang, as string.
+‘flycheck-gcc-openmp’
+ Whether to enable OpenMP in GCC.
+‘flycheck-clang-pedantic’
+‘flycheck-gcc-pedantic’
+ Whether to warn about language extensions in Clang/GCC.
+‘flycheck-clang-pedantic-errors’
+‘flycheck-gcc-pedantic-errors’
+ Whether to error on language extensions in Clang/GCC.
+‘flycheck-clang-warnings’
+‘flycheck-gcc-warnings’
+ A list of additional warnings to enable in Clang. Each item is the
+ name of a warning or warning category for ‘-W’.
+
+‘c/c++-cppcheck’ provides the following options:
+
+‘flycheck-cppcheck-checks’
+ A list of enabled checks for cppcheck. Each item is the name of a
+ check for the ‘--enable’ option.
+‘flycheck-cppcheck-inconclusive’
+ Whether to enable inconclusive checks in cppcheck. These checks
+ may yield more false positives than normal checks.
+‘flycheck-cppcheck-include-path’
+ A list of include directories for cppcheck. Relative paths are
+ relative to the file being checked.
+‘flycheck-cppcheck-language-standard’
+ The C or C++ language standard to use with cppcheck via ‘--std=’.
+
+CFEngine
+========
+
+ • ‘cfengine’ (CFEngine (http://cfengine.com/))
+
+Chef
+====
+
+ • ‘chef-foodcritic’ (style check with foodcritic
+ (http://acrmp.github.io/foodcritic/)), with the following option:
+
+ ‘flycheck-foodcritic-tags’
+ A list of tags to select for Foodcritic.
+
+Coffeescript
+============
+
+ 1. ‘coffee’ (syntax check with coffee (http://coffeescript.org/))
+ 2. ‘coffee-coffeelint’ (code style check with coffeelint
+ (http://www.coffeelint.org/)), with the following option:
+
+ ‘flycheck-coffeelintrc’
+ Configuration file for coffeelint. *Note Syntax checker
+ configuration files::, for more information about
+ configuration files.
+
+Coq
+===
+
+ • ‘coq’ (Coq (http://coq.inria.fr/))
+
+CSS
+===
+
+ • ‘css-csslint’ (style and error check with CSSLint
+ (https://github.com/CSSLint/csslint))
+
+D
+=
+
+ • ‘d-dmd’ (DMD (http://dlang.org/)), with the following options:
+
+ ‘flycheck-dmd-include-path’
+ A list of include directories for DMD.
+ ‘flycheck-dmd-args’
+ A list of additional arguments for DMD.
+
+ The extension flycheck-d-unittest
+ (https://github.com/flycheck/flycheck-d-unittest) adds a syntax
+ checker which runs D unittests on the fly and reports the results.
+
+Emacs Lisp
+==========
+
+ 1. ‘emacs-lisp’ (syntax check with the built-in Emacs byte compiler)
+ 2. ‘emacs-lisp-checkdoc’ (code and documentation check with
+ ‘checkdoc’)
+
+ The extension flycheck-package
+ (https://github.com/purcell/flycheck-package) adds a syntax checker
+ which checks for violations of Emacs Lisp packaging conventions.
+
+ The ‘emacs-lisp’ checker provides the following options
+
+‘flycheck-emacs-lisp-load-path’
+ The load path to use while checking Emacs Lisp files, as list of
+ strings. Relative directories are expanded against the
+ ‘default-directory’ of the buffer being checked.
+
+‘flycheck-emacs-lisp-initialize-packages’
+ Whether to initialize Emacs’ package manager with
+ ‘package-initialize’ before checking the buffer. If set to ‘auto’
+ (the default), only initialize the package managers for files in
+ under ‘user-emacs-directory’.
+
+‘flycheck-emacs-lisp-package-user-dir’
+ The package directory for the Emacs Lisp checker, as string. Has
+ no effect if ‘flycheck-emacs-lisp-initialize-packages’ is nil.
+
+Erlang
+======
+
+ • ‘erlang’ (Erlang (http://www.erlang.org/))
+
+ ‘flycheck-erlang-include-path’
+ A list of include directories for Erlang.
+
+ ‘flycheck-erlang-library-path’
+ A list of library directories for Erlang.
+
+ERuby
+=====
+
+ • ‘eruby-erubis’ (‘erubis’ (http://www.kuwata-lab.com/erubis/))
+
+Fortran
+=======
+
+ 1. ‘fortran-gfortran’ (GFortran
+ (https://gcc.gnu.org/onlinedocs/gfortran/)), with the following
+ options:
+
+ ‘flycheck-gfortran-args’
+ A list of additional arguments to GFortran.
+
+ ‘flycheck-gfortran-include-path’
+ A list of include directories for GFortran. Relative paths
+ are relative to the file being checked.
+
+ ‘flycheck-gfortran-language-standard’
+ The language standard to use with GFortran, for the ‘-std’
+ option.
+
+ ‘flycheck-gfortran-layout’
+ The source code layout to use with GFortran. Set to ‘free’ or
+ ‘fixed’ for free or fixed layout respectively, or nil (the
+ default) to let GFortran automatically determine the layout.
+
+ ‘flycheck-gfortran-warnings’
+ A list of warnings enabled for GFortran, via the ‘-W’ option.
+
+Go
+==
+
+ 1. ‘go-gofmt’ (syntax check with gofmt (http://golang.org/cmd/gofmt/))
+ 2. ‘go-golint’ (coding style with Golint
+ (https://github.com/golang/lint))
+ 3. ‘go-vet’ (check for suspicious code with ‘go tool vet’
+ (http://godoc.org/golang.org/x/tools/cmd/vet))
+ 4. ‘go-build’ or ‘go-test’ (syntax and type check with Go
+ (http://golang.org/cmd/go), for source and tests respectively)
+ 5. ‘go-errcheck’ (check for unhandled error returns with errcheck
+ (https://github.com/kisielk/errcheck))
+
+ ‘go-vet’ provides the following option:
+
+‘flycheck-go-build-install-deps’
+ Whether to install dependencies while checking with ‘go build’.
+
+‘flycheck-go-build-tags’
+ A list of tags for ‘go build’.
+
+‘flycheck-go-vet-print-functions’
+ A list of print-like functions for go vet. Go vet will check these
+ functions for format string problems.
+
+Groovy
+======
+
+ • ‘groovy’ (syntax check using groovy compiler API
+ (<http://www.groovy-lang.org/>))
+
+Haml
+====
+
+ • ‘haml’ (Haml (http://haml.info/))
+
+Handlebars
+==========
+
+ • ‘handlebars’ (Handlebars (http://handlebarsjs.com/))
+
+Haskell
+=======
+
+ 1. • ‘haskell-stack-ghc’ (syntax and type checker using Stack
+ (https://github.com/commercialhaskell/stack)) in Stack
+ projects, or
+ • ‘haskell-ghc’ (syntax and type checker with GHC
+ (http://www.haskell.org/ghc/)),
+
+ 2. and ‘haskell-hlint’ (style checker with hlint
+ (https://github.com/ndmitchell/hlint)), with the following options:
+
+ ‘flycheck-hlint-args’
+ A list of additional arguments for Hlint.
+
+ ‘flycheck-hlint-language-extensions’
+ Extensions list.
+
+ ‘flycheck-hlint-ignore-rules’
+ Ignore rules list.
+
+ ‘flycheck-hlint-hint-packages’
+ Hint packages to include.
+
+ ‘flycheck-hlintrc’
+ Configuration file for hlint. *Note Syntax checker
+ configuration files::, for more information about
+ configuration files.
+
+ The extension flycheck-haskell
+ (https://github.com/flycheck/flycheck-haskell) configures Flycheck
+ from the current Cabal project, and adds support for Cabal
+ sandboxes. The extension flycheck-hdevtools
+ (https://github.com/flycheck/flycheck-hdevtools) adds an
+ alternative syntax checker for ‘haskell-ghc’ using hdevtools
+ (https://github.com/bitc/hdevtools/).
+
+ The ‘haskell-ghc’ checker provides the following options:
+
+‘flycheck-ghc-args’
+ A list of additional arguments for GHC.
+
+‘flycheck-ghc-no-user-package-database’
+ Whether to disable the user package database in GHC.
+
+‘flycheck-ghc-package-databases’
+ A list of additional package databases for GHC. Each item points to
+ a directory containing a package directory, for the ‘-package-db’
+ option.
+
+‘flycheck-ghc-search-path’
+ A list of module directories for GHC, via the ‘-i’ option.
+
+‘flycheck-ghc-language-extensions’
+ A list of language extensions for GHC, via ‘-X’.
+
+HTML
+====
+
+ • ‘html-tidy’ (Tidy HTML5 (https://github.com/w3c/tidy-html5)), with
+ the following option:
+
+ ‘flycheck-tidyrc’
+ Configuration file for Tidy. *Note Syntax checker
+ configuration files::, for more information about
+ configuration files.
+
+Jade
+====
+
+ • ‘jade’ (using Jade (http://jade-lang.com/))
+
+Javascript
+==========
+
+ 1. • ‘javascript-jshint’ (JSHint (http://jshint.com/)),
+ • or ‘javascript-eslint’ (ESLint (http://eslint.org/)),
+ • or ‘javascript-gjslint’ (Closure Linter
+ (https://developers.google.com/closure/utilities))
+ 2. ‘javascript-jscs’ (JSCS (http://jscs.info/))
+ 3. ‘javascript-standard’ (Standard
+ (https://github.com/feross/standard) or Semistandard
+ (https://github.com/Flet/semistandard))
+
+ These checkers provide the following option:
+
+‘flycheck-eslint-rulesdir’
+ A directory with custom rules for ESLint.
+‘flycheck-jshint-extract-javascript’
+ Whether to extract Javascript from HTML before linting with JSHint.
+‘flycheck-eslintrc’
+ Configuration file for ESLint. *Note Syntax checker configuration
+ files::, for more information about configuration files.
+‘flycheck-jshintrc’
+ Configuration file for JSHint. *Note Syntax checker configuration
+ files::, for more information about configuration files.
+‘flycheck-gjslintrc’
+ Configuration file for Closure Linter. *Note Syntax checker
+ configuration files::, for more information about configuration
+ files.
+‘flycheck-jscsrc’
+ Configuration file for JSCS. *Note Syntax checker configuration
+ files::, for more information about configuration files.
+
+JSON
+====
+
+ • ‘json-jsonlint’ (jsonlint (https://github.com/zaach/jsonlint))
+ • or ‘json-python-json’ (Python json.tool module
+ (https://docs.python.org/3.5/library/json.html))
+
+Less
+====
+
+ • ‘less’ (less (http://lesscss.org/))
+
+Lua
+===
+
+ • ‘luacheck’ (Luacheck (https://github.com/mpeterv/luacheck)) with
+ the following option:
+
+ ‘flycheck-luacheckrc’
+ Configuration file for Luacheck. *Note Syntax checker
+ configuration files::, for more information about
+ configuration files.
+
+ • ‘lua’ (Lua compiler (http://www.lua.org/))
+
+Perl
+====
+
+ 1. ‘perl’ (syntax check with the Perl interpreter
+ (http://www.perl.org/))
+ 2. ‘perl-perlcritic’ (style and code check with Perl::Critic
+ (https://metacpan.org/pod/Perl::Critic))
+
+ These syntax checkers checker provide the following options:
+
+‘flycheck-perl-include-path’
+ A list of include directories for Perl, relative to the file being
+ checked.
+‘flycheck-perlcriticrc’
+ Configuration file for Perl::Critic. *Note Syntax checker
+ configuration files::, for more information about configuration
+ files.
+‘flycheck-perlcritic-severity’
+ The severity level for Perl::Critic, as integer for the
+ ‘--severity’ option of Perl::Critic.
+
+PHP
+===
+
+ 1. ‘php’ (syntax check with PHP CLI
+ (http://php.net/manual/en/features.commandline.php))
+ 2. ‘php-phpmd’ (code check with PHP Mess Detector (http://phpmd.org/))
+ 3. ‘php-phpcs’ (style check with PHP CodeSniffer
+ (http://pear.php.net/package/PHP_CodeSniffer/))
+
+ These checkers provide the following options:
+
+‘flycheck-phpmd-rulesets’
+ A list of rule sets for PHP Mess Detector as strings. Each item is
+ either the name of a default rule set, or the path to a custom rule
+ set file.
+
+‘flycheck-phpcs-standard’
+ The coding standard for PHP CodeSniffer, either as name of a
+ built-in standard, or as path to a standard specification.
+
+Processing
+==========
+
+ • ‘processing’ (using the Processing command-line tool
+ (https://processing.org/))
+
+Puppet
+======
+
+ • ‘puppet-parser’ (syntax check with Puppet (http://puppetlabs.com/))
+ • ‘puppet-lint’ (style check with Puppet Lint
+ (http://puppet-lint.com/))
+
+ ‘puppet-lint’ provides the following options:
+‘flycheck-puppet-lint-rc’
+ Configuration file for puppet-lint. *Note Syntax checker
+ configuration files::, for more information about configuration
+ files.
+‘flycheck-puppet-lint-disabled-checks’
+ A list of Puppet Lint checks to disable.
+
+Python
+======
+
+ • ‘python-flake8’ (syntax and style checking with flake8
+ (https://pypi.python.org/pypi/flake8)), or
+ • ‘python-pylint’ (syntax and style checking with Pylint
+ (http://pylint.org/)), or
+ • ‘python-pycompile’ (syntax checking with Python’s built-in byte
+ compiler (https://docs.python.org/3.4/library/py_compile.html), as
+ last resort)
+
+ The extension flycheck-pyflakes
+ (https://github.com/Wilfred/flycheck-pyflakes) adds a syntax
+ checker using Pyflakes (https://pypi.python.org/pypi/pyflakes).
+
+ ‘python-flake8’ provides the following options:
+
+‘flycheck-flake8-error-level-alist’
+ An alist mapping Flake8 error IDs to Flycheck error levels.
+
+‘flycheck-flake8-maximum-complexity’
+ The maximum McCabe complexity of methods allowed by Flake8.
+
+‘flycheck-flake8-maximum-line-length’
+ The maximum length of lines for Flake8.
+
+‘flycheck-flake8rc’
+ Configuration file for Flake8. *Note Syntax checker configuration
+ files::, for more information about configuration files.
+
+ ‘python-pylint’ provides the following options:
+
+‘flycheck-pylint-use-symbolic-id’
+ A boolean indicating whether to report symbolic or numeric message
+ identifiers. For example, whether to report a message type as
+ no-name-in-module, or E0611. On by default.
+
+‘flycheck-pylintrc’
+ Configuration file for Pylint. *Note Syntax checker configuration
+ files::, for more information about configuration files.
+
+R
+=
+
+ • ‘r-lintr’ (syntax and style check with lintr
+ (https://github.com/jimhester/lintr)), with the following options:
+
+ ‘flycheck-lintr-caching’
+ Whether to enable caching in lintr. On by default. Only
+ disable it if caching causes real problems.
+
+ ‘flycheck-lintr-linters’
+ Linters to use with lintr, as a string containing an R
+ expression which selects the linters to use.
+
+RPM Spec
+========
+
+ • ‘rpm-rpmlint’ (rpmlint (http://sourceforge.net/projects/rpmlint/))
+
+reStructuredText
+================
+
+ • ‘rst-sphinx’ (using Sphinx (http://sphinx-doc.org/), for Sphinx
+ documentation files), or ‘rst’ (using docutils
+ (http://docutils.sourceforge.net/), for plain reStructuredFiles
+ files)
+
+ ‘rst-sphinx’ provides the following option:
+
+‘flycheck-sphinx-warn-on-missing-references’
+ Whether to emit warnings for all missing references in Sphinx.
+
+Ruby
+====
+
+ 1. ‘ruby-rubocop’ (syntax and style check using RuboCop
+ (http://batsov.com/rubocop/))
+ 2. ‘ruby-rubylint’ (syntax and style check using ruby-lint
+ (http://code.yorickpeterse.com/ruby-lint/latest/))
+
+ These checkers provide the following options
+
+‘flycheck-rubocop-lint-only’
+ Whether to suppress warnings about style issues in Rubocop, via the
+ ‘--lint’ option.
+‘flycheck-rubocoprc’
+ Configuration file for Rubocop. *Note Syntax checker configuration
+ files::, for more information about configuration files.
+‘flycheck-rubylintrc’
+ Configuration file for ruby-lint. *Note Syntax checker
+ configuration files::, for more information about configuration
+ files.
+
+ If none of the above is available, Flycheck will fall back to one of
+the following checkers for very basic checking:
+
+ • ‘ruby’ (using the standard Ruby interpreter
+ (https://www.ruby-lang.org/)), or
+ • ‘ruby-jruby’ (using JRuby (http://jruby.org/))
+
+Rust
+====
+
+ • ‘rust-cargo’ (using the Cargo (https://crates.io/)), or
+
+ • ‘rust’ (using the Rust compiler (http://www.rust-lang.org/))
+
+ These checkers provide the following options:
+
+ ‘flycheck-rust-args’
+ A list of additional arguments for the Rust compiler ‘rustc’.
+
+ ‘flycheck-rust-check-tests’
+ Whether to check test code in Rust.
+
+ ‘flycheck-rust-crate-root’
+ A path to the crate root for the current buffer, or nil if the
+ current buffer is a crate by itself. ‘rust-cargo’ ignores
+ this option, as the crate root comes from Cargo.
+
+ ‘flycheck-rust-crate-type’
+ The type of the crate to check, as string for the
+ ‘--crate-type’ option.
+ ‘flycheck-rust-library-path’
+ A list of additional library directories for Rust. Relative
+ paths are relative to the buffer being checked.
+
+ The flycheck-rust (https://github.com/flycheck/flycheck-rust)
+ extension configures Flycheck according to the current Cargo
+ (http://doc.crates.io/guide.html) project.
+
+Sass
+====
+
+ • ‘sass’ (using the standard Sass processor (http://sass-lang.com/)),
+ with the following option:
+
+ ‘flycheck-sass-compass’
+ Whether to enable the Compass CSS framework in SASS, via
+ ‘--compass’.
+
+Scala
+=====
+
+ 1. ‘scala’ (syntax and type check using the Scala compiler
+ (http://www.scala-lang.org/))
+ 2. ‘scala-scalastyle’ (style check using Scalastyle
+ (http://www.scalastyle.org/))
+
+ The ‘scala-scalastyle’ syntax checker needs the following option:
+
+‘flycheck-scalastylerc’
+ Configuration file for Scalastyle. *Note Syntax checker
+ configuration files::, for more information about configuration
+ files.
+
+ If this option is not set, or if the configuration file was not found
+‘scala-scalastyle’ will not be used.
+
+SCSS
+====
+
+ • ‘scss-lint’ (using SCSS-Lint
+ (https://github.com/brigade/scss-lint)), or
+ • ‘scss’ (using the standard SCSS processor (http://sass-lang.com/))
+
+ These syntax checkers provide the following options:
+
+‘flycheck-scss-compass’
+ Whether to enable the Compass CSS framework in SCSS, via
+ ‘--compass’.
+‘flycheck-scss-lintrc’
+ Configuration file for SCSS-Lint. *Note Syntax checker
+ configuration files::, for more information about configuration
+ files.
+
+Shell scripting languages
+=========================
+
+ 1. Syntax check with one of the following checkers, depending on the
+ shell used for the current Sh Mode buffer,
+ • ‘sh-bash’ (for Bash (http://www.gnu.org/software/bash/))
+ • ‘sh-posix-dash’ or ‘sh-posix-bash’ (for POSIX shell scripts,
+ using Dash (http://gondor.apana.org.au/~herbert/dash/) or Bash
+ (http://www.gnu.org/software/bash/) respectively)
+ • ‘sh-zsh’ (for Zsh (http://www.zsh.org/))
+ 2. ‘sh-shellcheck’ (code and style check using ShellCheck
+ (https://github.com/koalaman/shellcheck/))
+
+ ‘sh-shellcheck’ provides the following option:
+
+‘flycheck-shellcheck-excluded-warnings’
+ A list of excluded warnings for ShellCheck.
+
+Slim
+====
+
+ • ‘slim’ (using Slim (http://slim-lang.com/))
+
+SQL
+===
+
+ • ‘sql-sqlint’ (using Sqlint (https://github.com/purcell/sqlint))
+
+TeX/LaTeX
+=========
+
+ • ‘tex-chktex’ (style check using ChkTeX
+ (http://www.nongnu.org/chktex/)), or
+ • ‘tex-lacheck’ (style check using Lacheck
+ (http://www.ctan.org/pkg/lacheck))
+
+ ‘tex-chktex’ provides the following option:
+
+‘flycheck-chktexrc’
+ Configuration file for ChkTeX. *Note Syntax checker configuration
+ files::, for more information about configuration files.
+
+Texinfo
+=======
+
+ • ‘texinfo’ (using makeinfo (http://www.gnu.org/software/texinfo/))
+
+Verilog
+=======
+
+ • ‘verilog-verilator’ (using Verilator
+ (http://www.veripool.org/wiki/verilator))
+
+ ‘verilog-verilator’ provides the following options:
+
+‘flycheck-verilator-include-path’
+ A list of include directories for Verilator. Relative paths are
+ relative to the file being checked.
+
+XML
+===
+
+ • ‘xml-xmlstarlet’ (using XMLStarlet
+ (http://xmlstar.sourceforge.net)), or
+ • ‘xml-xmllint’ (using xmllint (http://www.xmlsoft.org/))
+
+YAML
+====
+
+ • ‘yaml-jsyaml’ (using js-yaml (https://github.com/nodeca/js-yaml)),
+ or
+ • ‘yaml-ruby’ (using Ruby’s YAML parser)
+
+\1f
+File: flycheck.info, Node: Getting Help, Next: GNU Free Documentation License, Prev: Supported languages, Up: Top
+
+Appendix B Getting Help
+***********************
+
+B.1 Asking questions
+====================
+
+Please ask questions about Flycheck on Stack Exchange
+(https://emacs.stackexchange.com/questions/tagged/flycheck) or in our
+Gitter channel (https://gitter.im/flycheck/flycheck). We try to answer
+all questions as fast and as precise as possible.
+
+B.2 Reporting issues
+====================
+
+To report problems or bugs, please use our issue tracker
+(https://github.com/flycheck/flycheck/issues). Our Contribution
+Guidelines
+(https://github.com/flycheck/flycheck/blob/master/CONTRIBUTING.md) help
+you to create good bug reports; please take a look.
+
+ We welcome patches and pull requests that fix bugs or provide new
+features. Please read our Contribution Guidelines for help and
+guidelines before submitting pull requests. When making larger changes
+to Flycheck or implementing new features we recommend that you first
+open a separate issue or ask in our Gitter channel to discuss you
+intended changes.
+
+B.3 Conduct
+===========
+
+Please follow our Code of Conduct (http://www.flycheck.org/conduct.html)
+in all our communication channels.
+
+\1f
+File: flycheck.info, Node: GNU Free Documentation License, Next: Main Index, Prev: Getting Help, Up: Top
+
+Appendix C GNU Free Documentation License
+*****************************************
+
+ Version 1.3, 3 November 2008
+
+ Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+ <http://fsf.org/>
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ 0. PREAMBLE
+
+ The purpose of this License is to make a manual, textbook, or other
+ functional and useful document "free" in the sense of freedom: to
+ assure everyone the effective freedom to copy and redistribute it,
+ with or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the
+ author and publisher a way to get credit for their work, while not
+ being considered responsible for modifications made by others.
+
+ This License is a kind of “copyleft”, which means that derivative
+ works of the document must themselves be free in the same sense.
+ It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
+
+ We have designed this License in order to use it for manuals for
+ free software, because free software needs free documentation: a
+ free program should come with manuals providing the same freedoms
+ that the software does. But this License is not limited to
+ software manuals; it can be used for any textual work, regardless
+ of subject matter or whether it is published as a printed book. We
+ recommend this License principally for works whose purpose is
+ instruction or reference.
+
+ 1. APPLICABILITY AND DEFINITIONS
+
+ This License applies to any manual or other work, in any medium,
+ that contains a notice placed by the copyright holder saying it can
+ be distributed under the terms of this License. Such a notice
+ grants a world-wide, royalty-free license, unlimited in duration,
+ to use that work under the conditions stated herein. The
+ “Document”, below, refers to any such manual or work. Any member
+ of the public is a licensee, and is addressed as “you”. You accept
+ the license if you copy, modify or distribute the work in a way
+ requiring permission under copyright law.
+
+ A “Modified Version” of the Document means any work containing the
+ Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+
+ A “Secondary Section” is a named appendix or a front-matter section
+ of the Document that deals exclusively with the relationship of the
+ publishers or authors of the Document to the Document’s overall
+ subject (or to related matters) and contains nothing that could
+ fall directly within that overall subject. (Thus, if the Document
+ is in part a textbook of mathematics, a Secondary Section may not
+ explain any mathematics.) The relationship could be a matter of
+ historical connection with the subject or with related matters, or
+ of legal, commercial, philosophical, ethical or political position
+ regarding them.
+
+ The “Invariant Sections” are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in the
+ notice that says that the Document is released under this License.
+ If a section does not fit the above definition of Secondary then it
+ is not allowed to be designated as Invariant. The Document may
+ contain zero Invariant Sections. If the Document does not identify
+ any Invariant Sections then there are none.
+
+ The “Cover Texts” are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice
+ that says that the Document is released under this License. A
+ Front-Cover Text may be at most 5 words, and a Back-Cover Text may
+ be at most 25 words.
+
+ A “Transparent” copy of the Document means a machine-readable copy,
+ represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images composed
+ of pixels) generic paint programs or (for drawings) some widely
+ available drawing editor, and that is suitable for input to text
+ formatters or for automatic translation to a variety of formats
+ suitable for input to text formatters. A copy made in an otherwise
+ Transparent file format whose markup, or absence of markup, has
+ been arranged to thwart or discourage subsequent modification by
+ readers is not Transparent. An image format is not Transparent if
+ used for any substantial amount of text. A copy that is not
+ “Transparent” is called “Opaque”.
+
+ Examples of suitable formats for Transparent copies include plain
+ ASCII without markup, Texinfo input format, LaTeX input format,
+ SGML or XML using a publicly available DTD, and standard-conforming
+ simple HTML, PostScript or PDF designed for human modification.
+ Examples of transparent image formats include PNG, XCF and JPG.
+ Opaque formats include proprietary formats that can be read and
+ edited only by proprietary word processors, SGML or XML for which
+ the DTD and/or processing tools are not generally available, and
+ the machine-generated HTML, PostScript or PDF produced by some word
+ processors for output purposes only.
+
+ The “Title Page” means, for a printed book, the title page itself,
+ plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For
+ works in formats which do not have any title page as such, “Title
+ Page” means the text near the most prominent appearance of the
+ work’s title, preceding the beginning of the body of the text.
+
+ The “publisher” means any person or entity that distributes copies
+ of the Document to the public.
+
+ A section “Entitled XYZ” means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ
+ stands for a specific section name mentioned below, such as
+ “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.)
+ To “Preserve the Title” of such a section when you modify the
+ Document means that it remains a section “Entitled XYZ” according
+ to this definition.
+
+ The Document may include Warranty Disclaimers next to the notice
+ which states that this License applies to the Document. These
+ Warranty Disclaimers are considered to be included by reference in
+ this License, but only as regards disclaiming warranties: any other
+ implication that these Warranty Disclaimers may have is void and
+ has no effect on the meaning of this License.
+
+ 2. VERBATIM COPYING
+
+ You may copy and distribute the Document in any medium, either
+ commercially or noncommercially, provided that this License, the
+ copyright notices, and the license notice saying this License
+ applies to the Document are reproduced in all copies, and that you
+ add no other conditions whatsoever to those of this License. You
+ may not use technical measures to obstruct or control the reading
+ or further copying of the copies you make or distribute. However,
+ you may accept compensation in exchange for copies. If you
+ distribute a large enough number of copies you must also follow the
+ conditions in section 3.
+
+ You may also lend copies, under the same conditions stated above,
+ and you may publicly display copies.
+
+ 3. COPYING IN QUANTITY
+
+ If you publish printed copies (or copies in media that commonly
+ have printed covers) of the Document, numbering more than 100, and
+ the Document’s license notice requires Cover Texts, you must
+ enclose the copies in covers that carry, clearly and legibly, all
+ these Cover Texts: Front-Cover Texts on the front cover, and
+ Back-Cover Texts on the back cover. Both covers must also clearly
+ and legibly identify you as the publisher of these copies. The
+ front cover must present the full title with all words of the title
+ equally prominent and visible. You may add other material on the
+ covers in addition. Copying with changes limited to the covers, as
+ long as they preserve the title of the Document and satisfy these
+ conditions, can be treated as verbatim copying in other respects.
+
+ If the required texts for either cover are too voluminous to fit
+ legibly, you should put the first ones listed (as many as fit
+ reasonably) on the actual cover, and continue the rest onto
+ adjacent pages.
+
+ If you publish or distribute Opaque copies of the Document
+ numbering more than 100, you must either include a machine-readable
+ Transparent copy along with each Opaque copy, or state in or with
+ each Opaque copy a computer-network location from which the general
+ network-using public has access to download using public-standard
+ network protocols a complete Transparent copy of the Document, free
+ of added material. If you use the latter option, you must take
+ reasonably prudent steps, when you begin distribution of Opaque
+ copies in quantity, to ensure that this Transparent copy will
+ remain thus accessible at the stated location until at least one
+ year after the last time you distribute an Opaque copy (directly or
+ through your agents or retailers) of that edition to the public.
+
+ It is requested, but not required, that you contact the authors of
+ the Document well before redistributing any large number of copies,
+ to give them a chance to provide you with an updated version of the
+ Document.
+
+ 4. MODIFICATIONS
+
+ You may copy and distribute a Modified Version of the Document
+ under the conditions of sections 2 and 3 above, provided that you
+ release the Modified Version under precisely this License, with the
+ Modified Version filling the role of the Document, thus licensing
+ distribution and modification of the Modified Version to whoever
+ possesses a copy of it. In addition, you must do these things in
+ the Modified Version:
+
+ A. Use in the Title Page (and on the covers, if any) a title
+ distinct from that of the Document, and from those of previous
+ versions (which should, if there were any, be listed in the
+ History section of the Document). You may use the same title
+ as a previous version if the original publisher of that
+ version gives permission.
+
+ B. List on the Title Page, as authors, one or more persons or
+ entities responsible for authorship of the modifications in
+ the Modified Version, together with at least five of the
+ principal authors of the Document (all of its principal
+ authors, if it has fewer than five), unless they release you
+ from this requirement.
+
+ C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+
+ D. Preserve all the copyright notices of the Document.
+
+ E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+
+ F. Include, immediately after the copyright notices, a license
+ notice giving the public permission to use the Modified
+ Version under the terms of this License, in the form shown in
+ the Addendum below.
+
+ G. Preserve in that license notice the full lists of Invariant
+ Sections and required Cover Texts given in the Document’s
+ license notice.
+
+ H. Include an unaltered copy of this License.
+
+ I. Preserve the section Entitled “History”, Preserve its Title,
+ and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on the
+ Title Page. If there is no section Entitled “History” in the
+ Document, create one stating the title, year, authors, and
+ publisher of the Document as given on its Title Page, then add
+ an item describing the Modified Version as stated in the
+ previous sentence.
+
+ J. Preserve the network location, if any, given in the Document
+ for public access to a Transparent copy of the Document, and
+ likewise the network locations given in the Document for
+ previous versions it was based on. These may be placed in the
+ “History” section. You may omit a network location for a work
+ that was published at least four years before the Document
+ itself, or if the original publisher of the version it refers
+ to gives permission.
+
+ K. For any section Entitled “Acknowledgements” or “Dedications”,
+ Preserve the Title of the section, and preserve in the section
+ all the substance and tone of each of the contributor
+ acknowledgements and/or dedications given therein.
+
+ L. Preserve all the Invariant Sections of the Document, unaltered
+ in their text and in their titles. Section numbers or the
+ equivalent are not considered part of the section titles.
+
+ M. Delete any section Entitled “Endorsements”. Such a section
+ may not be included in the Modified Version.
+
+ N. Do not retitle any existing section to be Entitled
+ “Endorsements” or to conflict in title with any Invariant
+ Section.
+
+ O. Preserve any Warranty Disclaimers.
+
+ If the Modified Version includes new front-matter sections or
+ appendices that qualify as Secondary Sections and contain no
+ material copied from the Document, you may at your option designate
+ some or all of these sections as invariant. To do this, add their
+ titles to the list of Invariant Sections in the Modified Version’s
+ license notice. These titles must be distinct from any other
+ section titles.
+
+ You may add a section Entitled “Endorsements”, provided it contains
+ nothing but endorsements of your Modified Version by various
+ parties—for example, statements of peer review or that the text has
+ been approved by an organization as the authoritative definition of
+ a standard.
+
+ You may add a passage of up to five words as a Front-Cover Text,
+ and a passage of up to 25 words as a Back-Cover Text, to the end of
+ the list of Cover Texts in the Modified Version. Only one passage
+ of Front-Cover Text and one of Back-Cover Text may be added by (or
+ through arrangements made by) any one entity. If the Document
+ already includes a cover text for the same cover, previously added
+ by you or by arrangement made by the same entity you are acting on
+ behalf of, you may not add another; but you may replace the old
+ one, on explicit permission from the previous publisher that added
+ the old one.
+
+ The author(s) and publisher(s) of the Document do not by this
+ License give permission to use their names for publicity for or to
+ assert or imply endorsement of any Modified Version.
+
+ 5. COMBINING DOCUMENTS
+
+ You may combine the Document with other documents released under
+ this License, under the terms defined in section 4 above for
+ modified versions, provided that you include in the combination all
+ of the Invariant Sections of all of the original documents,
+ unmodified, and list them all as Invariant Sections of your
+ combined work in its license notice, and that you preserve all
+ their Warranty Disclaimers.
+
+ The combined work need only contain one copy of this License, and
+ multiple identical Invariant Sections may be replaced with a single
+ copy. If there are multiple Invariant Sections with the same name
+ but different contents, make the title of each such section unique
+ by adding at the end of it, in parentheses, the name of the
+ original author or publisher of that section if known, or else a
+ unique number. Make the same adjustment to the section titles in
+ the list of Invariant Sections in the license notice of the
+ combined work.
+
+ In the combination, you must combine any sections Entitled
+ “History” in the various original documents, forming one section
+ Entitled “History”; likewise combine any sections Entitled
+ “Acknowledgements”, and any sections Entitled “Dedications”. You
+ must delete all sections Entitled “Endorsements.”
+
+ 6. COLLECTIONS OF DOCUMENTS
+
+ You may make a collection consisting of the Document and other
+ documents released under this License, and replace the individual
+ copies of this License in the various documents with a single copy
+ that is included in the collection, provided that you follow the
+ rules of this License for verbatim copying of each of the documents
+ in all other respects.
+
+ You may extract a single document from such a collection, and
+ distribute it individually under this License, provided you insert
+ a copy of this License into the extracted document, and follow this
+ License in all other respects regarding verbatim copying of that
+ document.
+
+ 7. AGGREGATION WITH INDEPENDENT WORKS
+
+ A compilation of the Document or its derivatives with other
+ separate and independent documents or works, in or on a volume of a
+ storage or distribution medium, is called an “aggregate” if the
+ copyright resulting from the compilation is not used to limit the
+ legal rights of the compilation’s users beyond what the individual
+ works permit. When the Document is included in an aggregate, this
+ License does not apply to the other works in the aggregate which
+ are not themselves derivative works of the Document.
+
+ If the Cover Text requirement of section 3 is applicable to these
+ copies of the Document, then if the Document is less than one half
+ of the entire aggregate, the Document’s Cover Texts may be placed
+ on covers that bracket the Document within the aggregate, or the
+ electronic equivalent of covers if the Document is in electronic
+ form. Otherwise they must appear on printed covers that bracket
+ the whole aggregate.
+
+ 8. TRANSLATION
+
+ Translation is considered a kind of modification, so you may
+ distribute translations of the Document under the terms of section
+ 4. Replacing Invariant Sections with translations requires special
+ permission from their copyright holders, but you may include
+ translations of some or all Invariant Sections in addition to the
+ original versions of these Invariant Sections. You may include a
+ translation of this License, and all the license notices in the
+ Document, and any Warranty Disclaimers, provided that you also
+ include the original English version of this License and the
+ original versions of those notices and disclaimers. In case of a
+ disagreement between the translation and the original version of
+ this License or a notice or disclaimer, the original version will
+ prevail.
+
+ If a section in the Document is Entitled “Acknowledgements”,
+ “Dedications”, or “History”, the requirement (section 4) to
+ Preserve its Title (section 1) will typically require changing the
+ actual title.
+
+ 9. TERMINATION
+
+ You may not copy, modify, sublicense, or distribute the Document
+ except as expressly provided under this License. Any attempt
+ otherwise to copy, modify, sublicense, or distribute it is void,
+ and will automatically terminate your rights under this License.
+
+ However, if you cease all violation of this License, then your
+ license from a particular copyright holder is reinstated (a)
+ provisionally, unless and until the copyright holder explicitly and
+ finally terminates your license, and (b) permanently, if the
+ copyright holder fails to notify you of the violation by some
+ reasonable means prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+ reinstated permanently if the copyright holder notifies you of the
+ violation by some reasonable means, this is the first time you have
+ received notice of violation of this License (for any work) from
+ that copyright holder, and you cure the violation prior to 30 days
+ after your receipt of the notice.
+
+ Termination of your rights under this section does not terminate
+ the licenses of parties who have received copies or rights from you
+ under this License. If your rights have been terminated and not
+ permanently reinstated, receipt of a copy of some or all of the
+ same material does not give you any rights to use it.
+
+ 10. FUTURE REVISIONS OF THIS LICENSE
+
+ The Free Software Foundation may publish new, revised versions of
+ the GNU Free Documentation License from time to time. Such new
+ versions will be similar in spirit to the present version, but may
+ differ in detail to address new problems or concerns. See
+ <http://www.gnu.org/copyleft/>.
+
+ Each version of the License is given a distinguishing version
+ number. If the Document specifies that a particular numbered
+ version of this License “or any later version” applies to it, you
+ have the option of following the terms and conditions either of
+ that specified version or of any later version that has been
+ published (not as a draft) by the Free Software Foundation. If the
+ Document does not specify a version number of this License, you may
+ choose any version ever published (not as a draft) by the Free
+ Software Foundation. If the Document specifies that a proxy can
+ decide which future versions of this License can be used, that
+ proxy’s public statement of acceptance of a version permanently
+ authorizes you to choose that version for the Document.
+
+ 11. RELICENSING
+
+ “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
+ World Wide Web server that publishes copyrightable works and also
+ provides prominent facilities for anybody to edit those works. A
+ public wiki that anybody can edit is an example of such a server.
+ A “Massive Multiauthor Collaboration” (or “MMC”) contained in the
+ site means any set of copyrightable works thus published on the MMC
+ site.
+
+ “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
+ license published by Creative Commons Corporation, a not-for-profit
+ corporation with a principal place of business in San Francisco,
+ California, as well as future copyleft versions of that license
+ published by that same organization.
+
+ “Incorporate” means to publish or republish a Document, in whole or
+ in part, as part of another Document.
+
+ An MMC is “eligible for relicensing” if it is licensed under this
+ License, and if all works that were first published under this
+ License somewhere other than this MMC, and subsequently
+ incorporated in whole or in part into the MMC, (1) had no cover
+ texts or invariant sections, and (2) were thus incorporated prior
+ to November 1, 2008.
+
+ The operator of an MMC Site may republish an MMC contained in the
+ site under CC-BY-SA on the same site at any time before August 1,
+ 2009, provided the MMC is eligible for relicensing.
+
+ADDENDUM: How to use this License for your documents
+====================================================
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and license
+notices just after the title page:
+
+ Copyright (C) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.3
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover
+Texts, replace the “with…Texts.” line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with
+ the Front-Cover Texts being LIST, and with the Back-Cover Texts
+ being LIST.
+
+ If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+ If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of free
+software license, such as the GNU General Public License, to permit
+their use in free software.
+
+\1f
+File: flycheck.info, Node: Main Index, Next: Key Index, Prev: GNU Free Documentation License, Up: Top
+
+Main Index
+**********
+
+\0\b[index\0\b]
+* Menu:
+
+* Ada language: Supported languages. (line 71)
+* AsciiDoc language: Supported languages. (line 88)
+* automatic syntax checker selection: Syntax checkers. (line 6)
+* C/C++ language: Supported languages. (line 93)
+* CFEngine language: Supported languages. (line 161)
+* chaining of syntax checkers: Syntax checkers. (line 15)
+* Chef language: Supported languages. (line 166)
+* Coffeescript language: Supported languages. (line 175)
+* configuration files of syntax checkers: Configuring checkers.
+ (line 43)
+* Coq language: Supported languages. (line 187)
+* CSS language: Supported languages. (line 192)
+* D language: Supported languages. (line 198)
+* Emacs Lisp language: Supported languages. (line 212)
+* Erlang language: Supported languages. (line 240)
+* error display function: Displaying errors. (line 28)
+* error tooltip: Displaying errors. (line 42)
+* ERuby language: Supported languages. (line 251)
+* executables of syntax checkers: Configuring checkers.
+ (line 110)
+* features: Introduction. (line 16)
+* flycheck mode: Checking buffers. (line 6)
+* Fortran language: Supported languages. (line 256)
+* functions for error display: Displaying errors. (line 28)
+* Go language: Supported languages. (line 282)
+* Groovy language: Supported languages. (line 307)
+* Haml language: Supported languages. (line 313)
+* Handlebars language: Supported languages. (line 318)
+* Haskell language: Supported languages. (line 323)
+* HTML language: Supported languages. (line 379)
+* installation: Installation. (line 37)
+* Jade language: Supported languages. (line 390)
+* Javascript language: Supported languages. (line 395)
+* JSON language: Supported languages. (line 427)
+* Language, Ada: Supported languages. (line 71)
+* Language, AsciiDoc: Supported languages. (line 88)
+* Language, C/C++: Supported languages. (line 93)
+* Language, CFEngine: Supported languages. (line 161)
+* Language, Chef: Supported languages. (line 166)
+* Language, Coffeescript: Supported languages. (line 175)
+* Language, Coq: Supported languages. (line 187)
+* Language, CSS: Supported languages. (line 192)
+* Language, D: Supported languages. (line 198)
+* Language, Emacs Lisp: Supported languages. (line 212)
+* Language, Erlang: Supported languages. (line 240)
+* Language, ERuby: Supported languages. (line 251)
+* Language, Fortran: Supported languages. (line 256)
+* Language, Go: Supported languages. (line 282)
+* Language, Groovy: Supported languages. (line 307)
+* Language, Haml: Supported languages. (line 313)
+* Language, Handlebars: Supported languages. (line 318)
+* Language, Haskell: Supported languages. (line 323)
+* Language, HTML: Supported languages. (line 379)
+* Language, Jade: Supported languages. (line 390)
+* Language, Javascript: Supported languages. (line 395)
+* Language, JSON: Supported languages. (line 427)
+* Language, Less: Supported languages. (line 434)
+* Language, Lua: Supported languages. (line 439)
+* Language, Perl: Supported languages. (line 452)
+* Language, PHP: Supported languages. (line 473)
+* Language, Processing: Supported languages. (line 493)
+* Language, Puppet: Supported languages. (line 499)
+* Language, Python: Supported languages. (line 514)
+* Language, R: Supported languages. (line 555)
+* Language, reStructuredText: Supported languages. (line 574)
+* Language, RPM Spec: Supported languages. (line 569)
+* Language, Ruby: Supported languages. (line 587)
+* Language, Rust: Supported languages. (line 615)
+* Language, Sass: Supported languages. (line 646)
+* Language, Scala: Supported languages. (line 656)
+* Language, SCSS: Supported languages. (line 674)
+* Language, Shell scripting languages: Supported languages. (line 691)
+* Language, Slim: Supported languages. (line 709)
+* Language, SQL: Supported languages. (line 714)
+* Language, TeX/LaTeX: Supported languages. (line 719)
+* Language, Texinfo: Supported languages. (line 733)
+* Language, Verilog: Supported languages. (line 738)
+* Language, XML: Supported languages. (line 750)
+* Language, YAML: Supported languages. (line 757)
+* Less language: Supported languages. (line 434)
+* Lua language: Supported languages. (line 439)
+* manual syntax checker selection: Syntax checkers. (line 39)
+* operating system: Installation. (line 9)
+* options of syntax checkers: Configuring checkers.
+ (line 20)
+* Perl language: Supported languages. (line 452)
+* PHP language: Supported languages. (line 473)
+* prerequisites: Installation. (line 9)
+* Processing language: Supported languages. (line 493)
+* Puppet language: Supported languages. (line 499)
+* Python language: Supported languages. (line 514)
+* R language: Supported languages. (line 555)
+* reStructuredText language: Supported languages. (line 574)
+* RPM Spec language: Supported languages. (line 569)
+* Ruby language: Supported languages. (line 587)
+* Rust language: Supported languages. (line 615)
+* Sass language: Supported languages. (line 646)
+* Scala language: Supported languages. (line 656)
+* SCSS language: Supported languages. (line 674)
+* Shell scripting languages language: Supported languages. (line 691)
+* Slim language: Supported languages. (line 709)
+* SQL language: Supported languages. (line 714)
+* syntax checker: Syntax checkers. (line 6)
+* syntax checker configuration files: Configuring checkers.
+ (line 43)
+* syntax checker executables: Configuring checkers.
+ (line 110)
+* syntax checker options: Configuring checkers.
+ (line 20)
+* syntax checker selection, automatic: Syntax checkers. (line 6)
+* syntax checker selection, manual: Syntax checkers. (line 39)
+* TeX/LaTeX language: Supported languages. (line 719)
+* Texinfo language: Supported languages. (line 733)
+* Verilog language: Supported languages. (line 738)
+* Windows: Installation. (line 15)
+* XML language: Supported languages. (line 750)
+* YAML language: Supported languages. (line 757)
+
+\1f
+File: flycheck.info, Node: Key Index, Next: Function and Variable Index, Prev: Main Index, Up: Top
+
+Key Index
+*********
+
+\0\b[index\0\b]
+* Menu:
+
+* C-c ! ?: Syntax checkers. (line 31)
+* C-c ! c: Checking buffers. (line 57)
+* C-c ! C-c: Finding error patterns.
+ (line 16)
+* C-c ! C-w: Killing errors. (line 8)
+* C-c ! e: Configuring checkers.
+ (line 125)
+* C-c ! h: Displaying errors. (line 15)
+* C-c ! l: Listing errors. (line 9)
+* C-c ! n: Navigating errors. (line 22)
+* C-c ! p: Navigating errors. (line 32)
+* C-c ! s: Syntax checkers. (line 43)
+* C-c ! v: Checking buffers. (line 63)
+* C-c ! x: Syntax checkers. (line 85)
+* C-h .: Displaying errors. (line 42)
+* C-u C-c ! C-w: Killing errors. (line 16)
+* C-u C-c ! e: Configuring checkers.
+ (line 130)
+* C-u C-c ! s: Syntax checkers. (line 48)
+* C-u C-c ! x: Syntax checkers. (line 89)
+* M-0 C-c ! C-w: Killing errors. (line 20)
+
+\1f
+File: flycheck.info, Node: Function and Variable Index, Prev: Key Index, Up: Top
+
+Function and variable index
+***************************
+
+\0\b[index\0\b]
+* Menu:
+
+* display-local-help: Displaying errors. (line 42)
+* flycheck-buffer: Checking buffers. (line 57)
+* flycheck-check-syntax-automatically: Checking buffers. (line 33)
+* flycheck-checker: Syntax checkers. (line 58)
+* flycheck-checker-error-threshold: Reporting results. (line 52)
+* flycheck-checkers: Syntax checkers. (line 10)
+* flycheck-chktexrc: Supported languages. (line 727)
+* flycheck-clang-args: Supported languages. (line 102)
+* flycheck-clang-blocks: Supported languages. (line 105)
+* flycheck-clang-definitions: Supported languages. (line 107)
+* flycheck-clang-include-path: Supported languages. (line 110)
+* flycheck-clang-includes: Supported languages. (line 114)
+* flycheck-clang-language-standard: Supported languages. (line 118)
+* flycheck-clang-ms-extensions: Supported languages. (line 122)
+* flycheck-clang-no-exceptions: Supported languages. (line 124)
+* flycheck-clang-no-rtti: Supported languages. (line 127)
+* flycheck-clang-pedantic: Supported languages. (line 134)
+* flycheck-clang-pedantic-errors: Supported languages. (line 137)
+* flycheck-clang-standard-library: Supported languages. (line 130)
+* flycheck-clang-warnings: Supported languages. (line 140)
+* flycheck-clear: Reporting results. (line 57)
+* flycheck-coffeelintrc: Supported languages. (line 180)
+* flycheck-compile: Finding error patterns.
+ (line 16)
+* flycheck-copy-errors-as-kill: Killing errors. (line 8)
+* flycheck-cppcheck-checks: Supported languages. (line 147)
+* flycheck-cppcheck-include-path: Supported languages. (line 153)
+* flycheck-cppcheck-inconclusive: Supported languages. (line 150)
+* flycheck-cppcheck-language-standard: Supported languages. (line 156)
+* flycheck-describe-checker: Syntax checkers. (line 31)
+* flycheck-disable-checker: Syntax checkers. (line 85)
+* flycheck-disabled-checkers: Syntax checkers. (line 102)
+* flycheck-display-error-at-point: Displaying errors. (line 15)
+* flycheck-display-error-messages: Displaying errors. (line 30)
+* flycheck-display-error-messages-unless-error-list: Displaying errors.
+ (line 33)
+* flycheck-display-errors-delay: Displaying errors. (line 9)
+* flycheck-display-errors-function: Displaying errors. (line 23)
+* flycheck-dmd-args: Supported languages. (line 203)
+* flycheck-dmd-include-path: Supported languages. (line 201)
+* flycheck-emacs-lisp-initialize-packages: Supported languages.
+ (line 228)
+* flycheck-emacs-lisp-load-path: Supported languages. (line 223)
+* flycheck-emacs-lisp-package-user-dir: Supported languages. (line 234)
+* flycheck-erlang-include-path: Supported languages. (line 243)
+* flycheck-erlang-library-path: Supported languages. (line 246)
+* flycheck-error: Reporting results. (line 34)
+* flycheck-error-list-after-refresh-hook: Listing errors. (line 14)
+* flycheck-error-list-highlight: Listing errors. (line 57)
+* flycheck-error-list-minimum-level: Listing errors. (line 50)
+* flycheck-eslint-rulesdir: Supported languages. (line 407)
+* flycheck-eslintrc: Supported languages. (line 411)
+* flycheck-first-error: Navigating errors. (line 42)
+* flycheck-flake8-error-level-alist: Supported languages. (line 529)
+* flycheck-flake8-maximum-complexity: Supported languages. (line 532)
+* flycheck-flake8-maximum-line-length: Supported languages. (line 535)
+* flycheck-flake8rc: Supported languages. (line 538)
+* flycheck-foodcritic-tags: Supported languages. (line 170)
+* flycheck-gcc-args: Supported languages. (line 103)
+* flycheck-gcc-definitions: Supported languages. (line 108)
+* flycheck-gcc-include-path: Supported languages. (line 111)
+* flycheck-gcc-includes: Supported languages. (line 115)
+* flycheck-gcc-language-standard: Supported languages. (line 119)
+* flycheck-gcc-no-exceptions: Supported languages. (line 125)
+* flycheck-gcc-no-rtti: Supported languages. (line 128)
+* flycheck-gcc-openmp: Supported languages. (line 132)
+* flycheck-gcc-pedantic: Supported languages. (line 135)
+* flycheck-gcc-pedantic-errors: Supported languages. (line 138)
+* flycheck-gcc-warnings: Supported languages. (line 141)
+* flycheck-gfortran-args: Supported languages. (line 261)
+* flycheck-gfortran-include-path: Supported languages. (line 264)
+* flycheck-gfortran-language-standard: Supported languages. (line 268)
+* flycheck-gfortran-layout: Supported languages. (line 272)
+* flycheck-gfortran-warnings: Supported languages. (line 277)
+* flycheck-ghc-args: Supported languages. (line 360)
+* flycheck-ghc-language-extensions: Supported languages. (line 374)
+* flycheck-ghc-no-user-package-database: Supported languages. (line 363)
+* flycheck-ghc-package-databases: Supported languages. (line 366)
+* flycheck-ghc-search-path: Supported languages. (line 371)
+* flycheck-gjslintrc: Supported languages. (line 417)
+* flycheck-global-modes: Checking buffers. (line 6)
+* flycheck-gnat-args: Supported languages. (line 75)
+* flycheck-gnat-include-path: Supported languages. (line 77)
+* flycheck-gnat-language-standard: Supported languages. (line 80)
+* flycheck-gnat-warnings: Supported languages. (line 82)
+* flycheck-go-build-install-deps: Supported languages. (line 295)
+* flycheck-go-build-tags: Supported languages. (line 298)
+* flycheck-go-vet-print-functions: Supported languages. (line 301)
+* flycheck-help-echo-function: Displaying errors. (line 50)
+* flycheck-highlighting-mode: Reporting results. (line 15)
+* flycheck-hlint-args: Supported languages. (line 333)
+* flycheck-hlint-hint-packages: Supported languages. (line 342)
+* flycheck-hlint-ignore-rules: Supported languages. (line 339)
+* flycheck-hlint-language-extensions: Supported languages. (line 336)
+* flycheck-hlintrc: Supported languages. (line 345)
+* flycheck-idle-change-delay: Checking buffers. (line 40)
+* flycheck-indication-mode: Reporting results. (line 38)
+* flycheck-info: Reporting results. (line 34)
+* flycheck-jscsrc: Supported languages. (line 421)
+* flycheck-jshint-extract-javascript: Supported languages. (line 409)
+* flycheck-jshintrc: Supported languages. (line 414)
+* flycheck-keymap-prefix: Usage. (line 8)
+* flycheck-lintr-caching: Supported languages. (line 559)
+* flycheck-lintr-linters: Supported languages. (line 563)
+* flycheck-list-errors: Listing errors. (line 9)
+* flycheck-locate-config-file-functions: Configuring checkers.
+ (line 84)
+* flycheck-luacheckrc: Supported languages. (line 443)
+* flycheck-mode: Checking buffers. (line 6)
+* flycheck-navigation-minimum-level: Navigating errors. (line 55)
+* flycheck-next-error: Navigating errors. (line 22)
+* flycheck-perl-include-path: Supported languages. (line 460)
+* flycheck-perlcritic-severity: Supported languages. (line 467)
+* flycheck-perlcriticrc: Supported languages. (line 463)
+* flycheck-phpcs-standard: Supported languages. (line 487)
+* flycheck-phpmd-rulesets: Supported languages. (line 482)
+* flycheck-previous-error: Navigating errors. (line 32)
+* flycheck-puppet-lint-disabled-checks: Supported languages. (line 509)
+* flycheck-puppet-lint-rc: Supported languages. (line 505)
+* flycheck-pylint-use-symbolic-id: Supported languages. (line 544)
+* flycheck-pylintrc: Supported languages. (line 549)
+* flycheck-rubocop-lint-only: Supported languages. (line 595)
+* flycheck-rubocoprc: Supported languages. (line 598)
+* flycheck-rubylintrc: Supported languages. (line 601)
+* flycheck-rust-args: Supported languages. (line 622)
+* flycheck-rust-check-tests: Supported languages. (line 625)
+* flycheck-rust-crate-root: Supported languages. (line 628)
+* flycheck-rust-crate-type: Supported languages. (line 633)
+* flycheck-rust-library-path: Supported languages. (line 636)
+* flycheck-sass-compass: Supported languages. (line 650)
+* flycheck-scalastylerc: Supported languages. (line 664)
+* flycheck-scss-compass: Supported languages. (line 681)
+* flycheck-scss-lintrc: Supported languages. (line 684)
+* flycheck-select-checker: Syntax checkers. (line 43)
+* flycheck-set-checker-executable: Configuring checkers.
+ (line 125)
+* flycheck-shellcheck-excluded-warnings: Supported languages. (line 704)
+* flycheck-sphinx-warn-on-missing-references: Supported languages.
+ (line 582)
+* flycheck-standard-error-navigation: Navigating errors. (line 6)
+* flycheck-temp-prefix: Checking buffers. (line 71)
+* flycheck-tidyrc: Supported languages. (line 383)
+* flycheck-verify-setup: Checking buffers. (line 63)
+* flycheck-verilator-include-path: Supported languages. (line 744)
+* flycheck-warning: Reporting results. (line 34)
+* global-flycheck-mode: Checking buffers. (line 6)
+* list-flycheck-errors: Listing errors. (line 9)
+
+
+\1f
+Tag Table:
+Node: Top\7f1135
+Node: Introduction\7f3355
+Node: Installation\7f4448
+Ref: windows-support\7f4850
+Node: Quickstart\7f6486
+Node: Usage\7f9022
+Node: Checking buffers\7f10022
+Node: Syntax checkers\7f12846
+Node: Reporting results\7f18128
+Node: Navigating errors\7f20533
+Node: Displaying errors\7f23089
+Node: Killing errors\7f25273
+Node: Listing errors\7f26060
+Node: Mode line display\7f28230
+Node: Configuring checkers\7f29543
+Ref: Syntax checker options\7f30259
+Ref: Syntax checker configuration files\7f31277
+Ref: Syntax checker executables\7f34164
+Node: Syntax checker definitions\7f35368
+Node: Defining syntax checkers\7f36549
+Node: Finding error patterns\7f41965
+Node: Trying new checkers\7f44142
+Node: Registering new checkers\7f44827
+Node: Parsing structured output\7f46440
+Node: Passing configuration to checkers\7f47683
+Node: Controlling use of checkers\7f51315
+Node: Applying multiple checkers\7f52417
+Node: Flycheck hooks\7f55688
+Node: Flycheck API\7f57744
+Node: Command syntax checkers\7f58082
+Node: Argument Substitution\7f58452
+Node: Checker configuration\7f58622
+Node: Error parsers\7f58834
+Node: Errors\7f58980
+Node: Supported languages\7f59092
+Ref: Ada\7f60998
+Ref: AsciiDoc\7f61612
+Ref: C/C++\7f61701
+Ref: CFEngine\7f64413
+Ref: Chef\7f64489
+Ref: Coffeescript\7f64718
+Ref: Coq\7f65136
+Ref: CSS\7f65192
+Ref: D\7f65306
+Ref: Emacs Lisp\7f65733
+Ref: Erlang\7f66869
+Ref: ERuby\7f67125
+Ref: Fortran\7f67216
+Ref: Go\7f68119
+Ref: Groovy\7f69046
+Ref: Haml\7f69160
+Ref: Handlebars\7f69217
+Ref: Haskell\7f69305
+Ref: HTML\7f71239
+Ref: Jade\7f71536
+Ref: Javascript\7f71603
+Ref: JSON\7f72962
+Ref: Less\7f73160
+Ref: Lua\7f73219
+Ref: Perl\7f73575
+Ref: PHP\7f74285
+Ref: Processing\7f74983
+Ref: Puppet\7f75103
+Ref: Python\7f75602
+Ref: R\7f77129
+Ref: RPM Spec\7f77575
+Ref: reStructuredText\7f77673
+Ref: Ruby\7f78091
+Ref: Rust\7f79105
+Ref: Sass\7f80225
+Ref: Scala\7f80476
+Ref: SCSS\7f81044
+Ref: Shell scripting languages\7f81562
+Ref: Slim\7f82340
+Ref: SQL\7f82407
+Ref: TeX/LaTeX\7f82492
+Ref: Texinfo\7f82908
+Ref: Verilog\7f83003
+Ref: XML\7f83326
+Ref: YAML\7f83492
+Node: Getting Help\7f83642
+Ref: Issues\7f84145
+Node: GNU Free Documentation License\7f84896
+Node: Main Index\7f110249
+Node: Key Index\7f118885
+Node: Function and Variable Index\7f120539
+\1f
+End Tag Table
+
+\1f
+Local Variables:
+coding: utf-8
+End:
--- /dev/null
+This is macros.info, produced by makeinfo version 5.2 from macros.texi.
+
+
+\1f
+Tag Table:
+\1f
+End Tag Table
-Modern on-the-fly syntax checking for GNU Emacs.
+On-the-fly syntax checking for GNU Emacs 24.
-Provide `flycheck-mode' which enables on-the-fly syntax checking for a large
-number of different modes and languages (see `flycheck-checkers' for a
-complete list).
+This package provides on-the-fly syntax checking for GNU Emacs 24. It is a
+replacement for the older Flymake extension which is part of GNU Emacs, with
+many improvements and additional features.
-Support for new modes and languages can be added by defining a new syntax
-checker (see `flycheck-define-checker').
+Flycheck provides fully-automatic, fail-safe, on-the-fly background syntax
+checking for over 30 programming and markup languages with more than 70
+different tools. It highlights errors and warnings inline in the buffer, and
+provides 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.
+
+# 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.
+
+# Documentation
+
+Flycheck comes with a rich manual, which you can read in Emacs with `M-x
+flycheck-info' after installing this package. It is also available online at
+URL `http://www.flycheck.org/manual/latest/index.html'.
+
+The manual has a Quickstart section which gives you a short and comprehensive
+introduction into Flycheck's features and usage, and a complete list of all
+supported languages and tools.