From 447d7690f76c423d9bda730c26f95900d73447cc Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sat, 20 Feb 2016 13:55:06 +0100 Subject: [PATCH] update flycheck. --- bba.org | 2 +- .../dir | 0 .../fdl-1.3.info | 0 .../flycheck-autoloads.el | 48 +- .../flycheck-buttercup.el | 99 + .../flycheck-ert.el | 56 +- .../flycheck-pkg.el | 10 +- .../flycheck.el | 2630 +++++++++++------ .../flycheck.info | 1074 ++++--- elpa/flycheck-20160218.41/macros.info | 7 + elpa/flycheck-readme.txt | 40 +- 11 files changed, 2625 insertions(+), 1341 deletions(-) rename elpa/{flycheck-20150703.359 => flycheck-20160218.41}/dir (100%) rename elpa/{flycheck-20150703.359 => flycheck-20160218.41}/fdl-1.3.info (100%) rename elpa/{flycheck-20150703.359 => flycheck-20160218.41}/flycheck-autoloads.el (83%) create mode 100644 elpa/flycheck-20160218.41/flycheck-buttercup.el rename elpa/{flycheck-20150703.359 => flycheck-20160218.41}/flycheck-ert.el (89%) rename elpa/{flycheck-20150703.359 => flycheck-20160218.41}/flycheck-pkg.el (50%) rename elpa/{flycheck-20150703.359 => flycheck-20160218.41}/flycheck.el (76%) rename elpa/{flycheck-20150703.359 => flycheck-20160218.41}/flycheck.info (84%) create mode 100644 elpa/flycheck-20160218.41/macros.info diff --git a/bba.org b/bba.org index 6e698711..201b50f9 100644 --- a/bba.org +++ b/bba.org @@ -494,7 +494,7 @@ log-format. #+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) diff --git a/elpa/flycheck-20150703.359/dir b/elpa/flycheck-20160218.41/dir similarity index 100% rename from elpa/flycheck-20150703.359/dir rename to elpa/flycheck-20160218.41/dir diff --git a/elpa/flycheck-20150703.359/fdl-1.3.info b/elpa/flycheck-20160218.41/fdl-1.3.info similarity index 100% rename from elpa/flycheck-20150703.359/fdl-1.3.info rename to elpa/flycheck-20160218.41/fdl-1.3.info diff --git a/elpa/flycheck-20150703.359/flycheck-autoloads.el b/elpa/flycheck-20160218.41/flycheck-autoloads.el similarity index 83% rename from elpa/flycheck-20150703.359/flycheck-autoloads.el rename to elpa/flycheck-20160218.41/flycheck-autoloads.el index b3a75a6e..d53e3142 100644 --- a/elpa/flycheck-20150703.359/flycheck-autoloads.el +++ b/elpa/flycheck-20160218.41/flycheck-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "flycheck" "flycheck.el" (21910 48941 0 0)) +;;;### (autoloads nil "flycheck" "flycheck.el" (22215 7567 0 0)) ;;; Generated autoloads from flycheck.el (autoload 'flycheck-info "flycheck" "\ @@ -65,6 +65,16 @@ The following PROPERTIES constitute an error level: 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 @@ -72,11 +82,9 @@ The following PROPERTIES constitute an error level: 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. + 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 @@ -97,7 +105,7 @@ The following PROPERTIES constitute an error level: (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 syntax checker to run a command. Define SYMBOL as generic syntax checker via `flycheck-define-generic-checker', which uses an external command @@ -160,11 +168,18 @@ of command checkers is `flycheck-sanitize-errors'. `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, but you should take care to call -`flycheck-verify-command-checker' in a custom `:verify' -function. +`:verify' function, though, whose results will be appended to the +default `:verify' function of command checkers. \(fn SYMBOL DOCSTRING &rest PROPERTIES)" nil nil) @@ -193,15 +208,16 @@ argument to `flycheck-define-checker'. 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'. +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 CHECKER DOCSTRING &rest CUSTOM-ARGS)" nil t) +\(fn SYMBOL INIT-VALUE CHECKERS DOCSTRING &rest CUSTOM-ARGS)" nil t) (put 'flycheck-def-option-var 'lisp-indent-function '3) @@ -209,8 +225,8 @@ Use this together with the `option', `option-list' and ;;;*** -;;;### (autoloads nil nil ("flycheck-ert.el" "flycheck-pkg.el") (21910 -;;;;;; 48941 793934 0)) +;;;### (autoloads nil nil ("flycheck-buttercup.el" "flycheck-ert.el" +;;;;;; "flycheck-pkg.el") (22215 7567 763689 0)) ;;;*** diff --git a/elpa/flycheck-20160218.41/flycheck-buttercup.el b/elpa/flycheck-20160218.41/flycheck-buttercup.el new file mode 100644 index 00000000..24c60ce2 --- /dev/null +++ b/elpa/flycheck-20160218.41/flycheck-buttercup.el @@ -0,0 +1,99 @@ +;;; flycheck-buttercup.el --- Flycheck: Extensions to Buttercup -*- lexical-binding: t; -*- + +;; Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors + +;; Author: Sebastian Wiesner +;; 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 . + +;;; 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) + + +;;; 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")) + + +;;; 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")))))) + + +;;; 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)))) + + +;;; 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 diff --git a/elpa/flycheck-20150703.359/flycheck-ert.el b/elpa/flycheck-20160218.41/flycheck-ert.el similarity index 89% rename from elpa/flycheck-20150703.359/flycheck-ert.el rename to elpa/flycheck-20160218.41/flycheck-ert.el index 9d1b8c1b..293a8f8e 100644 --- a/elpa/flycheck-20150703.359/flycheck-ert.el +++ b/elpa/flycheck-20160218.41/flycheck-ert.el @@ -1,6 +1,6 @@ ;;; flycheck-ert.el --- Flycheck: ERT extensions -*- lexical-binding: t; -*- -;; Copyright (C) 2013-2015 Sebastian Wiesner and Flycheck contributors +;; Copyright (C) 2013-2016 Sebastian Wiesner and Flycheck contributors ;; Author: Sebastian Wiesner ;; Maintainer: Sebastian Wiesner @@ -46,8 +46,8 @@ (unless flycheck-ert-ert-can-skip ;; Fake skipping - (put 'flycheck-ert-skipped 'error-message "Test skipped") - (put 'flycheck-ert-skipped 'error-conditions '(error)) + (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)) @@ -160,15 +160,6 @@ The absolute file name of RESOURCE-FILE is determined with (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))) - ;;; Test suite initialization @@ -197,35 +188,10 @@ should use to lookup resource files." ;;; 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))))) - ;;; Test case definitions (defmacro flycheck-ert-def-checker-test (checker language name @@ -249,11 +215,11 @@ 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." +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.")) + (error "No syntax checkers specified")) (unless language (error "No languages specified")) (let* ((checkers (if (symbolp checker) (list checker) checker)) @@ -279,7 +245,7 @@ assertions and setup code." ,(plist-get keys :tags)) ,@(mapcar (lambda (c) `(skip-unless ;; Ignore non-command checkers - (or (not (get ',c 'flycheck-command)) + (or (not (flycheck-checker-get ',c 'command)) (executable-find (flycheck-checker-executable ',c))))) checkers) ,@body))) @@ -359,7 +325,6 @@ ERROR is a Flycheck error object." 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)) @@ -375,8 +340,7 @@ ERROR is a Flycheck error object." (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)))) + (should (equal (overlay-get overlay 'flycheck-error) error)))) (defun flycheck-ert-should-errors (&rest errors) "Test that the current buffers has ERRORS. @@ -428,9 +392,6 @@ resource directory." (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) @@ -454,6 +415,7 @@ current buffer. Otherwise return nil." (= (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" diff --git a/elpa/flycheck-20150703.359/flycheck-pkg.el b/elpa/flycheck-20160218.41/flycheck-pkg.el similarity index 50% rename from elpa/flycheck-20150703.359/flycheck-pkg.el rename to elpa/flycheck-20160218.41/flycheck-pkg.el index fb2c668e..6a0d684e 100644 --- a/elpa/flycheck-20150703.359/flycheck-pkg.el +++ b/elpa/flycheck-20160218.41/flycheck-pkg.el @@ -1,9 +1,9 @@ -(define-package "flycheck" "20150703.359" "On-the-fly syntax checking" - '((dash "2.4.0") +(define-package "flycheck" "20160218.41" "On-the-fly syntax checking" + '((dash "2.12.1") (pkg-info "0.4") - (let-alist "1.0.1") - (cl-lib "0.3") - (emacs "24.1")) + (let-alist "1.0.4") + (seq "1.11") + (emacs "24.3")) :url "https://www.flycheck.org" :keywords '("convenience" "languages" "tools")) ;; Local Variables: diff --git a/elpa/flycheck-20150703.359/flycheck.el b/elpa/flycheck-20160218.41/flycheck.el similarity index 76% rename from elpa/flycheck-20150703.359/flycheck.el rename to elpa/flycheck-20160218.41/flycheck.el index 1809cfba..246da8f2 100644 --- a/elpa/flycheck-20150703.359/flycheck.el +++ b/elpa/flycheck-20160218.41/flycheck.el @@ -1,14 +1,15 @@ ;;; flycheck.el --- On-the-fly syntax checking -*- lexical-binding: t; -*- -;; Copyright (c) 2012-2015 Sebastian Wiesner and Flycheck contributors +;; Copyright (c) 2012-2016 Sebastian Wiesner and Flycheck contributors ;; Copyright (C) 2013, 2014 Free Software Foundation, Inc. ;; ;; Author: Sebastian Wiesner ;; Maintainer: Sebastian Wiesner +;; Clément Pit--Claudel ;; 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")) +;; 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. @@ -68,61 +69,36 @@ (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 '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)) ;;; 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 + ;; 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 @@ -132,6 +108,7 @@ attention to case differences." (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) @@ -158,15 +135,6 @@ attention to case differences." "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)) - ;;; Customization (defgroup flycheck nil @@ -226,17 +194,21 @@ attention to case differences." 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 @@ -245,20 +217,21 @@ attention to case differences." php php-phpmd php-phpcs + processing puppet-parser puppet-lint python-flake8 python-pylint python-pycompile r-lintr - racket rpm-rpmlint - rst rst-sphinx + rst ruby-rubocop ruby-rubylint ruby ruby-jruby + rust-cargo rust sass scala @@ -271,6 +244,7 @@ attention to case differences." sh-zsh sh-shellcheck slim + sql-sqlint tex-chktex tex-lacheck texinfo @@ -429,6 +403,59 @@ If set to nil, do not display errors at all." :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. @@ -554,51 +581,54 @@ enabled. Changing it will not affect buffers which already have :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 '(radio (const :tag "All locations" nil) - (const :tag "Informational messages" info) - (const :tag "Warnings" warning) - (const :tag "Errors" error) - (symbol :tag "Custom error level")) + :type 'flycheck-minimum-level :safe #'flycheck-error-level-p :package-version '(flycheck . "0.21")) -(defcustom flycheck-completion-system nil - "The completion system to use. - -`ido' - Use IDO. +(defcustom flycheck-error-list-minimum-level nil + "The minimum level of errors to display in the error list. - 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. +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. -`grizzl' - Use Grizzl. +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")) - Grizzl is an alternative completion system with powerful - flex matching, but a very limited UI. See URL - `https://github.com/d11wtq/grizzl'. +(defcustom flycheck-completing-read-function #'completing-read + "Function to read from minibuffer with completion. -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." +The function must be compatible to the built-in `completing-read' +function." :group 'flycheck - :type '(choice (const :tag "IDO" ido) - (const :tag "Grizzl" grizzl) - (const :tag "Completing read" nil)) - :package-version '(flycheck . "0.17")) + :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." @@ -798,6 +828,8 @@ This variable is a normal hook. See Info node `(elisp)Hooks'." (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) @@ -856,10 +888,23 @@ Set this variable to nil to disable the mode line completely." :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-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 @@ -905,7 +950,7 @@ Mode Conventions'), regardless of the value of this option." ;; 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 +(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)) @@ -1001,11 +1046,11 @@ to a number and return it. Otherwise return nil." (defun flycheck-string-list-p (obj) "Determine if OBJ is a list of strings." - (and (listp obj) (-all? #'stringp obj))) + (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) (-all? #'symbolp obj))) + (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." @@ -1115,10 +1160,10 @@ spliced into the resulting list." (lambda (item) (let ((result (funcall prepend-fn option item))) (cond - ((and (listp result) (-all? #'stringp result)) result) + ((and (listp result) (seq-every-p #'stringp result)) result) ((stringp result) (list result)) (t (error "Invalid result type for option: %S" result))))))) - (apply #'append (mapcar prepend items)))) + (apply #'append (seq-map prepend items)))) (defun flycheck-find-in-buffer (pattern) "Find PATTERN in the current buffer. @@ -1173,27 +1218,26 @@ Autoloads are generated by package.el during installation." Safely delete all files and directories listed in `flycheck-temporaries' and set the variable's value to nil." - (mapc #'flycheck-safe-delete flycheck-temporaries) + (seq-do #'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-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-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-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: +(defun flycheck-rx-to-string (form &optional no-group) + "Like `rx-to-string' for FORM, but with special keywords: `line' matches the line number. @@ -1207,22 +1251,25 @@ Safely delete all files and directories listed in (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)'. + 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)))) +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. @@ -1282,6 +1329,17 @@ FILE-NAME is nil, return `default-directory'." (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. @@ -1300,33 +1358,34 @@ chosen. If DEFAULT is nil and no checker was chosen, signal a 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)))) + (let* ((candidates (seq-map #'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))))) + (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 no Flycheck syntax checker" 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)))) + ;;; Checker API (defun flycheck-defined-checkers (&optional property) @@ -1340,7 +1399,8 @@ the syntax checkers." (let (defined-checkers) (mapatoms (lambda (symbol) (when (and (flycheck-valid-checker-p symbol) - (or (null property) (get symbol property))) + (or (null property) + (flycheck-checker-get symbol property))) (push symbol defined-checkers)))) (sort defined-checkers #'string<))) @@ -1372,8 +1432,8 @@ 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))) + (let ((modes (flycheck-checker-get checker 'modes)) + (predicate (flycheck-checker-get checker 'predicate))) (when (or (memq major-mode modes) (and (not modes) (functionp predicate) @@ -1389,6 +1449,17 @@ the current buffer." 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. @@ -1630,21 +1701,21 @@ Signal an error, if any property has an invalid value." 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))) + `((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 - (put symbol 'flycheck-generic-checker-version - flycheck-generic-checker-version))) + (setf (flycheck-checker-get symbol 'generic-checker-version) + flycheck-generic-checker-version))) (defun flycheck-valid-checker-p (checker) "Check whether a CHECKER is valid. @@ -1655,39 +1726,13 @@ A valid checker is a symbol defined as syntax checker with (= (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))) + (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)) @@ -1736,11 +1781,10 @@ nil otherwise." (defun flycheck-checker-at-point () "Return the Flycheck checker found at or before point. -Return 0 if there is no checker." +Return nil if there is no checker." (let ((symbol (variable-at-point 'any-symbol))) - (if (and (symbolp symbol) (flycheck-valid-checker-p symbol)) - symbol - 0))) + (when (flycheck-valid-checker-p symbol) + symbol))) (defun flycheck-describe-checker (checker) "Display the documentation of CHECKER. @@ -1749,55 +1793,78 @@ 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))))) + (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") - ;; 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))))))) + + ;; 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)))))) ;;; Syntax checker verification @@ -1824,8 +1891,8 @@ Slots: Return a list of `flycheck-verification-result' objects." (let (results - (predicate (flycheck-checker-predicate checker)) - (verify (get checker 'flycheck-verify))) + (predicate (flycheck-checker-get checker 'predicate)) + (verify (flycheck-checker-get checker 'verify))) (when predicate (let ((result (funcall predicate))) (push (flycheck-verification-result-new @@ -1841,6 +1908,118 @@ Return a list of `flycheck-verification-result' objects." '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. @@ -1858,49 +2037,20 @@ possible problems are shown." ;; 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") + (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) - (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))) + (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))) @@ -1908,7 +2058,9 @@ possible problems are shown." (princ " - ") (princ checker) (princ "\n")) - (princ "\nTry adding these syntax checkers to `flycheck-checkers'."))))))) + (princ "\nTry adding these syntax checkers to `flycheck-checkers'.\n"))) + + (flycheck--verify-print-footer buffer))))) ;;; Predicates for generic syntax checkers @@ -1925,7 +2077,7 @@ modified, or nil otherwise." ;;; Extending generic checkers (defun flycheck-add-next-checker (checker next &optional append) - "Add a NEXT checker after CHECKER. + "After CHECKER add a NEXT checker. CHECKER is a syntax checker symbol, to which to add NEXT checker. @@ -1945,12 +2097,12 @@ APPEND is non-nil." (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)))) + (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) - "Add a new major MODE to CHECKER. + "To CHECKER add a new major MODE. CHECKER and MODE are symbols denoting a syntax checker and a major mode respectively. @@ -1961,7 +2113,7 @@ will be used in buffers with MODE." (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))) + (push mode (flycheck-checker-get checker 'modes))) ;;; Generic syntax checks @@ -1985,12 +2137,12 @@ Slots: "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)))) + (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 (get checker 'flycheck-interrupt)) + (interrupt-fn (flycheck-checker-get checker 'interrupt)) (context (flycheck-syntax-check-context syntax-check))) (when interrupt-fn (funcall interrupt-fn checker context)))) @@ -2015,24 +2167,32 @@ Slots: (defconst flycheck-hooks-alist '( ;; Handle events that may start automatic syntax checks - (after-save-hook . flycheck-handle-save) - (after-change-functions . flycheck-handle-change) + (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) + (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) + (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)) + (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 @@ -2098,23 +2258,16 @@ 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)))) + (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-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))))) + (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. @@ -2141,6 +2294,7 @@ CHECKER will be used, even if it is not contained in (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 @@ -2151,8 +2305,10 @@ CHECKER will be used, even if it is not contained in 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 +`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 @@ -2330,8 +2486,9 @@ 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)))) + (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))) @@ -2495,7 +2652,7 @@ Return t if so, or nil otherwise." (setq flycheck-deferred-syntax-check nil)) (defun flycheck-perform-deferred-syntax-check () - "Perform any deferred syntax checks." + "Perform the deferred syntax check." (when (flycheck-deferred-check-p) (flycheck-clean-deferred-check) (flycheck-buffer-automatically))) @@ -2736,16 +2893,19 @@ non-whitespace character of the error line, if ERR has no error column." (message (flycheck-error-message err))) (if id (format "%s [%s]" message id) message))) -(defun flycheck-error-format (err) - "Format ERR as human-readable string. +(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. This string does -_not_ include the 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 `(,(number-to-string line) ":" + (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) @@ -2753,7 +2913,7 @@ _not_ include the file name." (apply #'concat format))) (defun flycheck-error-< (err1 err2) - "Determine whether ERR1 goes before ERR2 by location. + "Determine whether ERR1 is less than ERR2 by location. Compare by line numbers and then by column numbers." (let ((line1 (flycheck-error-line err1)) @@ -2767,7 +2927,7 @@ Compare by line numbers and then by column numbers." (< line1 line2)))) (defun flycheck-error-level-< (err1 err2) - "Determine whether ERR1 goes before ERR2 by error level. + "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." @@ -2807,16 +2967,33 @@ 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)) + (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. @@ -2836,7 +3013,7 @@ otherwise." Return a list of all errors that are relevant for their corresponding buffer." - (-filter #'flycheck-relevant-error-p errors)) + (seq-filter #'flycheck-relevant-error-p errors)) ;;; Status reporting for the current buffer @@ -2901,13 +3078,13 @@ nil." (`running "*") (`errored "!") (`finished - (if flycheck-current-errors - (let-alist (flycheck-count-errors flycheck-current-errors) - (format ":%s/%s" (or .error 0) (or .warning 0))) - "")) + (let-alist (flycheck-count-errors flycheck-current-errors) + (if (or .error .warning) + (format ":%s/%s" (or .error 0) (or .warning 0)) + ""))) (`interrupted "-") (`suspicious "?")))) - (concat " FlyC" text))) + (concat " " flycheck-mode-line-prefix text))) ;;; Error levels @@ -2925,6 +3102,16 @@ The following PROPERTIES constitute an error level: 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 @@ -2932,11 +3119,9 @@ The following PROPERTIES constitute an error level: 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. + 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 @@ -2952,17 +3137,19 @@ The following PROPERTIES constitute an error level: 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))) + (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." @@ -2972,13 +3159,17 @@ The following PROPERTIES constitute an error 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)) + (get level 'flycheck-fringe-bitmap-double-arrow)) (defun flycheck-error-level-fringe-face (level) "Get the fringe face for LEVEL." @@ -3010,39 +3201,56 @@ show the icon." ;;; 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.") +(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 'exclamation-mark + :fringe-bitmap 'flycheck-fringe-bitmap-double-arrow :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.") +(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 'question-mark + :fringe-bitmap 'flycheck-fringe-bitmap-double-arrow :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.") +(setf (get 'flycheck-info-overlay 'face) 'flycheck-info) +(setf (get 'flycheck-info-overlay 'priority) 90) (flycheck-define-error-level 'info - :severity -1 + :severity -10 + :compilation-level 0 :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-bitmap 'flycheck-fringe-bitmap-double-arrow :fringe-face 'flycheck-fringe-info :error-list-face 'flycheck-error-list-info) @@ -3054,7 +3262,7 @@ show the icon." 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) + (let ((filter (or (flycheck-checker-get checker 'error-filter) #'flycheck-sanitize-errors))) (funcall filter errors))) @@ -3081,17 +3289,31 @@ Returns sanitized ERRORS." (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." - (mapc (lambda (err) - (let ((column (flycheck-error-column err))) - (when column - (setf (flycheck-error-column err) - (+ column (or offset 1)))))) - errors) + (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) @@ -3156,17 +3378,23 @@ included file." (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 + ;; 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 (flycheck-error-filename - (car remaining-errors)))) - (while (and remaining-errors - (not (string= (flycheck-error-filename - (car remaining-errors)) - current-filename))) + (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) @@ -3175,7 +3403,12 @@ included file." (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 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)))))) @@ -3191,23 +3424,23 @@ 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) + (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." - (mapc (lambda (err) (setf (flycheck-error-id err) nil)) errors) + (seq-do (lambda (err) (setf (flycheck-error-id err) nil)) errors) errors) @@ -3223,18 +3456,17 @@ level." (let* ((level (flycheck-error-level err)) (item (assq level counts-by-level))) (if item - (setcdr item (1+ (cdr 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)) - found) - (while (and errors (not found)) - (setq found (< severity (flycheck-error-level-severity - (flycheck-error-level (pop errors)))))) - (not found))) + (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." @@ -3242,10 +3474,7 @@ 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)) + (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. @@ -3271,23 +3500,49 @@ Return the created overlay." (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) + (setf (overlay-get overlay 'flycheck-overlay) t) + (setf (overlay-get overlay 'flycheck-error) err) ;; TODO: Consider hooks to re-check if overlay contents change - (overlay-put overlay 'category category) + (setf (overlay-get overlay 'category) category) (unless flycheck-highlighting-mode ;; Erase the highlighting from the overlay if requested by the user - (overlay-put overlay 'face nil)) + (setf (overlay-get 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)) + (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." - (-filter (lambda (o) (overlay-get o 'flycheck-overlay)) overlays)) + (seq-filter (lambda (o) (overlay-get o 'flycheck-overlay)) overlays)) (defun flycheck-overlays-at (pos) "Get all Flycheck overlays at POS." @@ -3299,13 +3554,13 @@ Return the created overlay." (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))) + (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." - (mapcar (lambda (o) (overlay-get o 'flycheck-error)) - (flycheck-overlays-in beg 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.") @@ -3316,7 +3571,7 @@ Return the created overlay." (flycheck-delete-marked-overlays) (save-restriction (widen) - (mapc #'delete-overlay (flycheck-overlays-in (point-min) (point-max))))) + (seq-do #'delete-overlay (flycheck-overlays-in (point-min) (point-max))))) (defun flycheck-mark-all-overlays-for-deletion () "Mark all current overlays for deletion." @@ -3326,7 +3581,7 @@ Return the created overlay." (defun flycheck-delete-marked-overlays () "Delete all overlays marked for deletion." - (mapc #'delete-overlay flycheck-overlays-to-delete) + (seq-do #'delete-overlay flycheck-overlays-to-delete) (setq flycheck-overlays-to-delete nil)) @@ -3346,7 +3601,7 @@ Return the created overlay." (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 +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. @@ -3392,6 +3647,11 @@ there is none." (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 @@ -3401,9 +3661,10 @@ Intended for use with `next-error-function'." (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." +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 @@ -3413,8 +3674,8 @@ N specifies how many errors to move forwards. If negative, move backwards." (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." +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)))) @@ -3433,6 +3694,8 @@ the beginning of the buffer." (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) @@ -3445,8 +3708,7 @@ the beginning of the buffer." ("Col" 3 nil :right-align t) ("Level" 8 flycheck-error-list-entry-level-<) ("ID" 6 t) - ("Message" 0 t) - (" (Checker)" 8 t)] + ("Message (Checker)" 0 t)] "Table format for the error list.") (define-derived-mode flycheck-error-list-mode tabulated-list-mode "Flycheck errors" @@ -3502,9 +3764,15 @@ the beginning of the buffer." (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))) + "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. @@ -3515,6 +3783,17 @@ string with attached text properties." (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. @@ -3537,17 +3816,42 @@ Return a list with the contents of the table cell." (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))))) + (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 (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)))) + (-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. @@ -3634,6 +3938,42 @@ list." ;; 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. @@ -3657,7 +3997,7 @@ POS defaults to `point'." (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. + "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. @@ -3732,11 +4072,13 @@ non-nil." ;; 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))) + (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 - (mapc #'delete-overlay 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))) @@ -3754,6 +4096,8 @@ non-nil." (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 @@ -3779,6 +4123,7 @@ non-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" @@ -3825,9 +4170,10 @@ 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))) + (let ((messages (seq-map #'flycheck-error-format-message-and-id errors))) (display-message-or-buffer (string-join messages "\n\n") - flycheck-error-message-buffer)))) + 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. @@ -3845,7 +4191,10 @@ 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)))) + ;; 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))))) ;;; Working with errors @@ -3864,15 +4213,12 @@ universal prefix arg, and only the id with normal 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))))) + (let ((messages (delq nil (seq-map (or formatter #'flycheck-error-message) + (flycheck-overlay-errors-at pos))))) (when messages - (mapc #'kill-new (reverse messages)) + (seq-do #'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") - ;;; Syntax checkers using external commands (defun flycheck-command-argument-p (arg) @@ -3909,7 +4255,7 @@ universal prefix arg, and only the id with normal prefix arg." ;;;###autoload (defun flycheck-define-command-checker (symbol docstring &rest properties) - "Define SYMBOL as syntax checker which runs a command. + "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 @@ -3972,11 +4318,18 @@ of command checkers is `flycheck-sanitize-errors'. `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, but you should take care to call -`flycheck-verify-command-checker' in a custom `:verify' -function." +`: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)) @@ -3988,12 +4341,20 @@ function." ;; 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))) + (predicate (plist-get properties :predicate)) + (standard-input (plist-get properties :standard-input))) (unless command (error "Missing :command in syntax checker %s" symbol)) @@ -4012,28 +4373,28 @@ function." ;; guard against syntax checker tools which are not installed (plist-put properties :predicate (lambda () - (and (executable-find (flycheck-checker-executable symbol)) + (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 - :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))) + (let ((patterns (seq-map (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))))) + `((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 @@ -4046,7 +4407,7 @@ The executable variable is named `flycheck-CHECKER-executable'." (defun flycheck-checker-default-executable (checker) "Get the default executable of CHECKER." - (car (get checker 'flycheck-command))) + (car (flycheck-checker-get checker 'command))) (defun flycheck-checker-executable (checker) "Get the command executable of CHECKER. @@ -4058,20 +4419,16 @@ the syntax checker definition, if the variable is nil." (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-find-checker-executable (checker) + "Get the full path of the executbale of CHECKER. -(defun flycheck-checker-error-patterns (checker) - "Get the error patterns 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))) -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-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. @@ -4229,19 +4586,19 @@ are substituted within the body of cells!" (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)) + (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) (-all? #'stringp value)) + (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 (mapcar filter (symbol-value variable))))) - (unless (and (listp value) (-all? #'stringp value)) + (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))) @@ -4251,7 +4608,7 @@ are substituted within the body of cells!" (`(eval ,form) (let ((result (eval form))) (cond - ((and (listp result) (-all? #'stringp result)) result) + ((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)))) @@ -4263,15 +4620,66 @@ 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)))) + (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-checker-executable checker)) + (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 @@ -4287,9 +4695,9 @@ symbols in the command." ;; 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) + 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) @@ -4299,6 +4707,9 @@ symbols in the command." ;; 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 @@ -4320,9 +4731,9 @@ symbols in the command." (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)))) + (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)))) @@ -4353,7 +4764,7 @@ symbols in the command." Return a list of `flycheck-verification-result' objects for CHECKER." - (let ((executable (executable-find (flycheck-checker-executable checker)))) + (let ((executable (flycheck-find-checker-executable checker))) (list (flycheck-verification-result-new :label "executable" @@ -4381,7 +4792,7 @@ _EVENT is ignored." (buffer (process-get process 'flycheck-buffer)) (callback (process-get process 'flycheck-callback))) ;; Delete the temporary files - (mapc #'flycheck-safe-delete files) + (seq-do #'flycheck-safe-delete files) (when (buffer-live-p buffer) (with-current-buffer buffer (condition-case err @@ -4394,7 +4805,7 @@ _EVENT is ignored." (process-exit-status process) files (flycheck-get-output process) callback))) - (error + ((debug error) (funcall callback 'errored (error-message-string err))))))))) (defun flycheck-finish-checker-process @@ -4418,8 +4829,8 @@ 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)))) + (seq-map (lambda (e) (flycheck-fix-error-filename e files)) + errors)))) ;;; Executables of command checkers. @@ -4449,7 +4860,7 @@ The default executable is %S." checker default-executable) :risky t)))) (defun flycheck-set-checker-executable (checker &optional executable) - "Set the EXECUTABLE of CHECKER in the current buffer. + "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 @@ -4477,15 +4888,24 @@ variable symbol for a syntax checker." (executable (if current-prefix-arg nil (read-file-name "Executable: " nil default-executable - nil nil #'executable-find)))) + nil nil flycheck-executable-find)))) (list checker executable))) - (when (and executable (not (executable-find 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))) ;;; 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) @@ -4500,9 +4920,10 @@ 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 - (put ',checker 'flycheck-config-file-var ',symbol) (defcustom ,symbol ,file-name ,(format "Configuration file for `%s'. @@ -4519,20 +4940,8 @@ 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)) + ,@custom-args) + (flycheck-register-config-file-var ',symbol ',checker))) (defun flycheck-locate-config-file (filename checker) "Locate the configuration file FILENAME for CHECKER. @@ -4548,16 +4957,18 @@ configuration file was found." (when (file-exists-p filepath) filepath))) -(defun flycheck-locate-config-file-absolute-path (filepath _checker) +(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. Otherwise return nil. +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) - (expand-file-name 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. @@ -4581,21 +4992,33 @@ directory, or nil otherwise." (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)) +(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 checker docstring +(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 CHECKER. INIT-VALUE is -the initial value of the variable, and DOCSTRING is its -docstring. CUSTOM-ARGS are forwarded to `defcustom'. +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 @@ -4603,23 +5026,32 @@ Use this together with the `option', `option-list' and (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 + ,(concat docstring " -This variable is an option for the syntax checker `%s'." docstring checker) +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))) + ,@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." - (when value - (number-to-string value))) + (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. @@ -4637,26 +5069,26 @@ 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))) + (-when-let (value (delq nil (seq-map 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. +(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 CHECKER. CUSTOM-ARGS is forwarded -to `defcustom'. +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 ,checker - ,(format "A list of additional arguments for `%s'. + `(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." checker) +command line arguments." :risky t :type '(repeat (string :tag "Argument")) ,@custom-args)) @@ -4670,10 +5102,7 @@ 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)))) + (level-no (flycheck-error-level-compilation-level level))) (list regexp 1 2 3 level-no))) (defun flycheck-checker-compilation-error-regexp-alist (checker) @@ -4681,8 +5110,8 @@ Return a list representing PATTERN, suitable as element in 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))) + (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. @@ -4695,15 +5124,22 @@ 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)))) " ")) + (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. @@ -4723,8 +5159,9 @@ 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)))) + (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) @@ -4736,8 +5173,8 @@ tool, just like `compile' (\\[compile])." (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))))) + (setq-local compilation-error-regexp-alist + (flycheck-checker-compilation-error-regexp-alist checker))))) ;;; General error parsing for command checkers @@ -4748,7 +5185,7 @@ 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)) + (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. @@ -4758,11 +5195,10 @@ 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))) + (when (seq-some (apply-partially #'flycheck-same-files-p + (expand-file-name filename)) + buffer-files) + (setf (flycheck-error-filename err) (buffer-file-name))))) err) @@ -4802,6 +5238,9 @@ text nodes) or as XML nodes, in the same for as the root node." 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) @@ -4835,6 +5274,9 @@ about Checkstyle." 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) @@ -4871,6 +5313,9 @@ about Cppcheck." (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) @@ -4901,7 +5346,7 @@ See URL `http://phpmd.org/' for more information about phpmd." ;;; 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)) + (rx-to-string `(or ,@(seq-map (lambda (p) (list 'regexp (car p))) patterns)) 'no-group)) (defun flycheck-tokenize-output-with-patterns (output patterns) @@ -4974,10 +5419,10 @@ _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))))) + (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))))) ;;; Convenience definition of command-syntax checkers @@ -4992,7 +5437,8 @@ SYMBOL with `flycheck-def-executable-var'." (let ((command (plist-get properties :command)) (parser (plist-get properties :error-parser)) (filter (plist-get properties :error-filter)) - (predicate (plist-get properties :predicate))) + (predicate (plist-get properties :predicate)) + (verify-fn (plist-get properties :verify))) `(progn (flycheck-def-executable-var ,symbol ,(car command)) @@ -5008,7 +5454,10 @@ SYMBOL with `flycheck-def-executable-var'." :modes ',(plist-get properties :modes) ,@(when predicate `(:predicate #',predicate)) - :next-checkers ',(plist-get properties :next-checkers))))) + :next-checkers ',(plist-get properties :next-checkers) + ,@(when verify-fn + `(:verify #',verify-fn)) + :standard-input ',(plist-get properties :standard-input))))) ;;; Built-in checkers @@ -5084,12 +5533,18 @@ Uses the GNAT compiler from GCC. See URL "A AsciiDoc syntax checker using the AsciiDoc compiler. See URL `http://www.methods.co.nz/asciidoc'." - :command ("asciidoc" source) + :command ("asciidoc" "-o" null-device "-") + :standard-input t :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)) + ((error line-start + "asciidoc: ERROR: : Line " line ": " (message) + line-end) + (warning line-start + "asciidoc: WARNING: : Line " line ": " (message) + line-end) + (info line-start + "asciidoc: DEPRECATED: : Line " line ": " (message) + line-end)) :modes adoc-mode) (flycheck-def-args-var flycheck-clang-args c/c++-clang @@ -5233,7 +5688,7 @@ 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 +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) @@ -5269,16 +5724,18 @@ See URL `http://clang.llvm.org/'." (pcase major-mode (`c++-mode "c++") (`c-mode "c"))) - source) + ;; Read from standard input + "-") + :standard-input t :error-patterns ((error line-start - (message "In file included from") " " (file-name) ":" line ":" - line-end) - (info line-start (file-name) ":" line ":" column + (message "In file included from") " " (or "" (file-name)) + ":" line ":" line-end) + (info line-start (or "" (file-name)) ":" line ":" column ": note: " (optional (message)) line-end) - (warning line-start (file-name) ":" line ":" column + (warning line-start (or "" (file-name)) ":" line ":" column ": warning: " (optional (message)) line-end) - (error line-start (file-name) ":" line ":" column + (error line-start (or "" (file-name)) ":" line ":" column ": " (or "fatal error" "error") ": " (optional (message)) line-end)) :error-filter (lambda (errors) @@ -5364,7 +5821,7 @@ When non-nil, enable OpenMP for syntax checkers, via :safe #'booleanp :package-version '(flycheck . "0.21")) -(flycheck-def-option-var flycheck-gcc-pedantic nil c/c++-clang +(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. @@ -5374,7 +5831,7 @@ When non-nil, disable non-ISO extensions to C/C++ via :safe #'booleanp :package-version '(flycheck . "0.23")) -(flycheck-def-option-var flycheck-gcc-pedantic-errors nil c/c++-clang +(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. @@ -5426,21 +5883,22 @@ Requires GCC 4.8 or newer. See URL `https://gcc.gnu.org/'." (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) + "-S" "-o" null-device + ;; Read from standard input + "-") + :standard-input t :error-patterns ((error line-start - (message "In file included from") " " (file-name) ":" line ":" - column ":" - line-end) - (info line-start (file-name) ":" line ":" column + (message "In file included from") " " (or "" (file-name)) + ":" line ":" column ":" line-end) + (info line-start (or "" (file-name)) ":" line ":" column ": note: " (message) line-end) - (warning line-start (file-name) ":" line ":" column + (warning line-start (or "" (file-name)) ":" line ":" column ": warning: " (message) line-end) - (error line-start (file-name) ":" line ":" column + (error line-start (or "" (file-name)) ":" line ":" column ": " (or "fatal error" "error") ": " (message) line-end)) :error-filter (lambda (errors) @@ -5465,6 +5923,18 @@ including a list of supported checks." :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. @@ -5476,6 +5946,16 @@ This will have no effect when using Cppcheck 1.53 and older." :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. @@ -5484,6 +5964,8 @@ See URL `http://cppcheck.sourceforge.net/'." (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)) @@ -5545,9 +6027,10 @@ See URL `http://acrmp.github.io/foodcritic/'." See URL `http://coffeescript.org/'." ;; --print suppresses generation of compiled .js files - :command ("coffee" "--compile" "--print" source) + :command ("coffee" "--compile" "--print" "--stdio") + :standard-input t :error-patterns - ((error line-start (file-name) ":" line ":" column + ((error line-start "[stdin]:" line ":" column ": error: " (message) line-end)) :modes coffee-mode :next-checkers ((warning . coffee-coffeelint))) @@ -5565,11 +6048,13 @@ See URL `http://www.coffeelint.org/'." :command ("coffeelint" (config-file "--file" flycheck-coffeelintrc) - "--reporter" "checkstyle" source) + "--stdin" "--reporter" "checkstyle") + :standard-input t :error-parser flycheck-parse-checkstyle :error-filter (lambda (errors) - (flycheck-remove-error-ids - (flycheck-sanitize-errors errors))) + (flycheck-remove-error-file-names + "stdin" (flycheck-remove-error-ids + (flycheck-sanitize-errors errors)))) :modes coffee-mode) (flycheck-define-checker coq @@ -5582,7 +6067,7 @@ See URL `http://coq.inria.fr/'." ((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: ") + (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")) ".") @@ -5590,7 +6075,7 @@ See URL `http://coq.inria.fr/'." line-end)) :error-filter (lambda (errors) - (dolist (err 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) @@ -5726,13 +6211,15 @@ is used." '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." +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)) @@ -5766,8 +6253,9 @@ initialize packages." (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. +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." @@ -5778,11 +6266,10 @@ This variable has no effect, if (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)))) + ;; 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. @@ -5792,7 +6279,7 @@ See Info Node `(elisp)Byte Compilation'." (eval (let ((path (pcase flycheck-emacs-lisp-load-path (`inherit load-path) - (p (mapcar #'expand-file-name p))))) + (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) @@ -5841,11 +6328,18 @@ See Info Node `(elisp)Byte Compilation'." (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) @@ -5853,14 +6347,13 @@ See Info Node `(elisp)Byte Compilation'." ;; 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)))))))) + ;; 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. @@ -5881,11 +6374,9 @@ The checker runs `checkdoc-current-buffer'." (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)) +(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. @@ -5897,6 +6388,16 @@ Relative paths are relative to the file being checked." :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. @@ -5904,6 +6405,7 @@ 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 @@ -6003,11 +6505,12 @@ Uses GCC's Fortran compiler gfortran. See URL (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") + ((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)) @@ -6015,9 +6518,10 @@ Uses GCC's Fortran compiler gfortran. See URL "A Go syntax and style checker using the gofmt utility. See URL `http://golang.org/cmd/gofmt/'." - :command ("gofmt" source) + :command ("gofmt") + :standard-input t :error-patterns - ((error line-start (file-name) ":" line ":" column ": " (message) line-end)) + ((error line-start ":" line ":" column ": " (message) line-end)) :modes go-mode :next-checkers ((warning . go-golint) ;; Fall back, if go-golint doesn't exist @@ -6074,16 +6578,48 @@ See URL `http://golang.org/cmd/go/' and URL :next-checkers (go-build go-test ;; Fall back if `go build' or `go test' can be used - go-errcheck)) + 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. It's “too magic”. See - ;; https://code.google.com/p/go/issues/detail?id=4851 for details. - :command ("go" "build" "-o" temporary-file-name) + ;; 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 ":") " " @@ -6117,8 +6653,8 @@ See URL `http://golang.org/cmd/go'." (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. +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." @@ -6139,7 +6675,7 @@ 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") + (file-name) ":" line ":" column (or (one-or-more "\t") ": ") (message) line-end)) :error-filter @@ -6168,11 +6704,35 @@ See URL `https://github.com/kisielk/errcheck'." ;; 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" source) + :command ("haml" "-c" "--stdin") + :standard-input t :error-patterns ((error line-start "Syntax error on line " line ": " (message) line-end)) :modes haml-mode) @@ -6181,7 +6741,8 @@ See URL `http://haml.info'." "A Handlebars syntax checker using the Handlebars compiler. See URL `http://handlebarsjs.com/'." - :command ("handlebars" source) + :command ("handlebars" "-i-") + :standard-input t :error-patterns ((error line-start "Error: Parse error on line " line ":" (optional "\r") "\n" @@ -6202,10 +6763,10 @@ See URL `http://handlebarsjs.com/'." (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"))))) + (group (one-or-more (not (any space "(" "\n"))))) "Regular expression for a Haskell module name.") -(flycheck-def-args-var flycheck-ghc-args haskell-ghc +(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 @@ -6227,8 +6788,9 @@ database is given to GHC via `-package-db'." :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. +(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 @@ -6237,8 +6799,9 @@ is added to the GHC search path via `-i'." :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. +(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 @@ -6247,11 +6810,66 @@ pragma. Each extension is enabled via `-X'." :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" "-fno-code" + :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) @@ -6293,23 +6911,70 @@ See URL `http://www.haskell.org/ghc/'." :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" source-inplace) + :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 - ((warning line-start + ((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 not-newline) - (one-or-more "\n" (one-or-more not-newline))) + (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 not-newline) - (one-or-more "\n" (one-or-more not-newline))) + (message (one-or-more (and (one-or-more (not (any ?\n))) ?\n))) line-end)) :modes (haskell-mode literate-haskell-mode)) @@ -6320,7 +6985,8 @@ See URL `https://github.com/ndmitchell/hlint'." "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) + :command ("tidy" (config-file "-config" flycheck-tidyrc) "-e" "-q") + :standard-input t :error-patterns ((error line-start "line " line @@ -6332,18 +6998,58 @@ See URL `https://github.com/w3c/tidy-html5'." " - 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" "--checkstyle-reporter" + :command ("jshint" "--reporter=checkstyle" + "--filename" source-original (config-file "--config" flycheck-jshintrc) - source) + (option "--extract=" flycheck-jshint-extract-javascript + concat flycheck-option-symbol) + "-") + :standard-input t :error-parser flycheck-parse-checkstyle - :error-filter flycheck-dequalify-error-ids + :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))) @@ -6373,27 +7079,25 @@ 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) + "--stdin" "--stdin-filename" source-original) + :standard-input t :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))) + (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 js2-mode js3-mode) + :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" @@ -6436,12 +7140,14 @@ error." See URL `http://www.jscs.info'." :command ("jscs" "--reporter=checkstyle" (config-file "--config" flycheck-jscsrc) - source) + "-") + :standard-input t :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-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. @@ -6452,17 +7158,18 @@ to the former. To use it with the latter, set See URL `https://github.com/feross/standard' and URL `https://github.com/Flet/semistandard'." - :command ("standard" source) + :command ("standard" "--stdin") + :standard-input t :error-patterns - ((error line-start - " " (file-name) ":" line ":" column ":" (message) - line-end)) - :modes (js-mode js2-mode js3-mode)) + ((error line-start " :" 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 @@ -6470,6 +7177,29 @@ See URL `https://github.com/zaach/jsonlint'." ": 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 @@ -6484,16 +7214,12 @@ 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) + "-") + :standard-input t :error-patterns ((error line-start (one-or-more word) ":" (message) - " in " - (file-name) - - " on line " line + " in - on line " line ", column " column ":" line-end)) :modes less-css-mode) @@ -6511,28 +7237,31 @@ See URL `https://github.com/mpeterv/luacheck'." "--formatter" "plain" "--codes" ; Show warning codes "--no-color" - source) + ;; Read from standard input + "-") + :standard-input t :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)) + ((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" source) + :command ("luac" "-p" "-") + :standard-input t :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 + ;; Skip the name of the luac executable. (minimal-match (zero-or-more not-newline)) - ":" line ": " (message) line-end)) + ": stdin:" line ": " (message) line-end)) :modes lua-mode) (flycheck-def-option-var flycheck-perl-include-path nil perl @@ -6550,11 +7279,11 @@ Relative paths are relative to the file being checked." See URL `http://www.perl.org'." :command ("perl" "-w" "-c" - (option-list "-I" flycheck-perl-include-path) - source) + (option-list "-I" flycheck-perl-include-path)) + :standard-input t :error-patterns ((error line-start (minimal-match (message)) - " at " (file-name) " line " line + " at - line " line (or "." (and ", " (zero-or-more not-newline))) line-end)) :modes (perl-mode cperl-mode) :next-checkers (perl-perlcritic)) @@ -6568,28 +7297,31 @@ the `--severity' option to Perl Critic." :safe #'integerp :package-version '(flycheck . "0.18")) -(define-obsolete-variable-alias 'flycheck-perlcritic-verbosity - 'flycheck-perlcritic-severity "0.22") +(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) - source) + flycheck-option-int)) + :standard-input t :error-patterns ((info line-start - (file-name) "/" line "/" column "/" (any "1") "/" + "STDIN/" line "/" column "/" (any "1") "/" (id (one-or-more (not (any "/")))) "/" (message) line-end) (warning line-start - (file-name) "/" line "/" column "/" (any "234") "/" + "STDIN/" line "/" column "/" (any "234") "/" (id (one-or-more (not (any "/")))) "/" (message) line-end) (error line-start - (file-name) "/" line "/" column "/" (any "5") "/" + "STDIN/" line "/" column "/" (any "5") "/" (id (one-or-more (not (any "/")))) "/" (message) line-end)) :modes (cperl-mode perl-mode)) @@ -6599,10 +7331,11 @@ See URL `https://metacpan.org/pod/Perl::Critic'." 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) + "-d" "log_errors=0") + :standard-input t :error-patterns ((error line-start (or "Parse" "Fatal" "syntax") " error" (any ":" ",") " " - (message) " in " (file-name) " on line " line line-end)) + (message) " in - on line " line line-end)) :modes (php-mode php+-mode) :next-checkers ((warning . php-phpmd) (warning . php-phpcs))) @@ -6647,26 +7380,44 @@ or as path to a standard specification." See URL `http://pear.php.net/package/PHP_CodeSniffer/'." :command ("phpcs" "--report=checkstyle" - (option "--standard=" flycheck-phpcs-standard concat) - source) + (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" source) + :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 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) + (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 @@ -6677,6 +7428,27 @@ See URL `http://puppetlabs.com/'." :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. @@ -6687,7 +7459,11 @@ See URL `http://puppet-lint.com/'." ;; 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})" + (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) @@ -6704,7 +7480,8 @@ See URL `http://puppet-lint.com/'." '(("^E9.*$" . error) ; Syntax errors from pep8 ("^F82.*$" . error) ; undefined variables from pyflakes ("^F83.*$" . error) ; Duplicate arguments from flake8 - ("^N.*$" . info) ; Naming issues from naming + ("^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. @@ -6718,12 +7495,14 @@ 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." +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")) @@ -6772,19 +7551,21 @@ Update the error level of ERR according to 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) - source) + "-") + :standard-input t :error-filter (lambda (errors) (let ((errors (flycheck-sanitize-errors errors))) - (mapc #'flycheck-flake8-fix-error-level errors) + (seq-do #'flycheck-flake8-fix-error-level errors) errors)) :error-patterns ((warning line-start - (file-name) ":" line ":" (optional column ":") " " + "stdin:" line ":" (optional column ":") " " (id (one-or-more (any alpha)) (one-or-more digit)) " " (message (one-or-more not-newline)) line-end)) @@ -6794,6 +7575,16 @@ Requires Flake8 2.0 or newer. See URL ".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. @@ -6802,7 +7593,10 @@ 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}" + "--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 @@ -6881,16 +7675,9 @@ See URL `https://github.com/jimhester/lintr'." 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) + :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. @@ -6931,17 +7718,16 @@ part of a Sphinx project." 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) + :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 (file-name) ":" line ": (WARNING/2) " (message) line-end) - (error line-start - (file-name) ":" line + ((warning line-start ":" line ": (WARNING/2) " (message) line-end) + (error line-start ":" 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)))) + :modes rst-mode) (flycheck-def-option-var flycheck-sphinx-warn-on-missing-references t rst-sphinx "Whether to warn about missing references in Sphinx. @@ -6988,11 +7774,22 @@ Otherwise report style issues as well." (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) - source) + ;; 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) @@ -7019,6 +7816,7 @@ ruby-lint 2.0.2 or newer is required. See URL :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) @@ -7040,16 +7838,14 @@ implementations. Please consider using `ruby-rubocop' or `ruby-rubylint' instead. See URL `https://www.ruby-lang.org/'." - :command ("ruby" "-w" "-c" source) + :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 " (file-name) ":" line ": " (message) - line-end) - (warning line-start - (file-name) ":" line ":" (optional column ":") + ((error line-start "SyntaxError in -:" line ": " (message) line-end) + (warning line-start "-:" line ":" (optional column ":") " warning: " (message) line-end) - (error line-start (file-name) ":" line ": " (message) line-end)) + (error line-start "-:" line ": " (message) line-end)) :modes (enh-ruby-mode ruby-mode) :next-checkers ((warning . ruby-rubylint))) @@ -7062,20 +7858,19 @@ versions of JRuby. Please consider using `ruby-rubocop' or `ruby-rubylint' instead. See URL `http://jruby.org/'." - :command ("jruby" "-w" "-c" source) + :command ("jruby" "-w" "-c") + :standard-input t :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)) + ((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 +(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 +(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 @@ -7102,7 +7897,7 @@ if it is not modified, i.e. after it has been saved." :safe #'stringp) (make-variable-buffer-local 'flycheck-rust-crate-root) -(flycheck-def-option-var flycheck-rust-crate-type "lib" rust +(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, @@ -7112,7 +7907,7 @@ for the `--crate-type' flag." :package-version '("flycheck" . "0.20")) (make-variable-buffer-local 'flycheck-rust-crate-type) -(flycheck-def-option-var flycheck-rust-library-path nil rust +(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 @@ -7122,6 +7917,39 @@ Relative paths are relative to the file being checked." :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. @@ -7152,7 +7980,7 @@ See URL `http://www.rust-lang.org'." (message) line-end)) :modes rust-mode :predicate (lambda () - (or (not flycheck-rust-crate-root) (flycheck-buffer-saved-p)))) + (and (not flycheck-rust-crate-root) (flycheck-buffer-saved-p)))) (defvar flycheck-sass-scss-cache-directory nil "The cache directory for `sass' and `scss'.") @@ -7181,19 +8009,27 @@ See URL `http://sass-lang.com'." :command ("sass" "--cache-location" (eval (flycheck-sass-scss-cache-location)) (option-flag "--compass" flycheck-sass-compass) - "-c" source) + "--check" "--stdin") + :standard-input t :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 + ((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)) + (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 @@ -7210,15 +8046,6 @@ See URL `http://www.scala-lang.org/'." :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. @@ -7227,8 +8054,7 @@ Note that this syntax checker is not used if point to non-existing files. See URL `http://www.scalastyle.org'." - :command ("java" - (option "-jar" flycheck-scalastyle-jar) + :command ("scalastyle" (config-file "-c" flycheck-scalastylerc) source) :error-patterns @@ -7236,14 +8062,33 @@ See URL `http://www.scalastyle.org'." (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-scalastyle-jar flycheck-scalastylerc - (file-exists-p flycheck-scalastyle-jar) - (file-exists-p (flycheck-locate-config-file - flycheck-scalastylerc 'scala-scalastyle))))) + (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") @@ -7270,19 +8115,43 @@ Please run gem install scss_lint_reporter_checkstyle" (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) - source) + "--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) + :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. @@ -7299,30 +8168,43 @@ See URL `http://sass-lang.com'." :command ("scss" "--cache-location" (eval (flycheck-sass-scss-cache-location)) (option-flag "--compass" flycheck-scss-compass) - "-c" source) + "--check" "--stdin") + :standard-input t :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 + ((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)) + (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" "--" source) - :error-patterns ((error line-start - (file-name) ":" (one-or-more (not (any digit))) - line (zero-or-more " ") ":" (zero-or-more " ") - (message) line-end)) + :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))) @@ -7331,9 +8213,10 @@ See URL `http://www.gnu.org/software/bash/'." "A POSIX Shell syntax checker using the Dash shell. See URL `http://gondor.apana.org.au/~herbert/dash/'." - :command ("dash" "-n" source) + :command ("dash" "-n") + :standard-input t :error-patterns - ((error line-start (file-name) ": " line ": " (backref 1) ": " (message))) + ((error line-start (one-or-more (not (any ":"))) ": " line ": " (message))) :modes sh-mode :predicate (lambda () (eq sh-shell 'sh)) :next-checkers ((warning . sh-shellcheck))) @@ -7342,10 +8225,14 @@ See URL `http://gondor.apana.org.au/~herbert/dash/'." "A POSIX Shell syntax checker using the Bash shell. See URL `http://www.gnu.org/software/bash/'." - :command ("bash" "--posix" "--norc" "-n" "--" source) + :command ("bash" "--posix" "--norc" "-n" "--") + :standard-input t :error-patterns ((error line-start - (file-name) ":" (one-or-more (not (any digit))) + ;; 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 @@ -7356,7 +8243,7 @@ See URL `http://www.gnu.org/software/bash/'." "A Zsh syntax checker using the Zsh shell. See URL `http://www.zsh.org/'." - :command ("zsh" "-n" "-d" "-f" source) + :command ("zsh" "--no-exec" "--no-globalrcs" "--no-rcs" source) :error-patterns ((error line-start (file-name) ":" line ": " (message) line-end)) :modes sh-mode @@ -7386,24 +8273,58 @@ See URL `https://github.com/koalaman/shellcheck/'." "--shell" (eval (symbol-name sh-shell)) (option "--exclude" flycheck-shellcheck-excluded-warnings list flycheck-option-comma-separated-list) - source) + "-") + :standard-input t :error-parser flycheck-parse-checkstyle - :error-filter flycheck-dequalify-error-ids + :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))) + :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" "-c" source) + :command ("slimrb" "--compile") + :standard-input t :error-patterns ((error line-start "Slim::Parser::SyntaxError:" (message) (optional "\r") "\n " - (file-name) ", Line " line (optional ", Column " column) + "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) @@ -7411,10 +8332,14 @@ See URL `http://slim-lang.com'." "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) + :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 (file-name) ":" line ":" column ":" + ((warning line-start "stdin:" line ":" column ":" (id (one-or-more digit)) ":" (message) line-end)) :error-filter (lambda (errors) @@ -7436,21 +8361,34 @@ See URL `http://www.ctan.org/pkg/lacheck'." "A Texinfo syntax checker using makeinfo. See URL `http://www.gnu.org/software/texinfo/'." - :command ("makeinfo" "-o" null-device source-inplace) + :command ("makeinfo" "-o" null-device "-") + :standard-input t :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)) + ((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" source) + :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) @@ -7462,9 +8400,12 @@ See URL `http://www.veripool.org/wiki/verilator'." "A XML syntax checker and validator using the xmlstarlet utility. See URL `http://xmlstar.sourceforge.net/'." - :command ("xmlstarlet" "val" "-e" "-q" source) + ;; 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 (file-name) ":" line "." column ": " (message) line-end)) + ((error line-start "-:" line "." column ": " (message) line-end)) :modes (xml-mode nxml-mode)) (flycheck-define-checker xml-xmllint @@ -7472,19 +8413,22 @@ See URL `http://xmlstar.sourceforge.net/'." The xmllint is part of libxml2, see URL `http://www.xmlsoft.org/'." - :command ("xmllint" "--noout" source) + :command ("xmllint" "--noout" "-") + :standard-input t :error-patterns - ((error line-start (file-name) ":" line ": " (message) line-end)) + ((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" source) + :command ("js-yaml") + :standard-input t :error-patterns ((error line-start - "JS-YAML: " (message) " at line " line ", column " column ":" + (or "JS-YAML" "YAMLException") ": " + (message) " at line " line ", column " column ":" line-end)) :modes yaml-mode) @@ -7496,17 +8440,13 @@ 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); \ + YAML.load(STDIN); \ rescue Exception => e; \ - STDERR.puts \"#{file_name}:#{e}\"; \ - end" source) + STDERR.puts \"stdin:#{e}\"; \ + end") + :standard-input t :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) + ((error line-start "stdin:" (zero-or-more not-newline) ":" (message) "at line " line " column " column line-end)) :modes yaml-mode) diff --git a/elpa/flycheck-20150703.359/flycheck.info b/elpa/flycheck-20160218.41/flycheck.info similarity index 84% rename from elpa/flycheck-20150703.359/flycheck.info rename to elpa/flycheck-20160218.41/flycheck.info index 3cc82f21..49afe10b 100644 --- a/elpa/flycheck-20150703.359/flycheck.info +++ b/elpa/flycheck-20160218.41/flycheck.info @@ -3,7 +3,7 @@ flycheck.texi. Modern on-the-fly syntax checking for GNU Emacs 24. - Copyright © 2014–2015 Sebastian Wiesner + 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, @@ -33,7 +33,7 @@ Flycheck Modern on-the-fly syntax checking for GNU Emacs 24. - Copyright © 2014–2015 Sebastian Wiesner + 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, @@ -70,7 +70,7 @@ guide. * 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 +* 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 @@ -118,12 +118,12 @@ 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. + 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 ========================= @@ -157,20 +157,8 @@ init file: '("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") + 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’.  File: flycheck.info, Node: Quickstart, Next: Usage, Prev: Installation, Up: Top @@ -446,7 +434,7 @@ 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 . - ‘flycheck-disable-checker’ acutally sets the buffer-local value of + ‘flycheck-disable-checker’ actually sets the buffer-local value of the ‘flycheck-disabled-checkers’ option: -- User Option: flycheck-disabled-checkers @@ -470,9 +458,6 @@ the ‘flycheck-disabled-checkers’ option: *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’. -  File: flycheck.info, Node: Reporting results, Next: Navigating errors, Prev: Syntax checkers, Up: Usage @@ -491,6 +476,8 @@ buffer: -- 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’. @@ -597,15 +584,22 @@ File: flycheck.info, Node: Displaying errors, Next: Killing errors, Prev: Nav 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. +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 set ‘flycheck-display-errors-function’ to change how Flycheck -displays error, and what information it displays: + 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 @@ -622,9 +616,23 @@ displays error, and what information it displays: 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. + 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.  File: flycheck.info, Node: Killing errors, Next: Listing errors, Prev: Displaying errors, Up: Usage @@ -676,6 +684,11 @@ error list: 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’ @@ -691,6 +704,17 @@ error list: 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. @@ -902,23 +926,28 @@ File: flycheck.info, Node: Defining syntax checkers, Next: Finding error patte 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: +for the popular Rubocop (http://batsov.com/rubocop/) tool for Ruby: - (flycheck-define-checker python-pylint - "A Python syntax and style checker using Pylint. + (flycheck-define-checker ruby-rubocop + "A Ruby syntax and style checker using the RuboCop tool. - See URL `http://www.pylint.org/'." - :command ("pylint" - "--msg-template" "{path}:{line}:{column}:{C}:{msg} ({msg_id})" - source) + 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 - ((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) + ((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. @@ -927,7 +956,7 @@ syntax checker, by which we can refer to this particular syntax checker. 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’. +ruby-rubocop’. Eventually we specify the _properties_ of the new syntax checker. These properties tell Flycheck when to use your new syntax checker, how @@ -937,18 +966,31 @@ to run it, and how to parse its output: 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. + 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. - 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. + For a complete list of all special symbols refer to the function + ‘flycheck-substitute-argument’. - Refer to the function ‘flycheck-substitute-argument’ for a complete - list of all special symbols. + • ‘: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 @@ -974,12 +1016,13 @@ to run it, and how to parse its output: • 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. + 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. ‘pylint’ checks Javascript, so the - ‘:modes’ of our example specify ‘python-mode’. + • 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’.  File: flycheck.info, Node: Finding error patterns, Next: Trying new checkers, Prev: Defining syntax checkers, Up: Syntax checker definitions @@ -1005,7 +1048,21 @@ checker: Evaluate the syntax checker definition with ‘C-M-x’ and 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. +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 @@ -1042,28 +1099,29 @@ it to ‘flycheck-checkers’: 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_. + 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*: + 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)) + (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) + (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. + 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*: + 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) + (add-to-list 'flycheck-checkers 'my-new-syntax-checker)  File: flycheck.info, Node: Parsing structured output, Next: Passing configuration to checkers, Prev: Registering new checkers, Up: Syntax checker definitions @@ -1099,13 +1157,13 @@ File: flycheck.info, Node: Passing configuration to checkers, Next: Controllin ============================================================== 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. +analysis. Flycheck makes it easy 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): + 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. @@ -1120,7 +1178,7 @@ it has a special linting mode in which all stylistic checks are disabled 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. +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 @@ -1210,9 +1268,9 @@ File: flycheck.info, Node: Applying multiple checkers, Prev: Controlling use o 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. +(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: @@ -1297,7 +1355,17 @@ 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 +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 @@ -1308,7 +1376,7 @@ Flycheck uses this hook itself: The standard value the buffer. As a consequence, you can _entirely opt out_ from highlighting with a custom hook. -6.3 Error display +6.4 Error display ================= The function ‘flycheck-display-errors-function’ is called to display an @@ -1366,23 +1434,15 @@ File: flycheck.info, Node: Errors, Prev: Command syntax checkers, Up: Flychec ==========  -File: flycheck.info, Node: Supported languages, Next: Issues, Prev: Flycheck API, Up: Top +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. 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. +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 @@ -1390,7 +1450,56 @@ 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. +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 === @@ -1476,6 +1585,11 @@ C/C++ ‘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 ======== @@ -1564,6 +1678,9 @@ Erlang ‘flycheck-erlang-include-path’ A list of include directories for Erlang. + ‘flycheck-erlang-library-path’ + A list of library directories for Erlang. + ERuby ===== @@ -1610,10 +1727,22 @@ Go ‘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 + ()) + Haml ==== @@ -1627,11 +1756,31 @@ Handlebars Haskell ======= - 1. ‘haskell-ghc’ (syntax and type checker with GHC - (http://www.haskell.org/ghc/)), and + 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: - 2. ‘haskell-hlint’ (style checker with hlint - (https://github.com/ndmitchell/hlint)) + ‘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 @@ -1671,29 +1820,32 @@ HTML 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 + 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: + 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. - - ‘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. @@ -1709,6 +1861,8 @@ 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 ==== @@ -1741,6 +1895,10 @@ Perl ‘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. @@ -1749,7 +1907,7 @@ PHP === 1. ‘php’ (syntax check with PHP CLI - (https://metacpan.org/pod/Perl::Critic)) + (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/)) @@ -1765,6 +1923,12 @@ PHP 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 ====== @@ -1772,6 +1936,14 @@ Puppet • ‘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 ====== @@ -1802,7 +1974,12 @@ Python Configuration file for Flake8. *Note Syntax checker configuration files::, for more information about configuration files. - ‘python-pylint’ reads a configuration file: + ‘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 @@ -1811,8 +1988,8 @@ Python R = - • ‘r-lintr’ (syntax and style check with lintr (jimhester/lintr)), - with the following options: + • ‘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 @@ -1822,11 +1999,6 @@ R 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 ======== @@ -1835,9 +2007,10 @@ RPM Spec 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’ (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: @@ -1869,31 +2042,35 @@ Ruby the following checkers for very basic checking: • ‘ruby’ (using the standard Ruby interpreter - (https://www.ruby-lang.org/)), + (https://www.ruby-lang.org/)), or • ‘ruby-jruby’ (using JRuby (http://jruby.org/)) Rust ==== - • ‘rust’ (using the Rust compiler (http://www.rust-lang.org/)), with - the following options: + • ‘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. + 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 library directories for Rust. Relative paths are - relative to the buffer being checked. + 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 @@ -1917,16 +2094,15 @@ Scala 2. ‘scala-scalastyle’ (style check using Scalastyle (http://www.scalastyle.org/)) - The ‘scala-scalastyle’ syntax checker needs the following options: + The ‘scala-scalastyle’ syntax checker needs the following option: -‘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. + If this option is not set, or if the configuration file was not found +‘scala-scalastyle’ will not be used. SCSS ==== @@ -1968,6 +2144,11 @@ Slim • ‘slim’ (using Slim (http://slim-lang.com/)) +SQL +=== + + • ‘sql-sqlint’ (using Sqlint (https://github.com/purcell/sqlint)) + TeX/LaTeX ========= @@ -1993,6 +2174,12 @@ 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 === @@ -2008,32 +2195,43 @@ YAML • ‘yaml-ruby’ (using Ruby’s YAML parser)  -File: flycheck.info, Node: Issues, Next: GNU Free Documentation License, Prev: Supported languages, Up: Top +File: flycheck.info, Node: Getting Help, Next: GNU Free Documentation License, Prev: Supported languages, Up: Top + +Appendix B Getting Help +*********************** -Appendix B Issues -***************** +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 +==================== -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: +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. - • 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. + 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. - Please also tell us your ideas for improvements or new features. +B.3 Conduct +=========== - 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. +Please follow our Code of Conduct (http://www.flycheck.org/conduct.html) +in all our communication channels.  -File: flycheck.info, Node: GNU Free Documentation License, Next: Main Index, Prev: Issues, Up: Top +File: flycheck.info, Node: GNU Free Documentation License, Next: Main Index, Prev: Getting Help, Up: Top Appendix C GNU Free Documentation License ***************************************** @@ -2523,100 +2721,108 @@ Main Index [index] * Menu: -* Ada language: Supported languages. (line 30) -* AsciiDoc language: Supported languages. (line 47) +* 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 52) -* cask: Installation. (line 61) -* CFEngine language: Supported languages. (line 115) +* 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 120) -* Coffeescript language: Supported languages. (line 129) +* 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 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) +* 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 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) +* 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) -* 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) +* 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 366) -* PHP language: Supported languages. (line 383) +* Perl language: Supported languages. (line 452) +* PHP language: Supported languages. (line 473) * 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) +* 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) @@ -2626,11 +2832,12 @@ Main Index (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) +* 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)  File: flycheck.info, Node: Key Index, Next: Function and Variable Index, Prev: Main Index, Up: Top @@ -2648,12 +2855,14 @@ Key Index * 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) @@ -2670,220 +2879,243 @@ Function and variable index [index] * 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 50) +* flycheck-checker-error-threshold: Reporting results. (line 52) * 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-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-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-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-messages: Displaying errors. (line 23) +* 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 26) + (line 33) * 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-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 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) + (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 41) -* flycheck-eslint-rulesdir: Supported languages. (line 321) -* flycheck-eslintrc: Supported languages. (line 323) +* 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 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-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 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-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 36) -* flycheck-info: Reporting results. (line 32) -* flycheck-jscsrc: Supported languages. (line 337) -* flycheck-jshintrc: Supported languages. (line 330) +* 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 450) -* flycheck-lintr-linters: Supported languages. (line 454) +* 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 357) +* 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 374) -* flycheck-perlcritic-severity: Supported languages. (line 377) -* flycheck-phpcs-standard: Supported languages. (line 397) -* flycheck-phpmd-rulesets: Supported languages. (line 392) +* 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-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-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 596) +* flycheck-shellcheck-excluded-warnings: Supported languages. (line 704) * flycheck-sphinx-warn-on-missing-references: Supported languages. - (line 477) + (line 582) * flycheck-standard-error-navigation: Navigating errors. (line 6) * flycheck-temp-prefix: Checking buffers. (line 71) -* flycheck-tidyrc: Supported languages. (line 302) +* flycheck-tidyrc: Supported languages. (line 383) * flycheck-verify-setup: Checking buffers. (line 63) -* flycheck-warning: Reporting results. (line 32) +* 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)  Tag Table: -Node: Top1137 -Node: Introduction3358 -Node: Installation4451 -Node: Quickstart6739 -Node: Usage9275 -Node: Checking buffers10275 -Node: Syntax checkers13099 -Node: Reporting results18498 -Node: Navigating errors20817 -Node: Displaying errors23373 -Node: Killing errors24782 -Node: Listing errors25569 -Node: Mode line display27121 -Node: Configuring checkers28434 -Ref: Syntax checker options29150 -Ref: Syntax checker configuration files30168 -Ref: Syntax checker executables33055 -Node: Syntax checker definitions34259 -Node: Defining syntax checkers35440 -Node: Finding error patterns39659 -Node: Trying new checkers41006 -Node: Registering new checkers41691 -Node: Parsing structured output43239 -Node: Passing configuration to checkers44482 -Node: Controlling use of checkers48086 -Node: Applying multiple checkers49188 -Node: Flycheck hooks52441 -Node: Flycheck API54074 -Node: Command syntax checkers54412 -Node: Argument Substitution54782 -Node: Checker configuration54952 -Node: Error parsers55164 -Node: Errors55310 -Node: Supported languages55422 -Ref: language-Ada56631 -Ref: language-AsciiDoc57255 -Ref: language-C/C++57338 -Ref: language-CFEngine59792 -Ref: language-Chef59860 -Ref: language-Coffeescript60105 -Ref: language-Coq60505 -Ref: language-CSS60561 -Ref: language-D60671 -Ref: language-Emacs Lisp61116 -Ref: language-Erlang62244 -Ref: language-ERuby62405 -Ref: language-Fortran62500 -Ref: language-Go63393 -Ref: language-Haml64143 -Ref: language-Handlebars64212 -Ref: language-Haskell64294 -Ref: language-HTML65534 -Ref: language-Javascript65843 -Ref: language-JSON67203 -Ref: language-Less67289 -Ref: language-Lua67346 -Ref: language-Perl67704 -Ref: language-PHP68239 -Ref: language-Puppet68931 -Ref: language-Python69113 -Ref: language-R70397 -Ref: language-Racket70834 -Ref: language-RPM Spec70909 -Ref: language-reStructuredText71023 -Ref: language-Ruby71412 -Ref: language-Rust72423 -Ref: language-Sass73361 -Ref: language-Scala73614 -Ref: language-SCSS74221 -Ref: language-Shell scripting languages74781 -Ref: language-Slim75517 -Ref: language-TeX/LaTeX75594 -Ref: language-Texinfo76006 -Ref: language-Verilog76101 -Ref: language-XML76206 -Ref: language-YAML76374 -Node: Issues76513 -Node: GNU Free Documentation License77534 -Node: Main Index102881 -Node: Key Index110860 -Node: Function and Variable Index112368 +Node: Top1135 +Node: Introduction3355 +Node: Installation4448 +Ref: windows-support4850 +Node: Quickstart6486 +Node: Usage9022 +Node: Checking buffers10022 +Node: Syntax checkers12846 +Node: Reporting results18128 +Node: Navigating errors20533 +Node: Displaying errors23089 +Node: Killing errors25273 +Node: Listing errors26060 +Node: Mode line display28230 +Node: Configuring checkers29543 +Ref: Syntax checker options30259 +Ref: Syntax checker configuration files31277 +Ref: Syntax checker executables34164 +Node: Syntax checker definitions35368 +Node: Defining syntax checkers36549 +Node: Finding error patterns41965 +Node: Trying new checkers44142 +Node: Registering new checkers44827 +Node: Parsing structured output46440 +Node: Passing configuration to checkers47683 +Node: Controlling use of checkers51315 +Node: Applying multiple checkers52417 +Node: Flycheck hooks55688 +Node: Flycheck API57744 +Node: Command syntax checkers58082 +Node: Argument Substitution58452 +Node: Checker configuration58622 +Node: Error parsers58834 +Node: Errors58980 +Node: Supported languages59092 +Ref: Ada60998 +Ref: AsciiDoc61612 +Ref: C/C++61701 +Ref: CFEngine64413 +Ref: Chef64489 +Ref: Coffeescript64718 +Ref: Coq65136 +Ref: CSS65192 +Ref: D65306 +Ref: Emacs Lisp65733 +Ref: Erlang66869 +Ref: ERuby67125 +Ref: Fortran67216 +Ref: Go68119 +Ref: Groovy69046 +Ref: Haml69160 +Ref: Handlebars69217 +Ref: Haskell69305 +Ref: HTML71239 +Ref: Jade71536 +Ref: Javascript71603 +Ref: JSON72962 +Ref: Less73160 +Ref: Lua73219 +Ref: Perl73575 +Ref: PHP74285 +Ref: Processing74983 +Ref: Puppet75103 +Ref: Python75602 +Ref: R77129 +Ref: RPM Spec77575 +Ref: reStructuredText77673 +Ref: Ruby78091 +Ref: Rust79105 +Ref: Sass80225 +Ref: Scala80476 +Ref: SCSS81044 +Ref: Shell scripting languages81562 +Ref: Slim82340 +Ref: SQL82407 +Ref: TeX/LaTeX82492 +Ref: Texinfo82908 +Ref: Verilog83003 +Ref: XML83326 +Ref: YAML83492 +Node: Getting Help83642 +Ref: Issues84145 +Node: GNU Free Documentation License84896 +Node: Main Index110249 +Node: Key Index118885 +Node: Function and Variable Index120539  End Tag Table diff --git a/elpa/flycheck-20160218.41/macros.info b/elpa/flycheck-20160218.41/macros.info new file mode 100644 index 00000000..4febc115 --- /dev/null +++ b/elpa/flycheck-20160218.41/macros.info @@ -0,0 +1,7 @@ +This is macros.info, produced by makeinfo version 5.2 from macros.texi. + + + +Tag Table: + +End Tag Table diff --git a/elpa/flycheck-readme.txt b/elpa/flycheck-readme.txt index c0da3ebe..dc8fa693 100644 --- a/elpa/flycheck-readme.txt +++ b/elpa/flycheck-readme.txt @@ -1,8 +1,36 @@ -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. -- 2.47.3