aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2017-09-29 11:02:36 +0100
committerJoão Távora2017-10-03 14:18:55 +0100
commitbd8ea8873d19e6885e7d6c18c112ed0020d4f744 (patch)
treeb25764850bd0c93d23a4057c194dbd5f81733c77
parent87993cdcc69d3cc21cfe3bf2ed9e0ffbd3cfe5f0 (diff)
downloademacs-bd8ea8873d19e6885e7d6c18c112ed0020d4f744.tar.gz
emacs-bd8ea8873d19e6885e7d6c18c112ed0020d4f744.zip
Batch of minor Flymake cleanup actions agreed to with Stefan
Discussed with Stefan, in no particular order - Remove aliases for symbols thought to be internal to flymake-proc.el - Don’t need :group in defcustom and defface in flymake.el - Fix docstring of flymake-make-diagnostic - Fix docstring of flymake-diagnostic-functions to clarify keywords. - Mark overlays with just the property ’flymake, not ’flymake-overlay - Tune flymake-overlays for performance - Make flymake-mode-on and flymake-mode-off obsolete - Don’t use hash-table-keys unless necessary. - Copyright notice in flymake-elisp. Added some more - Clarify docstring of flymake-goto-next-error - Clarify a comment in flymake--run-backend complaining about ert-deftest. - Prevent compilation warnings in flymake-proc.el - Remove doctring from obsolete aliases Now the changelog: * lisp/progmodes/flymake-elisp.el: Proper copyright notice. * lisp/progmodes/flymake-proc.el (flymake-warning-re) (flymake-proc-diagnostic-type-pred) (flymake-proc-default-guess) (flymake-proc--get-file-name-mode-and-masks): Move up to beginning of file to shoosh compiler warnings (define-obsolete-variable-alias): Delete many obsolete aliases. * lisp/progmodes/flymake.el (flymake-error-bitmap) (flymake-warning-bitmap, flymake-note-bitmap) (flymake-fringe-indicator-position) (flymake-start-syntax-check-on-newline) (flymake-no-changes-timeout, flymake-gui-warnings-enabled) (flymake-start-syntax-check-on-find-file, flymake-log-level) (flymake-wrap-around, flymake-error, flymake-warning) (flymake-note): Don't need :group in these defcustom and defface. (flymake--run-backend): Clarify comment (flymake-mode-map): Remove. (flymake-make-diagnostic): Fix docstring. (flymake--highlight-line, flymake--overlays): Identify flymake overlays with just ’flymake. (flymake--overlays): Reverse order of invocation for cl-remove-if-not and cl-sort. (flymake-mode-on) (flymake-mode-off): Make obsolete. (flymake-goto-next-error, flymake-goto-prev-error): Fix docstring. (flymake-diagnostic-functions): Clarify keyword arguments in docstring. Maybe squash in that one where I remove many obsoletes
-rw-r--r--lisp/progmodes/flymake-elisp.el4
-rw-r--r--lisp/progmodes/flymake-proc.el446
-rw-r--r--lisp/progmodes/flymake.el136
3 files changed, 187 insertions, 399 deletions
diff --git a/lisp/progmodes/flymake-elisp.el b/lisp/progmodes/flymake-elisp.el
index bf60f57c82d..6e7fe3142d3 100644
--- a/lisp/progmodes/flymake-elisp.el
+++ b/lisp/progmodes/flymake-elisp.el
@@ -1,9 +1,9 @@
1;;; flymake-elisp.el --- Flymake backends for emacs-lisp-mode -*- lexical-binding: t; -*- 1;;; flymake-elisp.el --- Flymake backends for emacs-lisp-mode -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2017 João Távora 3;; Copyright (C) 2003-2017 Free Software Foundation, Inc.
4 4
5;; Author: João Távora <joaotavora@gmail.com> 5;; Author: João Távora <joaotavora@gmail.com>
6;; Keywords: 6;; Keywords: languages tools
7 7
8;; This program is free software; you can redistribute it and/or modify 8;; This program is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by 9;; it under the terms of the GNU General Public License as published by
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 48d35598b72..966f358551f 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -118,6 +118,78 @@ NAME is the file name function to use, default `flymake-proc-get-real-file-name'
118(defvar flymake-proc--report-fn nil 118(defvar flymake-proc--report-fn nil
119 "If bound, function used to report back to flymake's UI.") 119 "If bound, function used to report back to flymake's UI.")
120 120
121(defun flymake-proc-reformat-err-line-patterns-from-compile-el (original-list)
122 "Grab error line patterns from ORIGINAL-LIST in compile.el format.
123Convert it to flymake internal format."
124 (let* ((converted-list '()))
125 (dolist (item original-list)
126 (setq item (cdr item))
127 (let ((regexp (nth 0 item))
128 (file (nth 1 item))
129 (line (nth 2 item))
130 (col (nth 3 item)))
131 (if (consp file) (setq file (car file)))
132 (if (consp line) (setq line (car line)))
133 (if (consp col) (setq col (car col)))
134
135 (when (not (functionp line))
136 (setq converted-list (cons (list regexp file line col) converted-list)))))
137 converted-list))
138
139(defvar flymake-proc-err-line-patterns ; regexp file-idx line-idx col-idx (optional) text-idx(optional), match-end to end of string is error text
140 (append
141 '(
142 ;; MS Visual C++ 6.0
143 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) : \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
144 1 3 nil 4)
145 ;; jikes
146 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:[0-9]+: \\(\\(Error\\|Warning\\|Caution\\|Semantic Error\\):[ \t\n]*\\(.+\\)\\)"
147 1 3 nil 4)
148 ;; MS midl
149 ("midl[ ]*:[ ]*\\(command line error .*\\)"
150 nil nil nil 1)
151 ;; MS C#
152 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\),[0-9]+): \\(\\(error\\|warning\\|fatal error\\) \\(CS[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
153 1 3 nil 4)
154 ;; perl
155 ("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
156 ;; PHP
157 ("\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil 1)
158 ;; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on input line \\([0-9]+\\)" 20 3 nil 1)
159 ;; ant/javac. Note this also matches gcc warnings!
160 (" *\\(\\[javac\\] *\\)?\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?:[ \t\n]*\\(.+\\)"
161 2 4 5 6))
162 ;; compilation-error-regexp-alist)
163 (flymake-proc-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist))
164 "Patterns for matching error/warning lines. Each pattern has the form
165\(REGEXP FILE-IDX LINE-IDX COL-IDX ERR-TEXT-IDX).
166Use `flymake-proc-reformat-err-line-patterns-from-compile-el' to add patterns
167from compile.el")
168
169(define-obsolete-variable-alias 'flymake-warning-re 'flymake-proc-diagnostic-type-pred "26.1")
170(defvar flymake-proc-diagnostic-type-pred
171 'flymake-proc-default-guess
172 "Predicate matching against diagnostic text to detect its type.
173Takes a single argument, the diagnostic's text and should return
174a value suitable for indexing
175`flymake-diagnostic-types-alist' (which see). If the returned
176value is nil, a type of `:error' is assumed. For some backward
177compatibility, if a non-nil value is returned that that doesn't
178index that alist, a type of `:warning' is assumed.
179
180Instead of a function, it can also be a string, a regular
181expression. A match indicates `:warning' type, otherwise
182`:error'")
183
184(defun flymake-proc-default-guess (text)
185 "Guess if TEXT means a warning, a note or an error."
186 (cond ((string-match "^[wW]arning" text)
187 :warning)
188 ((string-match "^[nN]ote" text)
189 :note)
190 (t
191 :error)))
192
121(defun flymake-proc--get-file-name-mode-and-masks (file-name) 193(defun flymake-proc--get-file-name-mode-and-masks (file-name)
122 "Return the corresponding entry from `flymake-proc-allowed-file-name-masks'." 194 "Return the corresponding entry from `flymake-proc-allowed-file-name-masks'."
123 (unless (stringp file-name) 195 (unless (stringp file-name)
@@ -242,10 +314,10 @@ to the beginning of the list (File.h -> File.cpp moved to top)."
242Nil means search the entire file.") 314Nil means search the entire file.")
243 315
244(defun flymake-proc--check-patch-master-file-buffer 316(defun flymake-proc--check-patch-master-file-buffer
245 (master-file-temp-buffer 317 (master-file-temp-buffer
246 master-file-name patched-master-file-name 318 master-file-name patched-master-file-name
247 source-file-name patched-source-file-name 319 source-file-name patched-source-file-name
248 include-dirs regexp) 320 include-dirs regexp)
249 "Check if MASTER-FILE-NAME is a master file for SOURCE-FILE-NAME. 321 "Check if MASTER-FILE-NAME is a master file for SOURCE-FILE-NAME.
250If yes, patch a copy of MASTER-FILE-NAME to include PATCHED-SOURCE-FILE-NAME 322If yes, patch a copy of MASTER-FILE-NAME to include PATCHED-SOURCE-FILE-NAME
251instead of SOURCE-FILE-NAME. 323instead of SOURCE-FILE-NAME.
@@ -296,7 +368,7 @@ instead of reading master file from disk."
296 (length source-file-nondir)) nil)) 368 (length source-file-nondir)) nil))
297 (flymake-log 3 "inc-name=%s" inc-name) 369 (flymake-log 3 "inc-name=%s" inc-name)
298 (when (flymake-proc--check-include source-file-name inc-name 370 (when (flymake-proc--check-include source-file-name inc-name
299 include-dirs) 371 include-dirs)
300 (setq found t) 372 (setq found t)
301 ;; replace-match is not used here as it fails in 373 ;; replace-match is not used here as it fails in
302 ;; XEmacs with 'last match not a buffer' error as 374 ;; XEmacs with 'last match not a buffer' error as
@@ -562,80 +634,8 @@ May only be called in a dynamic environment where
562 (flymake-error "Trouble telling flymake-ui about problem %s(%s)" 634 (flymake-error "Trouble telling flymake-ui about problem %s(%s)"
563 problem explanation))) 635 problem explanation)))
564 636
565(defun flymake-proc-reformat-err-line-patterns-from-compile-el (original-list)
566 "Grab error line patterns from ORIGINAL-LIST in compile.el format.
567Convert it to flymake internal format."
568 (let* ((converted-list '()))
569 (dolist (item original-list)
570 (setq item (cdr item))
571 (let ((regexp (nth 0 item))
572 (file (nth 1 item))
573 (line (nth 2 item))
574 (col (nth 3 item)))
575 (if (consp file) (setq file (car file)))
576 (if (consp line) (setq line (car line)))
577 (if (consp col) (setq col (car col)))
578
579 (when (not (functionp line))
580 (setq converted-list (cons (list regexp file line col) converted-list)))))
581 converted-list))
582
583(require 'compile) 637(require 'compile)
584 638
585(defvar flymake-proc-err-line-patterns ; regexp file-idx line-idx col-idx (optional) text-idx(optional), match-end to end of string is error text
586 (append
587 '(
588 ;; MS Visual C++ 6.0
589 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) : \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
590 1 3 nil 4)
591 ;; jikes
592 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:[0-9]+: \\(\\(Error\\|Warning\\|Caution\\|Semantic Error\\):[ \t\n]*\\(.+\\)\\)"
593 1 3 nil 4)
594 ;; MS midl
595 ("midl[ ]*:[ ]*\\(command line error .*\\)"
596 nil nil nil 1)
597 ;; MS C#
598 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\),[0-9]+): \\(\\(error\\|warning\\|fatal error\\) \\(CS[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
599 1 3 nil 4)
600 ;; perl
601 ("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
602 ;; PHP
603 ("\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil 1)
604 ;; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on input line \\([0-9]+\\)" 20 3 nil 1)
605 ;; ant/javac. Note this also matches gcc warnings!
606 (" *\\(\\[javac\\] *\\)?\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?:[ \t\n]*\\(.+\\)"
607 2 4 5 6))
608 ;; compilation-error-regexp-alist)
609 (flymake-proc-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist))
610 "Patterns for matching error/warning lines. Each pattern has the form
611\(REGEXP FILE-IDX LINE-IDX COL-IDX ERR-TEXT-IDX).
612Use `flymake-proc-reformat-err-line-patterns-from-compile-el' to add patterns
613from compile.el")
614
615(define-obsolete-variable-alias 'flymake-warning-re 'flymake-proc-diagnostic-type-pred "26.1")
616(defvar flymake-proc-diagnostic-type-pred
617 'flymake-proc-default-guess
618 "Predicate matching against diagnostic text to detect its type.
619Takes a single argument, the diagnostic's text and should return
620a value suitable for indexing
621`flymake-diagnostic-types-alist' (which see). If the returned
622value is nil, a type of `error' is assumed. For some backward
623compatibility, if a non-nil value is returned that that doesn't
624index that alist, a type of `:warning' is assumed.
625
626Instead of a function, it can also be a string, a regular
627expression. A match indicates `:warning' type, otherwise
628`:error'")
629
630(defun flymake-proc-default-guess (text)
631 "Guess if TEXT means a warning, a note or an error."
632 (cond ((string-match "^[wW]arning" text)
633 :warning)
634 ((string-match "^[nN]ote" text)
635 :note)
636 (t
637 :error)))
638
639(defun flymake-proc-get-project-include-dirs-imp (basedir) 639(defun flymake-proc-get-project-include-dirs-imp (basedir)
640 "Include dirs for the project current file belongs to." 640 "Include dirs for the project current file belongs to."
641 (if (flymake-proc--get-project-include-dirs-from-cache basedir) 641 (if (flymake-proc--get-project-include-dirs-from-cache basedir)
@@ -717,7 +717,7 @@ expression. A match indicates `:warning' type, otherwise
717(defun flymake-proc-legacy-flymake (report-fn &optional interactive) 717(defun flymake-proc-legacy-flymake (report-fn &optional interactive)
718 "Flymake backend based on the original flymake implementation. 718 "Flymake backend based on the original flymake implementation.
719This function is suitable for inclusion in 719This function is suitable for inclusion in
720`flymake-dianostic-types-alist'. For backward compatibility, it 720`flymake-diagnostic-types-alist'. For backward compatibility, it
721can also be executed interactively independently of 721can also be executed interactively independently of
722`flymake-mode'." 722`flymake-mode'."
723 ;; Interactively, behave as if flymake had invoked us through its 723 ;; Interactively, behave as if flymake had invoked us through its
@@ -764,8 +764,7 @@ can also be executed interactively independently of
764 t))))))) 764 t)))))))
765 765
766(define-obsolete-function-alias 'flymake-start-syntax-check 766(define-obsolete-function-alias 'flymake-start-syntax-check
767 'flymake-proc-legacy-flymake "26.1" 767 'flymake-proc-legacy-flymake "26.1")
768 "Flymake backend based on the original flymake implementation.")
769 768
770(defun flymake-proc--start-syntax-check-process (cmd args dir) 769(defun flymake-proc--start-syntax-check-process (cmd args dir)
771 "Start syntax check process." 770 "Start syntax check process."
@@ -1016,8 +1015,8 @@ Use CREATE-TEMP-F for creating temp copy."
1016 (if buildfile-dir 1015 (if buildfile-dir
1017 (let* ((temp-source-file-name (flymake-proc-init-create-temp-buffer-copy create-temp-f))) 1016 (let* ((temp-source-file-name (flymake-proc-init-create-temp-buffer-copy create-temp-f)))
1018 (setq args (flymake-proc--get-syntax-check-program-args temp-source-file-name buildfile-dir 1017 (setq args (flymake-proc--get-syntax-check-program-args temp-source-file-name buildfile-dir
1019 use-relative-base-dir use-relative-source 1018 use-relative-base-dir use-relative-source
1020 get-cmdline-f)))) 1019 get-cmdline-f))))
1021 args)) 1020 args))
1022 1021
1023(defun flymake-proc-simple-make-init () 1022(defun flymake-proc-simple-make-init ()
@@ -1123,291 +1122,72 @@ Use CREATE-TEMP-F for creating temp copy."
1123 1122
1124(progn 1123(progn
1125 (define-obsolete-variable-alias 'flymake-compilation-prevents-syntax-check 1124 (define-obsolete-variable-alias 'flymake-compilation-prevents-syntax-check
1126 'flymake-proc-compilation-prevents-syntax-check "26.1" 1125 'flymake-proc-compilation-prevents-syntax-check "26.1")
1127 "If non-nil, don't start syntax check if compilation is running.")
1128 (define-obsolete-variable-alias 'flymake-xml-program 1126 (define-obsolete-variable-alias 'flymake-xml-program
1129 'flymake-proc-xml-program "26.1" 1127 'flymake-proc-xml-program "26.1")
1130 "Program to use for XML validation.")
1131 (define-obsolete-variable-alias 'flymake-master-file-dirs 1128 (define-obsolete-variable-alias 'flymake-master-file-dirs
1132 'flymake-proc-master-file-dirs "26.1" 1129 'flymake-proc-master-file-dirs "26.1")
1133 "Dirs where to look for master files.")
1134 (define-obsolete-variable-alias 'flymake-master-file-count-limit 1130 (define-obsolete-variable-alias 'flymake-master-file-count-limit
1135 'flymake-proc-master-file-count-limit "26.1" 1131 'flymake-proc-master-file-count-limit "26.1"
1136 "Max number of master files to check.") 1132 "Max number of master files to check.")
1137 (define-obsolete-variable-alias 'flymake-allowed-file-name-masks 1133 (define-obsolete-variable-alias 'flymake-allowed-file-name-masks
1138 'flymake-proc-allowed-file-name-masks "26.1" 1134 'flymake-proc-allowed-file-name-masks "26.1")
1139 "Files syntax checking is allowed for.
1140This is an alist with elements of the form:
1141 REGEXP INIT [CLEANUP [NAME]]
1142REGEXP is a regular expression that matches a file name.
1143INIT is the init function to use.
1144CLEANUP is the cleanup function to use, default `flymake-simple-cleanup'.
1145NAME is the file name function to use, default `flymake-get-real-file-name'.")
1146 (define-obsolete-variable-alias 'flymake-processes
1147 'flymake-proc--processes "26.1"
1148 "List of currently active flymake processes.")
1149 (define-obsolete-function-alias 'flymake-get-file-name-mode-and-masks
1150 'flymake-proc--get-file-name-mode-and-masks "26.1"
1151 "Return the corresponding entry from ‘flymake-allowed-file-name-masks’.")
1152 (define-obsolete-function-alias 'flymake-get-init-function
1153 'flymake-proc--get-init-function "26.1"
1154 "Return init function to be used for the file.")
1155 (define-obsolete-function-alias 'flymake-get-cleanup-function
1156 'flymake-proc--get-cleanup-function "26.1"
1157 "Return cleanup function to be used for the file.")
1158 (define-obsolete-function-alias 'flymake-get-real-file-name-function
1159 'flymake-proc--get-real-file-name-function "26.1"
1160 nil)
1161 (define-obsolete-variable-alias 'flymake-find-buildfile-cache
1162 'flymake-proc--find-buildfile-cache "26.1"
1163 nil)
1164 (define-obsolete-function-alias 'flymake-get-buildfile-from-cache
1165 'flymake-proc--get-buildfile-from-cache "26.1"
1166 "Look up DIR-NAME in cache and return its associated value.
1167If DIR-NAME is not found, return nil.")
1168 (define-obsolete-function-alias 'flymake-add-buildfile-to-cache
1169 'flymake-proc--add-buildfile-to-cache "26.1"
1170 "Associate DIR-NAME with BUILDFILE in the buildfile cache.")
1171 (define-obsolete-function-alias 'flymake-clear-buildfile-cache
1172 'flymake-proc--clear-buildfile-cache "26.1"
1173 "Clear the buildfile cache.")
1174 (define-obsolete-function-alias 'flymake-find-buildfile
1175 'flymake-proc--find-buildfile "26.1"
1176 "Find buildfile starting from current directory.
1177Buildfile includes Makefile, build.xml etc.
1178Return its file name if found, or nil if not found.")
1179 (define-obsolete-function-alias 'flymake-fix-file-name
1180 'flymake-proc--fix-file-name "26.1"
1181 "Replace all occurrences of ‘\\’ with ‘/’.")
1182 (define-obsolete-function-alias 'flymake-same-files
1183 'flymake-proc--same-files "26.1"
1184 "Check if FILE-NAME-ONE and FILE-NAME-TWO point to same file.
1185Return t if so, nil if not.
1186
1187(fn FILE-NAME-ONE FILE-NAME-TWO)")
1188 (define-obsolete-variable-alias 'flymake-included-file-name\)
1189 'flymake-proc--included-file-name\) "26.1"
1190 nil)
1191 (define-obsolete-function-alias 'flymake-find-possible-master-files
1192 'flymake-proc--find-possible-master-files "26.1"
1193 "Find (by name and location) all possible master files.
1194
1195Name is specified by FILE-NAME and location is specified by
1196MASTER-FILE-DIRS. Master files include .cpp and .c for .h.
1197Files are searched for starting from the .h directory and max
1198max-level parent dirs. File contents are not checked.")
1199 (define-obsolete-function-alias 'flymake-master-file-compare
1200 'flymake-proc--master-file-compare "26.1"
1201 "Compare two files specified by FILE-ONE and FILE-TWO.
1202This function is used in sort to move most possible file names
1203to the beginning of the list (File.h -> File.cpp moved to top).")
1204 (define-obsolete-variable-alias 'flymake-check-file-limit 1135 (define-obsolete-variable-alias 'flymake-check-file-limit
1205 'flymake-proc-check-file-limit "26.1" 1136 'flymake-proc-check-file-limit "26.1")
1206 "Maximum number of chars to look at when checking possible master file.
1207Nil means search the entire file.")
1208 (define-obsolete-function-alias 'flymake-check-patch-master-file-buffer
1209 'flymake-proc--check-patch-master-file-buffer "26.1"
1210 "Check if MASTER-FILE-NAME is a master file for SOURCE-FILE-NAME.
1211If yes, patch a copy of MASTER-FILE-NAME to include PATCHED-SOURCE-FILE-NAME
1212instead of SOURCE-FILE-NAME.
1213
1214For example, foo.cpp is a master file if it includes foo.h.
1215
1216When a buffer for MASTER-FILE-NAME exists, use it as a source
1217instead of reading master file from disk.")
1218 (define-obsolete-function-alias 'flymake-replace-region
1219 'flymake-proc--replace-region "26.1"
1220 "Replace text in BUFFER in region (BEG END) with REP.")
1221 (define-obsolete-function-alias 'flymake-read-file-to-temp-buffer
1222 'flymake-proc--read-file-to-temp-buffer "26.1"
1223 "Insert contents of FILE-NAME into newly created temp buffer.")
1224 (define-obsolete-function-alias 'flymake-copy-buffer-to-temp-buffer
1225 'flymake-proc--copy-buffer-to-temp-buffer "26.1"
1226 "Copy contents of BUFFER into newly created temp buffer.")
1227 (define-obsolete-function-alias 'flymake-check-include
1228 'flymake-proc--check-include "26.1"
1229 "Check if SOURCE-FILE-NAME can be found in include path.
1230Return t if it can be found via include path using INC-NAME.")
1231 (define-obsolete-function-alias 'flymake-find-buffer-for-file
1232 'flymake-proc--find-buffer-for-file "26.1"
1233 "Check if there exists a buffer visiting FILE-NAME.
1234Return t if so, nil if not.")
1235 (define-obsolete-function-alias 'flymake-create-master-file
1236 'flymake-proc--create-master-file "26.1"
1237 "Save SOURCE-FILE-NAME with a different name.
1238Find master file, patch and save it.")
1239 (define-obsolete-function-alias 'flymake-save-buffer-in-file
1240 'flymake-proc--save-buffer-in-file "26.1"
1241 "Save the entire buffer contents into file FILE-NAME.
1242Create parent directories as needed.")
1243 (define-obsolete-function-alias 'flymake-process-filter
1244 'flymake-proc--process-filter "26.1"
1245 "Parse OUTPUT and highlight error lines.
1246It’s flymake process filter.")
1247 (define-obsolete-function-alias 'flymake-process-sentinel
1248 'flymake-proc--process-sentinel "26.1"
1249 "Sentinel for syntax check buffers.")
1250 (define-obsolete-function-alias 'flymake-post-syntax-check
1251 'flymake-proc--post-syntax-check "26.1"
1252 nil)
1253 (define-obsolete-function-alias 'flymake-reformat-err-line-patterns-from-compile-el 1137 (define-obsolete-function-alias 'flymake-reformat-err-line-patterns-from-compile-el
1254 'flymake-proc-reformat-err-line-patterns-from-compile-el "26.1" 1138 'flymake-proc-reformat-err-line-patterns-from-compile-el "26.1")
1255 "Grab error line patterns from ORIGINAL-LIST in compile.el format.
1256Convert it to flymake internal format.")
1257 (define-obsolete-variable-alias 'flymake-err-line-patterns 1139 (define-obsolete-variable-alias 'flymake-err-line-patterns
1258 'flymake-proc-err-line-patterns "26.1" 1140 'flymake-proc-err-line-patterns "26.1")
1259 "Patterns for matching error/warning lines. Each pattern has the form
1260(REGEXP FILE-IDX LINE-IDX COL-IDX ERR-TEXT-IDX).
1261Use `flymake-reformat-err-line-patterns-from-compile-el' to add patterns
1262from compile.el")
1263 (define-obsolete-function-alias 'flymake-parse-line 1141 (define-obsolete-function-alias 'flymake-parse-line
1264 'flymake-proc-parse-line "26.1" 1142 'flymake-proc-parse-line "26.1")
1265 "Parse LINE to see if it is an error or warning.
1266Return its components if so, nil otherwise.")
1267 (define-obsolete-function-alias 'flymake-get-project-include-dirs-imp
1268 'flymake-proc--get-project-include-dirs-imp "26.1"
1269 "Include dirs for the project current file belongs to.")
1270 (define-obsolete-variable-alias 'flymake-get-project-include-dirs-function
1271 'flymake-proc--get-project-include-dirs-function "26.1"
1272 "Function used to get project include dirs, one parameter: basedir name.")
1273 (define-obsolete-function-alias 'flymake-get-project-include-dirs
1274 'flymake-proc--get-project-include-dirs "26.1"
1275 nil)
1276 (define-obsolete-function-alias 'flymake-get-system-include-dirs
1277 'flymake-proc--get-system-include-dirs "26.1"
1278 "System include dirs - from the ‘INCLUDE’ env setting.")
1279 (define-obsolete-variable-alias 'flymake-project-include-dirs-cache
1280 'flymake-proc--project-include-dirs-cache "26.1"
1281 nil)
1282 (define-obsolete-function-alias 'flymake-add-project-include-dirs-to-cache
1283 'flymake-proc--add-project-include-dirs-to-cache "26.1"
1284 nil)
1285 (define-obsolete-function-alias 'flymake-clear-project-include-dirs-cache
1286 'flymake-proc--clear-project-include-dirs-cache "26.1"
1287 nil)
1288 (define-obsolete-function-alias 'flymake-get-include-dirs 1143 (define-obsolete-function-alias 'flymake-get-include-dirs
1289 'flymake-proc-get-include-dirs "26.1" 1144 'flymake-proc-get-include-dirs "26.1")
1290 "Get dirs to use when resolving local file names.")
1291 (define-obsolete-variable-alias 'flymake-restore-formatting
1292 'flymake-proc--restore-formatting "26.1"
1293 nil)
1294 (define-obsolete-variable-alias 'flymake-get-program-dir
1295 'flymake-proc--get-program-dir "26.1"
1296 nil)
1297 (define-obsolete-function-alias 'flymake-safe-delete-file
1298 'flymake-proc--safe-delete-file "26.1"
1299 nil)
1300 (define-obsolete-function-alias 'flymake-safe-delete-directory
1301 'flymake-proc--safe-delete-directory "26.1"
1302 nil)
1303 (define-obsolete-function-alias 'flymake-stop-all-syntax-checks 1145 (define-obsolete-function-alias 'flymake-stop-all-syntax-checks
1304 'flymake-proc-stop-all-syntax-checks "26.1" 1146 'flymake-proc-stop-all-syntax-checks "26.1")
1305 "Kill all syntax check processes.")
1306 (define-obsolete-function-alias 'flymake-compilation-is-running
1307 'flymake-proc--compilation-is-running "26.1"
1308 nil)
1309 (define-obsolete-function-alias 'flymake-compile 1147 (define-obsolete-function-alias 'flymake-compile
1310 'flymake-proc-compile "26.1" 1148 'flymake-proc-compile "26.1")
1311 "Kill all flymake syntax checks, start compilation.")
1312 (define-obsolete-function-alias 'flymake-create-temp-inplace 1149 (define-obsolete-function-alias 'flymake-create-temp-inplace
1313 'flymake-proc-create-temp-inplace "26.1" 1150 'flymake-proc-create-temp-inplace "26.1")
1314 nil)
1315 (define-obsolete-function-alias 'flymake-create-temp-with-folder-structure 1151 (define-obsolete-function-alias 'flymake-create-temp-with-folder-structure
1316 'flymake-proc-create-temp-with-folder-structure "26.1" 1152 'flymake-proc-create-temp-with-folder-structure "26.1")
1317 nil)
1318 (define-obsolete-function-alias 'flymake-delete-temp-directory
1319 'flymake-proc--delete-temp-directory "26.1"
1320 "Attempt to delete temp dir created by ‘flymake-create-temp-with-folder-structure’, do not fail on error.")
1321 (define-obsolete-variable-alias 'flymake-temp-source-file-name
1322 'flymake-proc--temp-source-file-name "26.1"
1323 nil)
1324 (define-obsolete-variable-alias 'flymake-master-file-name
1325 'flymake-proc--master-file-name "26.1"
1326 nil)
1327 (define-obsolete-variable-alias 'flymake-temp-master-file-name
1328 'flymake-proc--temp-master-file-name "26.1"
1329 nil)
1330 (define-obsolete-variable-alias 'flymake-base-dir
1331 'flymake-proc--base-dir "26.1"
1332 nil)
1333 (define-obsolete-function-alias 'flymake-init-create-temp-buffer-copy 1153 (define-obsolete-function-alias 'flymake-init-create-temp-buffer-copy
1334 'flymake-proc-init-create-temp-buffer-copy "26.1" 1154 'flymake-proc-init-create-temp-buffer-copy "26.1")
1335 "Make a temporary copy of the current buffer, save its name in buffer data and return the name.")
1336 (define-obsolete-function-alias 'flymake-simple-cleanup 1155 (define-obsolete-function-alias 'flymake-simple-cleanup
1337 'flymake-proc-simple-cleanup "26.1" 1156 'flymake-proc-simple-cleanup "26.1")
1338 "Do cleanup after ‘flymake-init-create-temp-buffer-copy’.
1339Delete temp file.")
1340 (define-obsolete-function-alias 'flymake-get-real-file-name 1157 (define-obsolete-function-alias 'flymake-get-real-file-name
1341 'flymake-proc-get-real-file-name "26.1" 1158 'flymake-proc-get-real-file-name "26.1")
1342 "Translate file name from error message to \"real\" file name.
1343Return full-name. Names are real, not patched.")
1344 (define-obsolete-function-alias 'flymake-get-full-patched-file-name
1345 'flymake-proc--get-full-patched-file-name "26.1"
1346 nil)
1347 (define-obsolete-function-alias 'flymake-get-full-nonpatched-file-name
1348 'flymake-proc--get-full-nonpatched-file-name "26.1"
1349 nil)
1350 (define-obsolete-function-alias 'flymake-init-find-buildfile-dir
1351 'flymake-proc--init-find-buildfile-dir "26.1"
1352 "Find buildfile, store its dir in buffer data and return its dir, if found.")
1353 (define-obsolete-function-alias 'flymake-init-create-temp-source-and-master-buffer-copy
1354 'flymake-proc--init-create-temp-source-and-master-buffer-copy "26.1"
1355 "Find master file (or buffer), create its copy along with a copy of the source file.")
1356 (define-obsolete-function-alias 'flymake-master-cleanup 1159 (define-obsolete-function-alias 'flymake-master-cleanup
1357 'flymake-proc-master-cleanup "26.1" 1160 'flymake-proc-master-cleanup "26.1")
1358 nil)
1359 (define-obsolete-function-alias 'flymake-get-syntax-check-program-args
1360 'flymake-proc--get-syntax-check-program-args "26.1"
1361 "Create a command line for syntax check using GET-CMD-LINE-F.")
1362 (define-obsolete-function-alias 'flymake-get-make-cmdline 1161 (define-obsolete-function-alias 'flymake-get-make-cmdline
1363 'flymake-proc-get-make-cmdline "26.1" 1162 'flymake-proc-get-make-cmdline "26.1")
1364 nil)
1365 (define-obsolete-function-alias 'flymake-get-ant-cmdline 1163 (define-obsolete-function-alias 'flymake-get-ant-cmdline
1366 'flymake-proc-get-ant-cmdline "26.1" 1164 'flymake-proc-get-ant-cmdline "26.1")
1367 nil)
1368 (define-obsolete-function-alias 'flymake-simple-make-init-impl 1165 (define-obsolete-function-alias 'flymake-simple-make-init-impl
1369 'flymake-proc-simple-make-init-impl "26.1" 1166 'flymake-proc-simple-make-init-impl "26.1")
1370 "Create syntax check command line for a directly checked source file.
1371Use CREATE-TEMP-F for creating temp copy.")
1372 (define-obsolete-function-alias 'flymake-simple-make-init 1167 (define-obsolete-function-alias 'flymake-simple-make-init
1373 'flymake-proc-simple-make-init "26.1" 1168 'flymake-proc-simple-make-init "26.1")
1374 nil)
1375 (define-obsolete-function-alias 'flymake-master-make-init 1169 (define-obsolete-function-alias 'flymake-master-make-init
1376 'flymake-proc-master-make-init "26.1" 1170 'flymake-proc-master-make-init "26.1")
1377 "Create make command line for a source file checked via master file compilation.")
1378 (define-obsolete-function-alias 'flymake-find-make-buildfile 1171 (define-obsolete-function-alias 'flymake-find-make-buildfile
1379 'flymake-proc--find-make-buildfile "26.1" 1172 'flymake-proc--find-make-buildfile "26.1")
1380 nil)
1381 (define-obsolete-function-alias 'flymake-master-make-header-init 1173 (define-obsolete-function-alias 'flymake-master-make-header-init
1382 'flymake-proc-master-make-header-init "26.1" 1174 'flymake-proc-master-make-header-init "26.1")
1383 nil)
1384 (define-obsolete-function-alias 'flymake-simple-make-java-init 1175 (define-obsolete-function-alias 'flymake-simple-make-java-init
1385 'flymake-proc-simple-make-java-init "26.1" 1176 'flymake-proc-simple-make-java-init "26.1")
1386 nil)
1387 (define-obsolete-function-alias 'flymake-simple-ant-java-init 1177 (define-obsolete-function-alias 'flymake-simple-ant-java-init
1388 'flymake-proc-simple-ant-java-init "26.1" 1178 'flymake-proc-simple-ant-java-init "26.1")
1389 nil)
1390 (define-obsolete-function-alias 'flymake-simple-java-cleanup 1179 (define-obsolete-function-alias 'flymake-simple-java-cleanup
1391 'flymake-proc-simple-java-cleanup "26.1" 1180 'flymake-proc-simple-java-cleanup "26.1")
1392 "Cleanup after ‘flymake-simple-make-java-init’ -- delete temp file and dirs.")
1393 (define-obsolete-function-alias 'flymake-perl-init 1181 (define-obsolete-function-alias 'flymake-perl-init
1394 'flymake-proc-perl-init "26.1" 1182 'flymake-proc-perl-init "26.1")
1395 nil)
1396 (define-obsolete-function-alias 'flymake-php-init 1183 (define-obsolete-function-alias 'flymake-php-init
1397 'flymake-proc-php-init "26.1" 1184 'flymake-proc-php-init "26.1")
1398 nil)
1399 (define-obsolete-function-alias 'flymake-get-tex-args
1400 'flymake-proc--get-tex-args "26.1"
1401 nil)
1402 (define-obsolete-function-alias 'flymake-simple-tex-init 1185 (define-obsolete-function-alias 'flymake-simple-tex-init
1403 'flymake-proc-simple-tex-init "26.1" 1186 'flymake-proc-simple-tex-init "26.1")
1404 nil)
1405 (define-obsolete-function-alias 'flymake-master-tex-init 1187 (define-obsolete-function-alias 'flymake-master-tex-init
1406 'flymake-proc-master-tex-init "26.1" 1188 'flymake-proc-master-tex-init "26.1")
1407 nil)
1408 (define-obsolete-function-alias 'flymake-xml-init 1189 (define-obsolete-function-alias 'flymake-xml-init
1409 'flymake-proc-xml-init "26.1" 1190 'flymake-proc-xml-init "26.1"))
1410 nil))
1411 1191
1412 1192
1413 1193
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index c628b4e8248..3387f47ed1e 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -36,7 +36,7 @@
36(require 'thingatpt) ; end-of-thing 36(require 'thingatpt) ; end-of-thing
37(require 'warnings) ; warning-numeric-level, display-warning 37(require 'warnings) ; warning-numeric-level, display-warning
38(require 'compile) ; for some faces 38(require 'compile) ; for some faces
39(eval-when-compile (require 'subr-x)) ; when-let*, if-let*, hash-table-keys 39(eval-when-compile (require 'subr-x)) ; when-let*, if-let*
40 40
41(defgroup flymake nil 41(defgroup flymake nil
42 "Universal on-the-fly syntax checker." 42 "Universal on-the-fly syntax checker."
@@ -53,7 +53,6 @@ symbols, see `fringe-bitmaps'. See also `flymake-warning-bitmap'.
53 53
54The option `flymake-fringe-indicator-position' controls how and where 54The option `flymake-fringe-indicator-position' controls how and where
55this is used." 55this is used."
56 :group 'flymake
57 :version "24.3" 56 :version "24.3"
58 :type '(choice (symbol :tag "Bitmap") 57 :type '(choice (symbol :tag "Bitmap")
59 (list :tag "Bitmap and face" 58 (list :tag "Bitmap and face"
@@ -68,7 +67,6 @@ symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'.
68 67
69The option `flymake-fringe-indicator-position' controls how and where 68The option `flymake-fringe-indicator-position' controls how and where
70this is used." 69this is used."
71 :group 'flymake
72 :version "24.3" 70 :version "24.3"
73 :type '(choice (symbol :tag "Bitmap") 71 :type '(choice (symbol :tag "Bitmap")
74 (list :tag "Bitmap and face" 72 (list :tag "Bitmap and face"
@@ -83,7 +81,6 @@ symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'.
83 81
84The option `flymake-fringe-indicator-position' controls how and where 82The option `flymake-fringe-indicator-position' controls how and where
85this is used." 83this is used."
86 :group 'flymake
87 :version "26.1" 84 :version "26.1"
88 :type '(choice (symbol :tag "Bitmap") 85 :type '(choice (symbol :tag "Bitmap")
89 (list :tag "Bitmap and face" 86 (list :tag "Bitmap and face"
@@ -94,7 +91,6 @@ this is used."
94 "The position to put flymake fringe indicator. 91 "The position to put flymake fringe indicator.
95The value can be nil (do not use indicators), `left-fringe' or `right-fringe'. 92The value can be nil (do not use indicators), `left-fringe' or `right-fringe'.
96See `flymake-error-bitmap' and `flymake-warning-bitmap'." 93See `flymake-error-bitmap' and `flymake-warning-bitmap'."
97 :group 'flymake
98 :version "24.3" 94 :version "24.3"
99 :type '(choice (const left-fringe) 95 :type '(choice (const left-fringe)
100 (const right-fringe) 96 (const right-fringe)
@@ -102,24 +98,20 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
102 98
103(defcustom flymake-start-syntax-check-on-newline t 99(defcustom flymake-start-syntax-check-on-newline t
104 "Start syntax check if newline char was added/removed from the buffer." 100 "Start syntax check if newline char was added/removed from the buffer."
105 :group 'flymake
106 :type 'boolean) 101 :type 'boolean)
107 102
108(defcustom flymake-no-changes-timeout 0.5 103(defcustom flymake-no-changes-timeout 0.5
109 "Time to wait after last change before starting compilation." 104 "Time to wait after last change before starting compilation."
110 :group 'flymake
111 :type 'number) 105 :type 'number)
112 106
113(defcustom flymake-gui-warnings-enabled t 107(defcustom flymake-gui-warnings-enabled t
114 "Enables/disables GUI warnings." 108 "Enables/disables GUI warnings."
115 :group 'flymake
116 :type 'boolean) 109 :type 'boolean)
117(make-obsolete-variable 'flymake-gui-warnings-enabled 110(make-obsolete-variable 'flymake-gui-warnings-enabled
118 "it no longer has any effect." "26.1") 111 "it no longer has any effect." "26.1")
119 112
120(defcustom flymake-start-syntax-check-on-find-file t 113(defcustom flymake-start-syntax-check-on-find-file t
121 "Start syntax check on find file." 114 "Start syntax check on find file."
122 :group 'flymake
123 :type 'boolean) 115 :type 'boolean)
124 116
125(defcustom flymake-log-level -1 117(defcustom flymake-log-level -1
@@ -131,7 +123,7 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
131 123
132(defcustom flymake-wrap-around t 124(defcustom flymake-wrap-around t
133 "If non-nil, moving to errors wraps around buffer boundaries." 125 "If non-nil, moving to errors wraps around buffer boundaries."
134 :group 'flymake :type 'boolean) 126 :type 'boolean)
135 127
136(define-fringe-bitmap 'flymake-double-exclamation-mark 128(define-fringe-bitmap 'flymake-double-exclamation-mark
137 (vector #b00000000 129 (vector #b00000000
@@ -210,7 +202,7 @@ generated it."
210 end 202 end
211 type 203 type
212 text) 204 text)
213 "Mark BUFFER's region from BEG to END with a flymake diagnostic. 205 "Make a flymake diagnostic for BUFFER's region from BEG to END.
214TYPE is a key to `flymake-diagnostic-types-alist' and TEXT is a 206TYPE is a key to `flymake-diagnostic-types-alist' and TEXT is a
215description of the problem detected in this region." 207description of the problem detected in this region."
216 (flymake--diag-make :buffer buffer :beg beg :end end :type type :text text)) 208 (flymake--diag-make :buffer buffer :beg beg :end end :type type :text text))
@@ -231,23 +223,22 @@ description of the problem detected in this region."
231If BEG is non-nil and END is nil, consider only `overlays-at' 223If BEG is non-nil and END is nil, consider only `overlays-at'
232BEG. Otherwise consider `overlays-in' the region comprised by BEG 224BEG. Otherwise consider `overlays-in' the region comprised by BEG
233and END, defaulting to the whole buffer. Remove all that do not 225and END, defaulting to the whole buffer. Remove all that do not
234verify FILTER, sort them by COMPARE (using KEY)." 226verify FILTER, a function, and sort them by COMPARE (using KEY)."
235 (cl-remove-if-not 227 (save-restriction
236 (lambda (ov) 228 (widen)
237 (and (overlay-get ov 'flymake-overlay) 229 (let ((ovs (cl-remove-if-not
238 (or (not filter) 230 (lambda (ov)
239 (cond ((functionp filter) (funcall filter ov)) 231 (and (overlay-get ov 'flymake)
240 ((symbolp filter) (overlay-get ov filter)))))) 232 (or (not filter)
241 (save-restriction 233 (funcall filter ov))))
242 (widen) 234 (if (and beg (null end))
243 (let ((ovs (if (and beg (null end))
244 (overlays-at beg t) 235 (overlays-at beg t)
245 (overlays-in (or beg (point-min)) 236 (overlays-in (or beg (point-min))
246 (or end (point-max)))))) 237 (or end (point-max)))))))
247 (if compare 238 (if compare
248 (cl-sort ovs compare :key (or key 239 (cl-sort ovs compare :key (or key
249 #'identity)) 240 #'identity))
250 ovs))))) 241 ovs))))
251 242
252(defun flymake-delete-own-overlays (&optional filter) 243(defun flymake-delete-own-overlays (&optional filter)
253 "Delete all flymake overlays in BUFFER." 244 "Delete all flymake overlays in BUFFER."
@@ -259,8 +250,7 @@ verify FILTER, sort them by COMPARE (using KEY)."
259 (t 250 (t
260 :inherit error)) 251 :inherit error))
261 "Face used for marking error regions." 252 "Face used for marking error regions."
262 :version "24.4" 253 :version "24.4")
263 :group 'flymake)
264 254
265(defface flymake-warning 255(defface flymake-warning
266 '((((supports :underline (:style wave))) 256 '((((supports :underline (:style wave)))
@@ -268,8 +258,7 @@ verify FILTER, sort them by COMPARE (using KEY)."
268 (t 258 (t
269 :inherit warning)) 259 :inherit warning))
270 "Face used for marking warning regions." 260 "Face used for marking warning regions."
271 :version "24.4" 261 :version "24.4")
272 :group 'flymake)
273 262
274(defface flymake-note 263(defface flymake-note
275 '((((supports :underline (:style wave))) 264 '((((supports :underline (:style wave)))
@@ -277,8 +266,7 @@ verify FILTER, sort them by COMPARE (using KEY)."
277 (t 266 (t
278 :inherit warning)) 267 :inherit warning))
279 "Face used for marking note regions." 268 "Face used for marking note regions."
280 :version "26.1" 269 :version "26.1")
281 :group 'flymake)
282 270
283(define-obsolete-face-alias 'flymake-warnline 'flymake-warning "26.1") 271(define-obsolete-face-alias 'flymake-warnline 'flymake-warning "26.1")
284(define-obsolete-face-alias 'flymake-errline 'flymake-error "26.1") 272(define-obsolete-face-alias 'flymake-errline 'flymake-error "26.1")
@@ -324,7 +312,7 @@ Return nil if the region is invalid."
324 "List of flymake backends i.e. sources of flymake diagnostics. 312 "List of flymake backends i.e. sources of flymake diagnostics.
325 313
326This variable holds an arbitrary number of \"backends\" or 314This variable holds an arbitrary number of \"backends\" or
327\"checkers\" providing the flymake UI's \"frontend\" with 315\"checkers\" providing the flymake user interface with
328information about where and how to annotate problems diagnosed in 316information about where and how to annotate problems diagnosed in
329a buffer. 317a buffer.
330 318
@@ -340,19 +328,23 @@ start checking the buffer):
340 backend for the current check, but will call it again the next 328 backend for the current check, but will call it again the next
341 time; 329 time;
342 330
343* If the backend function returns non-nil, flymake expects this backend to 331* If the backend function returns non-nil, flymake expects this
344 check the buffer and call its REPORT-FN callback function. If 332 backend to check the buffer and call its REPORT-FN callback
345 the computation involved is inexpensive, the backend function 333 function exactly once. If the computation involved is
346 may do so synchronously before returning. If it is not, it may 334 inexpensive, the backend function may do so synchronously
347 do so after retuning, using idle timers, asynchronous 335 before returning. If it is not, it may do so after returning,
348 processes or other asynchronous mechanisms. 336 using idle timers, asynchronous processes or other asynchronous
337 mechanisms.
349 338
350* If the backend function signals an error, it is disabled, i.e. flymake 339* If the backend function signals an error, it is disabled,
351 will not attempt it again for this buffer until `flymake-mode' 340 i.e. flymake will not attempt it again for this buffer until
352 is turned off and on again. 341 `flymake-mode' is turned off and on again.
353 342
354When calling REPORT-FN, the first argument passed to it decides 343Backends are required to call REPORT-FN with a single argument
355how to proceed. Recognized values are: 344ACTION followed by an optional list of keywords parameters and
345their values (:KEY1 VALUE1 :KEY2 VALUE2...).
346
347The possible values for ACTION are.
356 348
357* A (possibly empty) list of objects created with 349* A (possibly empty) list of objects created with
358 `flymake-make-diagnostic', causing flymake to annotate the 350 `flymake-make-diagnostic', causing flymake to annotate the
@@ -365,9 +357,13 @@ how to proceed. Recognized values are:
365* The symbol `:panic', signalling that the backend has 357* The symbol `:panic', signalling that the backend has
366 encountered an exceptional situation and should be disabled. 358 encountered an exceptional situation and should be disabled.
367 359
368In the latter cases, it is also possible to provide REPORT-FN 360The recognized optional keyword arguments are:
369with a string as the keyword argument `:explanation'. The string 361
370should give human-readable details of the situation.") 362* ‘:explanation’: value should give user-readable details of
363 the situation encountered, if any.
364
365* ‘:force’: value should be a boolean forcing the flymake UI
366 to consider the report even if was somehow unexpected.")
371 367
372(defvar flymake-diagnostic-types-alist 368(defvar flymake-diagnostic-types-alist
373 `((:error 369 `((:error
@@ -492,7 +488,7 @@ associated `flymake-category' return DEFAULT."
492 ;; Some properties can't be overriden 488 ;; Some properties can't be overriden
493 ;; 489 ;;
494 (overlay-put ov 'evaporate t) 490 (overlay-put ov 'evaporate t)
495 (overlay-put ov 'flymake-overlay t) 491 (overlay-put ov 'flymake t)
496 (overlay-put ov 'flymake--diagnostic diagnostic))) 492 (overlay-put ov 'flymake--diagnostic diagnostic)))
497 493
498(defun flymake-on-timer-event (buffer) 494(defun flymake-on-timer-event (buffer)
@@ -589,9 +585,9 @@ sources."
589 "Run the backend BACKEND." 585 "Run the backend BACKEND."
590 (push backend flymake--running-backends) 586 (push backend flymake--running-backends)
591 (remhash backend flymake--diagnostics-table) 587 (remhash backend flymake--diagnostics-table)
592 ;; FIXME: Should use `condition-case-unless-debug' 588 ;; FIXME: Should use `condition-case-unless-debug' here, but that
593 ;; here, but that won't let me catch errors during 589 ;; won't let me catch errors from inside `ert-deftest' where
594 ;; testing where `debug-on-error' is always t 590 ;; `debug-on-error' is always t
595 (condition-case err 591 (condition-case err
596 (unless (funcall backend 592 (unless (funcall backend
597 (flymake-make-report-fn backend)) 593 (flymake-make-report-fn backend))
@@ -682,6 +678,9 @@ backends."
682 "Turn flymake mode off." 678 "Turn flymake mode off."
683 (flymake-mode 0)) 679 (flymake-mode 0))
684 680
681(make-obsolete 'flymake-mode-on 'flymake-mode "26.1")
682(make-obsolete 'flymake-mode-off 'flymake-mode "26.1")
683
685(defun flymake-after-change-function (start stop _len) 684(defun flymake-after-change-function (start stop _len)
686 "Start syntax check for current buffer if it isn't already running." 685 "Start syntax check for current buffer if it isn't already running."
687 (let((new-text (buffer-substring start stop))) 686 (let((new-text (buffer-substring start stop)))
@@ -709,14 +708,19 @@ backends."
709 708
710(defun flymake-goto-next-error (&optional n filter interactive) 709(defun flymake-goto-next-error (&optional n filter interactive)
711 "Go to Nth next flymake error in buffer matching FILTER. 710 "Go to Nth next flymake error in buffer matching FILTER.
711
712Interactively, always move to the next error. Interactively, and
713with a prefix arg, skip any diagnostics with a severity less than
714‘:warning’.
715
716If ‘flymake-wrap-around’ is non-nil, resumes search from top
717at end of buffer.
718
712FILTER is a list of diagnostic types found in 719FILTER is a list of diagnostic types found in
713`flymake-diagnostic-types-alist', or nil, if no filter is to be 720`flymake-diagnostic-types-alist', or nil, if no filter is to be
714applied. 721applied."
715 722 ;; TODO: let filter be a number, a severity below which diags are
716Interactively, always goes to the next error. Also 723 ;; skipped.
717interactively, FILTER is determined by the prefix arg. With no
718prefix arg, don't use a filter, otherwise only consider
719diagnostics of type `:error' and `:warning'."
720 (interactive (list 1 724 (interactive (list 1
721 (if current-prefix-arg 725 (if current-prefix-arg
722 '(:error :warning)) 726 '(:error :warning))
@@ -760,14 +764,17 @@ diagnostics of type `:error' and `:warning'."
760 764
761(defun flymake-goto-prev-error (&optional n filter interactive) 765(defun flymake-goto-prev-error (&optional n filter interactive)
762 "Go to Nth previous flymake error in buffer matching FILTER. 766 "Go to Nth previous flymake error in buffer matching FILTER.
767
768Interactively, always move to the previous error. Interactively,
769and with a prefix arg, skip any diagnostics with a severity less
770than ‘:warning’.
771
772If ‘flymake-wrap-around’ is non-nil, resumes search from top
773at end of buffer.
774
763FILTER is a list of diagnostic types found in 775FILTER is a list of diagnostic types found in
764`flymake-diagnostic-types-alist', or nil, if no filter is to be 776`flymake-diagnostic-types-alist', or nil, if no filter is to be
765applied. 777applied."
766
767Interactively, always goes to the previous error. Also
768interactively, FILTER is determined by the prefix arg. With no
769prefix arg, don't use a filter, otherwise only consider
770diagnostics of type `:error' and `:warning'."
771 (interactive (list 1 (if current-prefix-arg 778 (interactive (list 1 (if current-prefix-arg
772 '(:error :warning)) 779 '(:error :warning))
773 t)) 780 t))
@@ -783,7 +790,8 @@ diagnostics of type `:error' and `:warning'."
783(defun flymake--mode-line-format () 790(defun flymake--mode-line-format ()
784 "Produce a pretty minor mode indicator." 791 "Produce a pretty minor mode indicator."
785 (let ((running flymake--running-backends) 792 (let ((running flymake--running-backends)
786 (reported (hash-table-keys flymake--diagnostics-table))) 793 (reported (cl-plusp
794 (hash-table-count flymake--diagnostics-table))))
787 `((:propertize " Flymake" 795 `((:propertize " Flymake"
788 mouse-face mode-line-highlight 796 mouse-face mode-line-highlight
789 ,@(when (not reported) 797 ,@(when (not reported)