branch: elpa/flymake-collection
commit b8f9c9ba0e8c48e7226a7b5424dc683d5f16bdc8
Author: Mohsin Kaleem <mohk...@kisara.moe>
Commit: Mohsin Kaleem <mohk...@kisara.moe>

    (flymake-rest): Replace fmqd- with flymake-rest-
    
    And also add global variables for later lexically bound ones in
    flymake-quick-rest-define. This should appease the venerable byte
    compiler.
---
 checkers/flymake-rest-eslint.el      |  6 ++---
 checkers/flymake-rest-jsonlint.el    |  2 +-
 checkers/flymake-rest-mypy.el        |  2 +-
 checkers/flymake-rest-proselint.el   |  6 ++---
 checkers/flymake-rest-pycodestyle.el |  2 +-
 checkers/flymake-rest-pylint.el      |  6 ++---
 checkers/flymake-rest-shellcheck.el  |  6 ++---
 flymake-rest-define.el               | 48 +++++++++++++++++++++++-------------
 flymake-rest-parse-enumerate.el      |  2 +-
 flymake-rest-parse-rx.el             | 12 ++++-----
 10 files changed, 53 insertions(+), 39 deletions(-)

diff --git a/checkers/flymake-rest-eslint.el b/checkers/flymake-rest-eslint.el
index 12eeb58c78..a7dd3c34b6 100644
--- a/checkers/flymake-rest-eslint.el
+++ b/checkers/flymake-rest-eslint.el
@@ -54,9 +54,9 @@ See URL `https://eslint.org/'."
          (buffer-substring-no-properties
           (point-min) (point-max)))))
     (let-alist it
-      (let ((loc (cons (car (flymake-diag-region fmqd-source .line .column))
-                       (cdr (flymake-diag-region fmqd-source .endLine 
.endColumn)))))
-        (list fmqd-source
+      (let ((loc (cons (car (flymake-diag-region flymake-rest-source .line 
.column))
+                       (cdr (flymake-diag-region flymake-rest-source .endLine 
.endColumn)))))
+        (list flymake-rest-source
               (car loc)
               (cdr loc)
               (pcase .severity
diff --git a/checkers/flymake-rest-jsonlint.el 
b/checkers/flymake-rest-jsonlint.el
index 7bba61fd7c..113450b669 100644
--- a/checkers/flymake-rest-jsonlint.el
+++ b/checkers/flymake-rest-jsonlint.el
@@ -39,7 +39,7 @@ See URL `https://github.com/zaach/jsonlint'."
   :pre-check (unless jsonlint-exec
                (error "Cannot find jsonlint executable"))
   :write-type 'file
-  :command (list jsonlint-exec "-c" "-q" fmqd-temp-file)
+  :command (list jsonlint-exec "-c" "-q" flymake-rest-temp-file)
   :error-parser
   (flymake-rest-parse-rx
    ((error bol (file-name) ": line " line ", col " column ", " (message) 
eol))))
diff --git a/checkers/flymake-rest-mypy.el b/checkers/flymake-rest-mypy.el
index 7131b20523..212be607f1 100644
--- a/checkers/flymake-rest-mypy.el
+++ b/checkers/flymake-rest-mypy.el
@@ -46,7 +46,7 @@ See URL `http://mypy-lang.org/'."
                  "--no-color-output"
                  "--show-absolute-path"
                  "--show-error-codes"
-                 fmqd-temp-file)
+                 flymake-rest-temp-file)
   :error-parser
   (flymake-rest-parse-rx
    ((error   bol (file-name) ":" line ":" column ": error: "   (message) eol)
diff --git a/checkers/flymake-rest-proselint.el 
b/checkers/flymake-rest-proselint.el
index c5f4f771f5..dacfc7f886 100644
--- a/checkers/flymake-rest-proselint.el
+++ b/checkers/flymake-rest-proselint.el
@@ -49,9 +49,9 @@ See URL `http://proselint.com/'."
           (buffer-substring-no-properties
            (point-min) (point-max))))))
     (let-alist it
-      ;; (cons (car (flymake-diag-region fmqd-source .line .column))
-      ;;       (cdr (flymake-diag-region fmqd-source .endLine .endColumn)))
-      (list fmqd-source
+      ;; (cons (car (flymake-diag-region flymake-rest-source .line .column))
+      ;;       (cdr (flymake-diag-region flymake-rest-source .endLine 
.endColumn)))
+      (list flymake-rest-source
             .start
             .end
             (pcase .severity
diff --git a/checkers/flymake-rest-pycodestyle.el 
b/checkers/flymake-rest-pycodestyle.el
index 972d4a4643..34854ae80c 100644
--- a/checkers/flymake-rest-pycodestyle.el
+++ b/checkers/flymake-rest-pycodestyle.el
@@ -38,7 +38,7 @@
     (error "Cannot find pycodestyle executable"))
   :write-type 'file
   :source-inplace t
-  :command (list pycodestyle-exec fmqd-temp-file)
+  :command (list pycodestyle-exec flymake-rest-temp-file)
   :error-parser
   (flymake-rest-parse-rx
    ((error bol (file-name) ":" line ":" column ": " (id (or "E" "W") 
(one-or-more digit)) " " (message) eol))))
diff --git a/checkers/flymake-rest-pylint.el b/checkers/flymake-rest-pylint.el
index 7f291e2a6a..2413fe80c9 100644
--- a/checkers/flymake-rest-pylint.el
+++ b/checkers/flymake-rest-pylint.el
@@ -46,7 +46,7 @@
                  "-m" "pylint"
                  "--reports=n"
                  "--output-format=json"
-                 fmqd-temp-file)
+                 flymake-rest-temp-file)
   :error-parser
   (flymake-rest-parse-enumerate
       (car
@@ -54,8 +54,8 @@
         (buffer-substring-no-properties
          (point-min) (point-max))))
     (let-alist it
-      (let ((loc (flymake-diag-region fmqd-source .line .column)))
-        (list fmqd-source
+      (let ((loc (flymake-diag-region flymake-rest-source .line .column)))
+        (list flymake-rest-source
               (car loc)
               (cdr loc)
               (pcase .type
diff --git a/checkers/flymake-rest-shellcheck.el 
b/checkers/flymake-rest-shellcheck.el
index 7bb2cf6c7d..3e1d014706 100644
--- a/checkers/flymake-rest-shellcheck.el
+++ b/checkers/flymake-rest-shellcheck.el
@@ -52,9 +52,9 @@ See URL `https://github.com/koalaman/shellcheck/'."
         (buffer-substring-no-properties
          (point-min) (point-max))))
     (let-alist it
-      (let ((loc (cons (car (flymake-diag-region fmqd-source .line .column))
-                       (cdr (flymake-diag-region fmqd-source .endLine 
.endColumn)))))
-        (list fmqd-source
+      (let ((loc (cons (car (flymake-diag-region flymake-rest-source .line 
.column))
+                       (cdr (flymake-diag-region flymake-rest-source .endLine 
.endColumn)))))
+        (list flymake-rest-source
               (car loc)
               (cdr loc)
               (pcase .level
diff --git a/flymake-rest-define.el b/flymake-rest-define.el
index 3f6d2ddc01..c59b6f77ea 100644
--- a/flymake-rest-define.el
+++ b/flymake-rest-define.el
@@ -33,7 +33,27 @@
 (require 'flymake)
 
 ;;;###autoload
-(defvar-local flymake-rest-define--procs nil)
+(defvar-local flymake-rest-define--procs nil
+  "The local plist of checker processes running in the current buffer.
+When a checker process is begun its pushed into this plist and when its
+finished its removed and killed. In the very often circumstance where a
+new check is begun while an old check is still pending, the old check is
+killed and replaced with the new check.")
+
+(defvar flymake-rest-context nil
+  "An empty variable lexically bound into a checker.
+You can modify this at will within the checker, using it for
+caching or memoization or whatever else you need.")
+
+(defvar flymake-rest-source nil
+  "The lexically bound source buffer being checked.")
+
+(defvar flymake-rest-temp-file nil
+  "The path to the temporary file containing a copy of `flymake-rest-source'.
+This is only available when specifying :write-type 'file.")
+
+(defvar flymake-rest-temp-dir nil
+  "The dirname of `flymake-rest-temp-file'.")
 
 (defmacro flymake-rest-define (name &optional docstring &rest defs)
   "Quickly define a backend for use with Flymake.
@@ -46,16 +66,10 @@ in DEFS is :command and :error-parser.
 
 Available Variables
 
-fmqd-source, fmqd-temp-file, fmdq-temp-dir, fmqd-context.
+flymake-rest-source, flymake-rest-temp-file, fmdq-temp-dir, 
flymake-rest-context.
 Within the body of :error-parser and :command, several macro specific variables
-are made available. This includes (1) fmqd-source, (2) fmqd-temp-file,
-(3) fmqd-temp-dir, (4) fmqd-context.
-
-1: The source buffer that's being checked by the checker.
-2: The path to the temporary file that was created when using :write-type file.
-3: The dirname of fmqd-temp-file when using :write-type file.
-4: A general purpose list variable that can be used however the developer sees
-   fit. This is useful for example in `flymake-rest-parse-enumerate'.
+are made available. This includes (1) `flymake-rest-source',
+(2) `flymake-rest-temp-file', (3) `flymake-rest-temp-dir', (4) 
`flymake-rest-context'.
 
 Body Definitions
 
@@ -69,12 +83,12 @@ suffix the messages for each diagnostic.
 :write-type specifies how the process for flymake should recieve the input.
 It should be one of 'pipe or 'file (defaulting to 'pipe). When set to file
 a temporary file will be created copying the contents of the `current-buffer'.
-The variable fmqd-temp-file and fmqd-temp-dir will be bound in the body
+The variable flymake-rest-temp-file and flymake-rest-temp-dir will be bound in 
the body
 of the rest of the keywords that provide access to the temp-file. When set
 to pipe after the process has been started all of the current buffers input
 will be passed to the process through standard-input.
 
-:source-inplace is a boolean that sets fmqd-temp-dir to the current working
+:source-inplace is a boolean that sets flymake-rest-temp-dir to the current 
working
 directory. By default this is nil and the temp-file used for :write-type 'file
 will be set to a folder in the systems temporary directory.
 
@@ -105,12 +119,12 @@ diagnostics to parse this form should evaluate to nil."
       (error "Missing flymake backend definition `%s'" elem)))
   (let* ((write-type (or (eval (plist-get defs :write-type)) 'pipe))
          (source-inplace (plist-get defs :source-inplace))
-         (temp-dir-symb (intern "fmqd-temp-dir"))
-         (temp-file-symb (intern "fmqd-temp-file"))
-         (err-symb (intern "fmqd-err"))
+         (temp-dir-symb (intern "flymake-rest-temp-dir"))
+         (temp-file-symb (intern "flymake-rest-temp-file"))
+         (err-symb (intern "flymake-rest-err"))
          (diags-symb (intern "diags"))
          (proc-symb (intern "proc"))
-         (source-symb (intern "fmqd-source"))
+         (source-symb (intern "flymake-rest-source"))
          (current-diags-symb (intern "diag"))
          (cleanup-form (when (eq write-type 'file)
                          (if source-inplace
@@ -124,7 +138,7 @@ diagnostics to parse this form should evaluate to nil."
     `(defun ,name (report-fn &rest _args)
        ,docstring
        (let* ((,source-symb (current-buffer))
-              (fmqd-context nil)
+              (flymake-rest-context nil)
               ,@(when (eq write-type 'file)
                   `((,temp-dir-symb
                      ,@(let ((forms (append (when source-inplace
diff --git a/flymake-rest-parse-enumerate.el b/flymake-rest-parse-enumerate.el
index 9581428c9c..6f7f0657df 100644
--- a/flymake-rest-parse-enumerate.el
+++ b/flymake-rest-parse-enumerate.el
@@ -38,7 +38,7 @@ The value of the current entry from GEN in BODY will be set 
to the variable
 `it'. BODY should evaluate to a form that can be passed to
 `flymake-make-diagnostic'."
   (declare (indent 1))
-  (let ((context-var (intern "fmqd-context")))
+  (let ((context-var (intern "flymake-rest-context")))
     `(progn
        (unless (alist-get 'enumerated ,context-var)
          (push (cons 'entries ,gen) ,context-var)
diff --git a/flymake-rest-parse-rx.el b/flymake-rest-parse-rx.el
index aabc1e49d7..17e476b735 100644
--- a/flymake-rest-parse-rx.el
+++ b/flymake-rest-parse-rx.el
@@ -105,15 +105,15 @@ For an example of this macro in action, see 
`flymake-rest-pycodestyle'."
     ;; are no-more diagnostics to be parsed, we wrap it in a loop that exits
     ;; the moment we find a match, but otherwise keeps moving through 
diagnostics
     ;; until there actually aren't any more to match.
-    `(let (res
-           file-name line column message id end-line end-column severity-ix)
+    `(let (res ; file-name
+           line column message id end-line end-column severity-ix)
        (while (and (not res)
                    (search-forward-regexp ,combined-regex nil t))
          (setq
           res
           (save-match-data
             (save-excursion
-              (setq file-name (match-string 1)
+              (setq ; file-name (match-string 1)
                     line (match-string 2)
                     column (match-string 3)
                     message (match-string 4)
@@ -133,18 +133,18 @@ For an example of this macro in action, see 
`flymake-rest-pycodestyle'."
                                            (symbol-name it)))
                             nil))
                (t
-                (let ((loc (flymake-diag-region fmqd-source
+                (let ((loc (flymake-diag-region flymake-rest-source
                                                 (string-to-number line)
                                                 (when column
                                                   (string-to-number column))))
                       (loc-end (when end-line
-                                 (flymake-diag-region fmqd-source
+                                 (flymake-diag-region flymake-rest-source
                                                       (string-to-number 
end-line)
                                                       (when end-column
                                                         (string-to-number 
end-column))))))
                   (when loc-end
                     (setcdr loc (cdr loc-end)))
-                  (list fmqd-source
+                  (list flymake-rest-source
                         (car loc)
                         (cdr loc)
                         (nth severity-ix (quote ,severity-seq))

Reply via email to