emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/flymake-refactor 22c4b9b 44/52: First batch of min


From: João Távora
Subject: [Emacs-diffs] scratch/flymake-refactor 22c4b9b 44/52: First batch of minor flymake cleanup agreed to with Stefan
Date: Sun, 1 Oct 2017 12:40:51 -0400 (EDT)

branch: scratch/flymake-refactor
commit 22c4b9bd08220ee1be12532f9d2dc8055c1b7971
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    First batch of minor flymake cleanup agreed to with Stefan
    
    Discussed with Stefan, in no particular order
    
    - M-n, M-p no longer bound in flymake-mode-map
    - Remove aliases for symbols thought to be internal to flymake-proc.el
    - Don’t need :group in defcustom and defface in flymake-ui.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
    
    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-ui.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.
---
 lisp/progmodes/flymake-elisp.el |   4 +-
 lisp/progmodes/flymake-proc.el  | 330 ++++++++++------------------------------
 lisp/progmodes/flymake-ui.el    | 148 +++++++++---------
 3 files changed, 156 insertions(+), 326 deletions(-)

diff --git a/lisp/progmodes/flymake-elisp.el b/lisp/progmodes/flymake-elisp.el
index 463fb49..411a314 100644
--- a/lisp/progmodes/flymake-elisp.el
+++ b/lisp/progmodes/flymake-elisp.el
@@ -1,9 +1,9 @@
 ;;; flymake-elisp.el --- Flymake backends for emacs-lisp-mode  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2017  João Távora
+;; Copyright (C) 2003-2017 Free Software Foundation, Inc.
 
 ;; Author: João Távora <address@hidden>
-;; Keywords:
+;; Keywords: languages tools
 
 ;; 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
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index ff12f47..2fc66d8 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'
 (defvar flymake-proc--report-fn nil
   "If bound, function used to report back to flymake's UI.")
 
+(defun flymake-proc-reformat-err-line-patterns-from-compile-el (original-list)
+  "Grab error line patterns from ORIGINAL-LIST in compile.el format.
+Convert it to flymake internal format."
+  (let* ((converted-list '()))
+    (dolist (item original-list)
+      (setq item (cdr item))
+      (let ((regexp (nth 0 item))
+           (file (nth 1 item))
+           (line (nth 2 item))
+           (col (nth 3 item)))
+       (if (consp file)        (setq file (car file)))
+       (if (consp line)        (setq line (car line)))
+       (if (consp col) (setq col (car col)))
+
+       (when (not (functionp line))
+         (setq converted-list (cons (list regexp file line col) 
converted-list)))))
+    converted-list))
+
+(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
+  (append
+   '(
+     ;; MS Visual C++ 6.0
+     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) : 
\\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
+      1 3 nil 4)
+     ;; jikes
+     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:[0-9]+: 
\\(\\(Error\\|Warning\\|Caution\\|Semantic Error\\):[ \t\n]*\\(.+\\)\\)"
+      1 3 nil 4)
+     ;; MS midl
+     ("midl[ ]*:[ ]*\\(command line error .*\\)"
+      nil nil nil 1)
+     ;; MS C#
+     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\),[0-9]+): 
\\(\\(error\\|warning\\|fatal error\\) \\(CS[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
+      1 3 nil 4)
+     ;; perl
+     ("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
+     ;; PHP
+     ("\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 
2 3 nil 1)
+     ;; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on 
input line \\([0-9]+\\)" 20 3 nil 1)
+     ;; ant/javac.  Note this also matches gcc warnings!
+     (" *\\(\\[javac\\] 
*\\)?\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?:[ 
\t\n]*\\(.+\\)"
+      2 4 5 6))
+   ;; compilation-error-regexp-alist)
+   (flymake-proc-reformat-err-line-patterns-from-compile-el 
compilation-error-regexp-alist-alist))
+  "Patterns for matching error/warning lines.  Each pattern has the form
+\(REGEXP FILE-IDX LINE-IDX COL-IDX ERR-TEXT-IDX).
+Use `flymake-proc-reformat-err-line-patterns-from-compile-el' to add patterns
+from compile.el")
+
+(define-obsolete-variable-alias 'flymake-warning-re 
'flymake-proc-diagnostic-type-pred "26.1")
+(defvar flymake-proc-diagnostic-type-pred
+  'flymake-proc-default-guess
+  "Predicate matching against diagnostic text to detect its type.
+Takes a single argument, the diagnostic's text and should return
+a value suitable for indexing
+`flymake-dianostic-types-alist' (which see). If the returned
+value is nil, a type of `:error' is assumed. For some backward
+compatibility, if a non-nil value is returned that that doesn't
+index that alist, a type of `:warning' is assumed.
+
+Instead of a function, it can also be a string, a regular
+expression. A match indicates `:warning' type, otherwise
+`:error'")
+
+(defun flymake-proc-default-guess (text)
+  "Guess if TEXT means a warning, a note or an error."
+  (cond ((string-match "^[wW]arning" text)
+         :warning)
+        ((string-match "^[nN]ote" text)
+         :note)
+        (t
+         :error)))
+
 (defun flymake-proc--get-file-name-mode-and-masks (file-name)
   "Return the corresponding entry from `flymake-proc-allowed-file-name-masks'."
   (unless (stringp file-name)
@@ -242,10 +314,10 @@ to the beginning of the list (File.h -> File.cpp moved to 
top)."
 Nil means search the entire file.")
 
 (defun flymake-proc--check-patch-master-file-buffer
-       (master-file-temp-buffer
-        master-file-name patched-master-file-name
-        source-file-name patched-source-file-name
-        include-dirs regexp)
+    (master-file-temp-buffer
+     master-file-name patched-master-file-name
+     source-file-name patched-source-file-name
+     include-dirs regexp)
   "Check if MASTER-FILE-NAME is a master file for SOURCE-FILE-NAME.
 If yes, patch a copy of MASTER-FILE-NAME to include PATCHED-SOURCE-FILE-NAME
 instead of SOURCE-FILE-NAME.
@@ -296,7 +368,7 @@ instead of reading master file from disk."
                                        (length source-file-nondir)) nil))
                 (flymake-log 3 "inc-name=%s" inc-name)
                 (when (flymake-proc--check-include source-file-name inc-name
-                                             include-dirs)
+                                                   include-dirs)
                   (setq found t)
                   ;;  replace-match is not used here as it fails in
                   ;; XEmacs with 'last match not a buffer' error as
@@ -562,80 +634,8 @@ May only be called in a dynamic environment where
     (flymake-error "Trouble telling flymake-ui about problem %s(%s)"
                    problem explanation)))
 
-(defun flymake-proc-reformat-err-line-patterns-from-compile-el (original-list)
-  "Grab error line patterns from ORIGINAL-LIST in compile.el format.
-Convert it to flymake internal format."
-  (let* ((converted-list '()))
-    (dolist (item original-list)
-      (setq item (cdr item))
-      (let ((regexp (nth 0 item))
-           (file (nth 1 item))
-           (line (nth 2 item))
-           (col (nth 3 item)))
-       (if (consp file)        (setq file (car file)))
-       (if (consp line)        (setq line (car line)))
-       (if (consp col) (setq col (car col)))
-
-       (when (not (functionp line))
-         (setq converted-list (cons (list regexp file line col) 
converted-list)))))
-    converted-list))
-
 (require 'compile)
 
-(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
-  (append
-   '(
-     ;; MS Visual C++ 6.0
-     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) : 
\\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
-      1 3 nil 4)
-     ;; jikes
-     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:[0-9]+: 
\\(\\(Error\\|Warning\\|Caution\\|Semantic Error\\):[ \t\n]*\\(.+\\)\\)"
-      1 3 nil 4)
-     ;; MS midl
-     ("midl[ ]*:[ ]*\\(command line error .*\\)"
-      nil nil nil 1)
-     ;; MS C#
-     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\),[0-9]+): 
\\(\\(error\\|warning\\|fatal error\\) \\(CS[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
-      1 3 nil 4)
-     ;; perl
-     ("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
-     ;; PHP
-     ("\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 
2 3 nil 1)
-     ;; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on 
input line \\([0-9]+\\)" 20 3 nil 1)
-     ;; ant/javac.  Note this also matches gcc warnings!
-     (" *\\(\\[javac\\] 
*\\)?\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?:[ 
\t\n]*\\(.+\\)"
-      2 4 5 6))
-   ;; compilation-error-regexp-alist)
-   (flymake-proc-reformat-err-line-patterns-from-compile-el 
compilation-error-regexp-alist-alist))
-  "Patterns for matching error/warning lines.  Each pattern has the form
-\(REGEXP FILE-IDX LINE-IDX COL-IDX ERR-TEXT-IDX).
-Use `flymake-proc-reformat-err-line-patterns-from-compile-el' to add patterns
-from compile.el")
-
-(define-obsolete-variable-alias 'flymake-warning-re 
'flymake-proc-diagnostic-type-pred "26.1")
-(defvar flymake-proc-diagnostic-type-pred
-  'flymake-proc-default-guess
-  "Predicate matching against diagnostic text to detect its type.
-Takes a single argument, the diagnostic's text and should return
-a value suitable for indexing
-`flymake-dianostic-types-alist' (which see). If the returned
-value is nil, a type of `error' is assumed. For some backward
-compatibility, if a non-nil value is returned that that doesn't
-index that alist, a type of `:warning' is assumed.
-
-Instead of a function, it can also be a string, a regular
-expression. A match indicates `:warning' type, otherwise
-`:error'")
-
-(defun flymake-proc-default-guess (text)
-  "Guess if TEXT means a warning, a note or an error."
-  (cond ((string-match "^[wW]arning" text)
-         :warning)
-        ((string-match "^[nN]ote" text)
-         :note)
-        (t
-         :error)))
-
 (defun flymake-proc-get-project-include-dirs-imp (basedir)
   "Include dirs for the project current file belongs to."
   (if (flymake-proc--get-project-include-dirs-from-cache basedir)
@@ -1016,8 +1016,8 @@ Use CREATE-TEMP-F for creating temp copy."
     (if buildfile-dir
        (let* ((temp-source-file-name  
(flymake-proc-init-create-temp-buffer-copy create-temp-f)))
          (setq args (flymake-proc--get-syntax-check-program-args 
temp-source-file-name buildfile-dir
-                                                           
use-relative-base-dir use-relative-source
-                                                           get-cmdline-f))))
+                                                                 
use-relative-base-dir use-relative-source
+                                                                 
get-cmdline-f))))
     args))
 
 (defun flymake-proc-simple-make-init ()
@@ -1142,113 +1142,10 @@ REGEXP is a regular expression that matches a file 
name.
 INIT is the init function to use.
 CLEANUP is the cleanup function to use, default `flymake-simple-cleanup'.
 NAME is the file name function to use, default `flymake-get-real-file-name'.")
-  (define-obsolete-variable-alias 'flymake-processes
-    'flymake-proc--processes "26.1"
-    "List of currently active flymake processes.")
-  (define-obsolete-function-alias 'flymake-get-file-name-mode-and-masks
-    'flymake-proc--get-file-name-mode-and-masks "26.1"
-    "Return the corresponding entry from ‘flymake-allowed-file-name-masks’.")
-  (define-obsolete-function-alias 'flymake-get-init-function
-    'flymake-proc--get-init-function "26.1"
-    "Return init function to be used for the file.")
-  (define-obsolete-function-alias 'flymake-get-cleanup-function
-    'flymake-proc--get-cleanup-function "26.1"
-    "Return cleanup function to be used for the file.")
-  (define-obsolete-function-alias 'flymake-get-real-file-name-function
-    'flymake-proc--get-real-file-name-function "26.1"
-    nil)
-  (define-obsolete-variable-alias 'flymake-find-buildfile-cache
-    'flymake-proc--find-buildfile-cache "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-get-buildfile-from-cache
-    'flymake-proc--get-buildfile-from-cache "26.1"
-    "Look up DIR-NAME in cache and return its associated value.
-If DIR-NAME is not found, return nil.")
-  (define-obsolete-function-alias 'flymake-add-buildfile-to-cache
-    'flymake-proc--add-buildfile-to-cache "26.1"
-    "Associate DIR-NAME with BUILDFILE in the buildfile cache.")
-  (define-obsolete-function-alias 'flymake-clear-buildfile-cache
-    'flymake-proc--clear-buildfile-cache "26.1"
-    "Clear the buildfile cache.")
-  (define-obsolete-function-alias 'flymake-find-buildfile
-    'flymake-proc--find-buildfile "26.1"
-    "Find buildfile starting from current directory.
-Buildfile includes Makefile, build.xml etc.
-Return its file name if found, or nil if not found.")
-  (define-obsolete-function-alias 'flymake-fix-file-name
-    'flymake-proc--fix-file-name "26.1"
-    "Replace all occurrences of ‘\\’ with ‘/’.")
-  (define-obsolete-function-alias 'flymake-same-files
-    'flymake-proc--same-files "26.1"
-    "Check if FILE-NAME-ONE and FILE-NAME-TWO point to same file.
-Return t if so, nil if not.
-
-(fn FILE-NAME-ONE FILE-NAME-TWO)")
-  (define-obsolete-variable-alias 'flymake-included-file-name\)
-    'flymake-proc--included-file-name\) "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-find-possible-master-files
-    'flymake-proc--find-possible-master-files "26.1"
-    "Find (by name and location) all possible master files.
-
-Name is specified by FILE-NAME and location is specified by
-MASTER-FILE-DIRS.  Master files include .cpp and .c for .h.
-Files are searched for starting from the .h directory and max
-max-level parent dirs.  File contents are not checked.")
-  (define-obsolete-function-alias 'flymake-master-file-compare
-    'flymake-proc--master-file-compare "26.1"
-    "Compare two files specified by FILE-ONE and FILE-TWO.
-This function is used in sort to move most possible file names
-to the beginning of the list (File.h -> File.cpp moved to top).")
   (define-obsolete-variable-alias 'flymake-check-file-limit
     'flymake-proc-check-file-limit "26.1"
     "Maximum number of chars to look at when checking possible master file.
 Nil means search the entire file.")
-  (define-obsolete-function-alias 'flymake-check-patch-master-file-buffer
-    'flymake-proc--check-patch-master-file-buffer "26.1"
-    "Check if MASTER-FILE-NAME is a master file for SOURCE-FILE-NAME.
-If yes, patch a copy of MASTER-FILE-NAME to include PATCHED-SOURCE-FILE-NAME
-instead of SOURCE-FILE-NAME.
-
-For example, foo.cpp is a master file if it includes foo.h.
-
-When a buffer for MASTER-FILE-NAME exists, use it as a source
-instead of reading master file from disk.")
-  (define-obsolete-function-alias 'flymake-replace-region
-    'flymake-proc--replace-region "26.1"
-    "Replace text in BUFFER in region (BEG END) with REP.")
-  (define-obsolete-function-alias 'flymake-read-file-to-temp-buffer
-    'flymake-proc--read-file-to-temp-buffer "26.1"
-    "Insert contents of FILE-NAME into newly created temp buffer.")
-  (define-obsolete-function-alias 'flymake-copy-buffer-to-temp-buffer
-    'flymake-proc--copy-buffer-to-temp-buffer "26.1"
-    "Copy contents of BUFFER into newly created temp buffer.")
-  (define-obsolete-function-alias 'flymake-check-include
-    'flymake-proc--check-include "26.1"
-    "Check if SOURCE-FILE-NAME can be found in include path.
-Return t if it can be found via include path using INC-NAME.")
-  (define-obsolete-function-alias 'flymake-find-buffer-for-file
-    'flymake-proc--find-buffer-for-file "26.1"
-    "Check if there exists a buffer visiting FILE-NAME.
-Return t if so, nil if not.")
-  (define-obsolete-function-alias 'flymake-create-master-file
-    'flymake-proc--create-master-file "26.1"
-    "Save SOURCE-FILE-NAME with a different name.
-Find master file, patch and save it.")
-  (define-obsolete-function-alias 'flymake-save-buffer-in-file
-    'flymake-proc--save-buffer-in-file "26.1"
-    "Save the entire buffer contents into file FILE-NAME.
-Create parent directories as needed.")
-  (define-obsolete-function-alias 'flymake-process-filter
-    'flymake-proc--process-filter "26.1"
-    "Parse OUTPUT and highlight error lines.
-It’s flymake process filter.")
-  (define-obsolete-function-alias 'flymake-process-sentinel
-    'flymake-proc--process-sentinel "26.1"
-    "Sentinel for syntax check buffers.")
-  (define-obsolete-function-alias 'flymake-post-syntax-check
-    'flymake-proc--post-syntax-check "26.1"
-    nil)
   (define-obsolete-function-alias 
'flymake-reformat-err-line-patterns-from-compile-el
     'flymake-proc-reformat-err-line-patterns-from-compile-el "26.1"
     "Grab error line patterns from ORIGINAL-LIST in compile.el format.
@@ -1263,48 +1160,12 @@ from compile.el")
     'flymake-proc-parse-line "26.1"
     "Parse LINE to see if it is an error or warning.
 Return its components if so, nil otherwise.")
-  (define-obsolete-function-alias 'flymake-get-project-include-dirs-imp
-    'flymake-proc--get-project-include-dirs-imp "26.1"
-    "Include dirs for the project current file belongs to.")
-  (define-obsolete-variable-alias 'flymake-get-project-include-dirs-function
-    'flymake-proc--get-project-include-dirs-function "26.1"
-    "Function used to get project include dirs, one parameter: basedir name.")
-  (define-obsolete-function-alias 'flymake-get-project-include-dirs
-    'flymake-proc--get-project-include-dirs "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-get-system-include-dirs
-    'flymake-proc--get-system-include-dirs "26.1"
-    "System include dirs - from the ‘INCLUDE’ env setting.")
-  (define-obsolete-variable-alias 'flymake-project-include-dirs-cache
-    'flymake-proc--project-include-dirs-cache "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-add-project-include-dirs-to-cache
-    'flymake-proc--add-project-include-dirs-to-cache "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-clear-project-include-dirs-cache
-    'flymake-proc--clear-project-include-dirs-cache "26.1"
-    nil)
   (define-obsolete-function-alias 'flymake-get-include-dirs
     'flymake-proc-get-include-dirs "26.1"
     "Get dirs to use when resolving local file names.")
-  (define-obsolete-variable-alias 'flymake-restore-formatting
-    'flymake-proc--restore-formatting "26.1"
-    nil)
-  (define-obsolete-variable-alias 'flymake-get-program-dir
-    'flymake-proc--get-program-dir "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-safe-delete-file
-    'flymake-proc--safe-delete-file "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-safe-delete-directory
-    'flymake-proc--safe-delete-directory "26.1"
-    nil)
   (define-obsolete-function-alias 'flymake-stop-all-syntax-checks
     'flymake-proc-stop-all-syntax-checks "26.1"
     "Kill all syntax check processes.")
-  (define-obsolete-function-alias 'flymake-compilation-is-running
-    'flymake-proc--compilation-is-running "26.1"
-    nil)
   (define-obsolete-function-alias 'flymake-compile
     'flymake-proc-compile "26.1"
     "Kill all flymake syntax checks, start compilation.")
@@ -1314,21 +1175,6 @@ Return its components if so, nil otherwise.")
   (define-obsolete-function-alias 'flymake-create-temp-with-folder-structure
     'flymake-proc-create-temp-with-folder-structure "26.1"
     nil)
-  (define-obsolete-function-alias 'flymake-delete-temp-directory
-    'flymake-proc--delete-temp-directory "26.1"
-    "Attempt to delete temp dir created by 
‘flymake-create-temp-with-folder-structure’, do not fail on error.")
-  (define-obsolete-variable-alias 'flymake-temp-source-file-name
-    'flymake-proc--temp-source-file-name "26.1"
-    nil)
-  (define-obsolete-variable-alias 'flymake-master-file-name
-    'flymake-proc--master-file-name "26.1"
-    nil)
-  (define-obsolete-variable-alias 'flymake-temp-master-file-name
-    'flymake-proc--temp-master-file-name "26.1"
-    nil)
-  (define-obsolete-variable-alias 'flymake-base-dir
-    'flymake-proc--base-dir "26.1"
-    nil)
   (define-obsolete-function-alias 'flymake-init-create-temp-buffer-copy
     'flymake-proc-init-create-temp-buffer-copy "26.1"
     "Make a temporary copy of the current buffer, save its name in buffer data 
and return the name.")
@@ -1340,24 +1186,9 @@ Delete temp file.")
     'flymake-proc-get-real-file-name "26.1"
     "Translate file name from error message to \"real\" file name.
 Return full-name.  Names are real, not patched.")
-  (define-obsolete-function-alias 'flymake-get-full-patched-file-name
-    'flymake-proc--get-full-patched-file-name "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-get-full-nonpatched-file-name
-    'flymake-proc--get-full-nonpatched-file-name "26.1"
-    nil)
-  (define-obsolete-function-alias 'flymake-init-find-buildfile-dir
-    'flymake-proc--init-find-buildfile-dir "26.1"
-    "Find buildfile, store its dir in buffer data and return its dir, if 
found.")
-  (define-obsolete-function-alias 
'flymake-init-create-temp-source-and-master-buffer-copy
-    'flymake-proc--init-create-temp-source-and-master-buffer-copy "26.1"
-    "Find master file (or buffer), create its copy along with a copy of the 
source file.")
   (define-obsolete-function-alias 'flymake-master-cleanup
     'flymake-proc-master-cleanup "26.1"
     nil)
-  (define-obsolete-function-alias 'flymake-get-syntax-check-program-args
-    'flymake-proc--get-syntax-check-program-args "26.1"
-    "Create a command line for syntax check using GET-CMD-LINE-F.")
   (define-obsolete-function-alias 'flymake-get-make-cmdline
     'flymake-proc-get-make-cmdline "26.1"
     nil)
@@ -1395,9 +1226,6 @@ Use CREATE-TEMP-F for creating temp copy.")
   (define-obsolete-function-alias 'flymake-php-init
     'flymake-proc-php-init "26.1"
     nil)
-  (define-obsolete-function-alias 'flymake-get-tex-args
-    'flymake-proc--get-tex-args "26.1"
-    nil)
   (define-obsolete-function-alias 'flymake-simple-tex-init
     'flymake-proc-simple-tex-init "26.1"
     nil)
diff --git a/lisp/progmodes/flymake-ui.el b/lisp/progmodes/flymake-ui.el
index 2b88051..03b034e 100644
--- a/lisp/progmodes/flymake-ui.el
+++ b/lisp/progmodes/flymake-ui.el
@@ -36,7 +36,7 @@
 (require 'thingatpt) ; end-of-thing
 (require 'warnings) ; warning-numeric-level, display-warning
 (require 'compile) ; for some faces
-(eval-when-compile (require 'subr-x)) ; when-let*, if-let*, hash-table-keys
+(eval-when-compile (require 'subr-x)) ; when-let*, if-let*
 
 (defgroup flymake nil
   "Universal on-the-fly syntax checker."
@@ -53,7 +53,6 @@ symbols, see `fringe-bitmaps'.  See also 
`flymake-warning-bitmap'.
 
 The option `flymake-fringe-indicator-position' controls how and where
 this is used."
-  :group 'flymake
   :version "24.3"
   :type '(choice (symbol :tag "Bitmap")
                  (list :tag "Bitmap and face"
@@ -68,7 +67,6 @@ symbols, see `fringe-bitmaps'.  See also 
`flymake-error-bitmap'.
 
 The option `flymake-fringe-indicator-position' controls how and where
 this is used."
-  :group 'flymake
   :version "24.3"
   :type '(choice (symbol :tag "Bitmap")
                  (list :tag "Bitmap and face"
@@ -83,7 +81,6 @@ symbols, see `fringe-bitmaps'.  See also 
`flymake-error-bitmap'.
 
 The option `flymake-fringe-indicator-position' controls how and where
 this is used."
-  :group 'flymake
   :version "26.1"
   :type '(choice (symbol :tag "Bitmap")
                  (list :tag "Bitmap and face"
@@ -94,7 +91,6 @@ this is used."
   "The position to put flymake fringe indicator.
 The value can be nil (do not use indicators), `left-fringe' or `right-fringe'.
 See `flymake-error-bitmap' and `flymake-warning-bitmap'."
-  :group 'flymake
   :version "24.3"
   :type '(choice (const left-fringe)
                 (const right-fringe)
@@ -102,30 +98,25 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
 
 (defcustom flymake-start-syntax-check-on-newline t
   "Start syntax check if newline char was added/removed from the buffer."
-  :group 'flymake
   :type 'boolean)
 
 (defcustom flymake-no-changes-timeout 0.5
   "Time to wait after last change before starting compilation."
-  :group 'flymake
   :type 'number)
 
 (defcustom flymake-gui-warnings-enabled t
   "Enables/disables GUI warnings."
-  :group 'flymake
   :type 'boolean)
 (make-obsolete-variable 'flymake-gui-warnings-enabled
                        "it no longer has any effect." "26.1")
 
 (defcustom flymake-start-syntax-check-on-find-file t
   "Start syntax check on find file."
-  :group 'flymake
   :type 'boolean)
 
 (defcustom flymake-log-level -1
   "Logging level, only messages with level lower or equal will be logged.
 -1 = NONE, 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG"
-  :group 'flymake
   :type 'integer)
 (make-obsolete-variable 'flymake-log-level
                        "it is superseded by `warning-minimum-log-level.'"
@@ -133,7 +124,7 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
 
 (defcustom flymake-wrap-around t
   "If non-nil, moving to errors wraps around buffer boundaries."
-  :group 'flymake :type 'boolean)
+  :type 'boolean)
 
 (define-fringe-bitmap 'flymake-double-exclamation-mark
   (vector #b00000000
@@ -196,7 +187,7 @@ are the string substitutions (see the function `format')."
                                 end
                                 type
                                 text)
-  "Mark BUFFER's region from BEG to END with a flymake diagnostic.
+  "Make a flymake diagnostic for BUFFER's region from BEG to END.
 TYPE is a key to `flymake-diagnostic-types-alist' and TEXT is a
 description of the problem detected in this region."
   (flymake--diag-make :buffer buffer :beg beg :end end :type type :text text))
@@ -217,23 +208,22 @@ description of the problem detected in this region."
 If BEG is non-nil and END is nil, consider only `overlays-at'
 BEG. Otherwise consider `overlays-in' the region comprised by BEG
 and END, defaulting to the whole buffer.  Remove all that do not
-verify FILTER, sort them by COMPARE (using KEY)."
-  (cl-remove-if-not
-   (lambda (ov)
-     (and (overlay-get ov 'flymake-overlay)
-          (or (not filter)
-              (cond ((functionp filter) (funcall filter ov))
-                    ((symbolp filter) (overlay-get ov filter))))))
-   (save-restriction
-     (widen)
-     (let ((ovs (if (and beg (null end))
+verify FILTER, a function, and sort them by COMPARE (using KEY)."
+  (save-restriction
+    (widen)
+    (let ((ovs (cl-remove-if-not
+                (lambda (ov)
+                  (and (overlay-get ov 'flymake)
+                       (or (not filter)
+                           (funcall filter ov))))
+                (if (and beg (null end))
                     (overlays-at beg t)
                   (overlays-in (or beg (point-min))
-                               (or end (point-max))))))
-       (if compare
-           (cl-sort ovs compare :key (or key
-                                         #'identity))
-         ovs)))))
+                               (or end (point-max)))))))
+      (if compare
+          (cl-sort ovs compare :key (or key
+                                        #'identity))
+        ovs))))
 
 (defun flymake-delete-own-overlays (&optional filter)
   "Delete all flymake overlays in BUFFER."
@@ -245,8 +235,7 @@ verify FILTER, sort them by COMPARE (using KEY)."
     (t
      :inherit error))
   "Face used for marking error regions."
-  :version "24.4"
-  :group 'flymake)
+  :version "24.4")
 
 (defface flymake-warning
   '((((supports :underline (:style wave)))
@@ -254,8 +243,7 @@ verify FILTER, sort them by COMPARE (using KEY)."
     (t
      :inherit warning))
   "Face used for marking warning regions."
-  :version "24.4"
-  :group 'flymake)
+  :version "24.4")
 
 (defface flymake-note
   '((((supports :underline (:style wave)))
@@ -263,8 +251,7 @@ verify FILTER, sort them by COMPARE (using KEY)."
     (t
      :inherit warning))
   "Face used for marking note regions."
-  :version "26.1"
-  :group 'flymake)
+  :version "26.1")
 
 (define-obsolete-face-alias 'flymake-warnline 'flymake-warning "26.1")
 (define-obsolete-face-alias 'flymake-errline 'flymake-error "26.1")
@@ -310,7 +297,7 @@ Return nil if the region is invalid."
   "List of flymake backends i.e. sources of flymake diagnostics.
 
 This variable holds an arbitrary number of \"backends\" or
-\"checkers\" providing the flymake UI's \"frontend\" with
+\"checkers\" providing the flymake user interface with
 information about where and how to annotate problems diagnosed in
 a buffer.
 
@@ -326,19 +313,23 @@ start checking the buffer):
   backend for the current check, but will call it again the next
   time;
 
-* If the backend function returns non-nil, flymake expects this backend to
-  check the buffer and call its REPORT-FN callback function. If
-  the computation involved is inexpensive, the backend function
-  may do so synchronously before returning. If it is not, it may
-  do so after retuning, using idle timers, asynchronous
-  processes or other asynchronous mechanisms.
+* If the backend function returns non-nil, flymake expects this
+  backend to check the buffer and call its REPORT-FN callback
+  function exactly once. If the computation involved is
+  inexpensive, the backend function may do so synchronously
+  before returning. If it is not, it may do so after returning,
+  using idle timers, asynchronous processes or other asynchronous
+  mechanisms.
 
-* If the backend function signals an error, it is disabled, i.e. flymake
-  will not attempt it again for this buffer until `flymake-mode'
-  is turned off and on again.
+* If the backend function signals an error, it is disabled,
+  i.e. flymake will not attempt it again for this buffer until
+  `flymake-mode' is turned off and on again.
 
-When calling REPORT-FN, the first argument passed to it decides
-how to proceed. Recognized values are:
+Backends are required to call REPORT-FN with a single argument
+ACTION followed by an optional list of keywords parameters and
+their values (:KEY1 VALUE1 :KEY2 VALUE2...).
+
+The possible values for ACTION are.
 
 * A (possibly empty) list of objects created with
   `flymake-make-diagnostic', causing flymake to annotate the
@@ -351,9 +342,13 @@ how to proceed. Recognized values are:
 * The symbol `:panic', signalling that the backend has
   encountered an exceptional situation and should be disabled.
 
-In the latter cases, it is also possible to provide REPORT-FN
-with a string as the keyword argument `:explanation'. The string
-should give human-readable details of the situation.")
+The recognized optional keyword arguments are:
+
+* ‘:explanation’: value should give user-readable details of
+  the situation encountered, if any.
+
+* ‘:force’: value should be a boolean forcing the flymake UI
+  to consider the report even if was somehow unexpected.")
 
 (defvar flymake-diagnostic-types-alist
   `((:error
@@ -465,7 +460,7 @@ return DEFAULT."
     ;; Some properties can't be overriden
     ;;
     (overlay-put ov 'evaporate t)
-    (overlay-put ov 'flymake-overlay t)
+    (overlay-put ov 'flymake t)
     (overlay-put ov 'flymake--diagnostic diagnostic)))
 
 (defun flymake-on-timer-event (buffer)
@@ -562,9 +557,9 @@ sources."
   "Run the backend BACKEND."
   (push backend flymake--running-backends)
   (remhash backend flymake--diagnostics-table)
-  ;; FIXME: Should use `condition-case-unless-debug'
-  ;; here, but that won't let me catch errors during
-  ;; testing where `debug-on-error' is always t
+  ;; FIXME: Should use `condition-case-unless-debug' here, but that
+  ;; won't let me catch errors from inside `ert-deftest' where
+  ;; `debug-on-error' is always t
   (condition-case err
       (unless (funcall backend
                        (flymake-make-report-fn backend))
@@ -605,16 +600,11 @@ backends."
       (start))))
 
 (defvar flymake-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "M-n") 'flymake-goto-next-error)
-    (define-key map (kbd "M-p") 'flymake-goto-prev-error)
-    map)
-  "Keymap for `flymake-mode'.")
+  (let ((map (make-sparse-keymap))) map)
+  "Keymap for `flymake-mode'")
 
 (define-minor-mode flymake-mode nil
-  :group 'flymake :lighter flymake--mode-line-format
-  (setq flymake--running-backends nil
-        flymake--disabled-backends nil)
+  :group 'flymake :lighter flymake--mode-line-format :keymap flymake-mode-map
   (cond
    ;; Turning the mode ON.
    (flymake-mode
@@ -656,6 +646,9 @@ backends."
   (flymake-mode 0)
   (flymake-log 1 "flymake mode turned OFF"))
 
+(make-obsolete 'flymake-mode-on 'flymake-mode "26.1")
+(make-obsolete 'flymake-mode-off 'flymake-mode "26.1")
+
 (defun flymake-after-change-function (start stop _len)
   "Start syntax check for current buffer if it isn't already running."
   ;;+(flymake-log 0 "setting change time to %s" (float-time))
@@ -683,14 +676,19 @@ backends."
 
 (defun flymake-goto-next-error (&optional n filter interactive)
   "Go to Nth next flymake error in buffer matching FILTER.
+
+Interactively, always move to the next error.  Interactively, and
+with a prefix arg, skip any diagnostics with a severity less than
+‘:warning’.
+
+If ‘flymake-wrap-around’ is non-nil, resumes search from top
+at end of buffer.
+
 FILTER is a list of diagnostic types found in
 `flymake-diagnostic-types-alist', or nil, if no filter is to be
-applied.
-
-Interactively, always goes to the next error.  Also
-interactively, FILTER is determined by the prefix arg.  With no
-prefix arg, don't use a filter, otherwise only consider
-diagnostics of type `:error' and `:warning'."
+applied."
+  ;; TODO: let filter be a number, a severity below which diags are
+  ;; skipped.
   (interactive (list 1
                      (if current-prefix-arg
                          '(:error :warning))
@@ -734,14 +732,17 @@ diagnostics of type `:error' and `:warning'."
 
 (defun flymake-goto-prev-error (&optional n filter interactive)
   "Go to Nth previous flymake error in buffer matching FILTER.
+
+Interactively, always move to the previous error.  Interactively,
+and with a prefix arg, skip any diagnostics with a severity less
+than ‘:warning’.
+
+If ‘flymake-wrap-around’ is non-nil, resumes search from top
+at end of buffer.
+
 FILTER is a list of diagnostic types found in
 `flymake-diagnostic-types-alist', or nil, if no filter is to be
-applied.
-
-Interactively, always goes to the previous error.  Also
-interactively, FILTER is determined by the prefix arg.  With no
-prefix arg, don't use a filter, otherwise only consider
-diagnostics of type `:error' and `:warning'."
+applied."
   (interactive (list 1 (if current-prefix-arg
                            '(:error :warning))
                      t))
@@ -757,7 +758,8 @@ diagnostics of type `:error' and `:warning'."
 (defun flymake--mode-line-format ()
   "Produce a pretty minor mode indicator."
   (let ((running flymake--running-backends)
-        (reported (hash-table-keys flymake--diagnostics-table)))
+        (reported (cl-plusp
+                   (hash-table-count flymake--diagnostics-table))))
     `((:propertize " Flymake"
                    mouse-face mode-line-highlight
                    ,@(when (not reported)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]