branch: elpa/flycheck
commit f2bd8ec17a2df8691d32db8d7696be8a53a5749b
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Detect parse errors in emacs-lisp byte compilation
    
    Add an error pattern for "End of file during parsing" and "Invalid
    read syntax" errors from the Emacs Lisp byte compiler.  These errors
    (caused by unbalanced parentheses or invalid syntax) were previously
    not captured because they lack the line:column prefix that the existing
    error pattern expects.
    
    Fixes #2092
---
 flycheck.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/flycheck.el b/flycheck.el
index d49aaf446c..02cbddc5a6 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -8856,6 +8856,16 @@ See Info Node `(elisp)Byte Compilation'."
           (message (zero-or-more not-newline)
                    (zero-or-more "\n    " (zero-or-more not-newline)))
           line-end)
+   ;; Parse errors subsequent to byte-compilation (e.g., unbalanced
+   ;; parentheses) may lack line/column info.
+   (error line-start (file-name) ":"
+          (zero-or-more whitespace) "Error:" (zero-or-more whitespace)
+          (message (or "End of file during parsing"
+                       (seq "Invalid read syntax:"
+                            (zero-or-more not-newline))))
+          (optional "," (zero-or-more whitespace) line
+                    "," (zero-or-more whitespace) column)
+          line-end)
    (warning line-start (file-name) ":" line ":" column ":"
             (zero-or-more whitespace) "Warning:" (zero-or-more whitespace)
             (message (zero-or-more not-newline)
@@ -8866,7 +8876,7 @@ See Info Node `(elisp)Byte Compilation'."
             (message (zero-or-more "    " (zero-or-more not-newline))
                      (zero-or-more "\n    " (zero-or-more not-newline)))
             line-end)
-   ;; The following is for Emacs 24 ‘check-declare-file’, which uses a
+   ;; The following is for Emacs 24 'check-declare-file', which uses a
    ;; less informative format.
    (warning line-start "Warning (check-declare): " (file-name) " said "
             (message (zero-or-more not-newline))

Reply via email to