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

    define: Reorient save-match-data and save-excursion
---
 src/flymake-collection-define.el | 95 ++++++++++++++++++++--------------------
 1 file changed, 48 insertions(+), 47 deletions(-)

diff --git a/src/flymake-collection-define.el b/src/flymake-collection-define.el
index b096e9a117..6f621e6aa0 100644
--- a/src/flymake-collection-define.el
+++ b/src/flymake-collection-define.el
@@ -400,53 +400,54 @@ For an example of this macro in action, see 
`flymake-collection-pycodestyle'."
     ;; until there actually aren't any more to match.
     `(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)
-                    line (match-string 2)
-                    column (match-string 3)
-                    message (match-string 4)
-                    id (match-string 5)
-                    end-line (match-string 6)
-                    end-column (match-string 7)
-                    severity-ix (- (seq-find #'match-string
-                                             (number-sequence ,(1+ group-count)
-                                                              ,(+ group-count 
(length regexps))))
-                                   ,(1+ group-count)))
-              (cond
-               ;; Log an error when any of the required fields are missing.
-               ,@(cl-loop for it in '(severity-ix line message)
-                          collect
-                          `((not ,it)
-                            (flymake-log :error
-                                         ,(format
-                                           "Matched diagnostic didn't capture 
a %s group"
-                                           (symbol-name it)))
-                            nil))
-               (t
-                (let ((loc (flymake-diag-region flymake-collection-source
-                                                (string-to-number line)
-                                                (when column
-                                                  (string-to-number column))))
-                      (loc-end (when end-line
-                                 (flymake-diag-region flymake-collection-source
-                                                      (string-to-number 
end-line)
-                                                      (when end-column
-                                                        (string-to-number 
end-column))))))
-                  (when loc-end
-                    (setcdr loc (cdr loc-end)))
-                  (list flymake-collection-source
-                        (car loc)
-                        (cdr loc)
-                        (nth severity-ix (quote ,severity-seq))
-                        (concat
-                         (when id
-                           (concat (propertize id 'face 
'flymake-collection-diag-id) " "))
-                         message)))))))))
+       (save-match-data
+         (save-excursion
+           (while (and (not res)
+                       (search-forward-regexp ,combined-regex nil t))
+             (setq
+              res
+              (progn
+                (setq ; file-name (match-string 1)
+                 line (match-string 2)
+                 column (match-string 3)
+                 message (match-string 4)
+                 id (match-string 5)
+                 end-line (match-string 6)
+                 end-column (match-string 7)
+                 severity-ix (- (seq-find #'match-string
+                                          (number-sequence ,(1+ group-count)
+                                                           ,(+ group-count 
(length regexps))))
+                                ,(1+ group-count)))
+                (cond
+                 ;; Log an error when any of the required fields are missing.
+                 ,@(cl-loop for it in '(severity-ix line message)
+                            collect
+                            `((not ,it)
+                              (flymake-log :error
+                                           ,(format
+                                             "Matched diagnostic didn't 
capture a %s group"
+                                             (symbol-name it)))
+                              nil))
+                 (t
+                  (let ((loc (flymake-diag-region flymake-collection-source
+                                                  (string-to-number line)
+                                                  (when column
+                                                    (string-to-number 
column))))
+                        (loc-end (when end-line
+                                   (flymake-diag-region 
flymake-collection-source
+                                                        (string-to-number 
end-line)
+                                                        (when end-column
+                                                          (string-to-number 
end-column))))))
+                    (when loc-end
+                      (setcdr loc (cdr loc-end)))
+                    (list flymake-collection-source
+                          (car loc)
+                          (cdr loc)
+                          (nth severity-ix (quote ,severity-seq))
+                          (concat
+                           (when id
+                             (concat (propertize id 'face 
'flymake-collection-diag-id) " "))
+                           message))))))))))
        res)))
 
 (cl-defmacro flymake-collection-define-rx

Reply via email to