Flycheck: (void-function rx-submatch-n)

Created on 26 Sep 2019  路  5Comments  路  Source: flycheck/flycheck

Checklist

  • [x] I have checked existing issues for potential duplicates before creating this one.
  • [x] I have read the Troubleshooting guide.

Bug description

I am using latest flycheck from MELPA. When I turn on flycheck-mode, I get:

Debugger entered--Lisp error: (void-function rx-submatch-n)
  rx-submatch-n((group-n 4 "In file included from"))
  flycheck-rx-message((message "In file included from"))
  rx--translate-compat-form((flycheck-rx-message 0 nil) (message "In file included from"))
  rx--translate-form((message "In file included from"))
  rx--translate((message "In file included from"))
  mapcar(rx--translate (line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end))
  rx--translate-seq((line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end))
  rx--translate-form((and line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end))
  rx--translate((and line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end))
  rx-to-string((and line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end) no-group)
  flycheck-rx-to-string((and line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end) no-group)
  #f(compiled-function (p) #<bytecode 0x1564ab2f46c1>)((error line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end))
  mapcar(#f(compiled-function (p) #<bytecode 0x1564ab2f46c1>) ((error line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end) (info line-start (file-name) ":" line ":" column ": note: " (message) line-end) (warning line-start (file-name) ":" line ":" column ": warning: " (message) line-end) (error line-start (file-name) ":" line ":" column ": " (message) line-end)))
  #f(compiled-function #'sequence #<bytecode 0x1564ab1d7fd1>)(#f(compiled-function (p) #<bytecode 0x1564ab2f46c1>) ((error line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end) (info line-start (file-name) ":" line ":" column ": note: " (message) line-end) (warning line-start (file-name) ":" line ":" column ": warning: " (message) line-end) (error line-start (file-name) ":" line ":" column ": " (message) line-end)))
  apply(#f(compiled-function #'sequence #<bytecode 0x1564ab1d7fd1>) #f(compiled-function (p) #<bytecode 0x1564ab2f46c1>) ((error line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end) (info line-start (file-name) ":" line ":" column ": note: " (message) line-end) (warning line-start (file-name) ":" line ":" column ": warning: " (message) line-end) (error line-start (file-name) ":" line ":" column ": " (message) line-end)) nil)
  seq-map(#f(compiled-function (p) #<bytecode 0x1564ab2f46c1>) ((error line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end) (info line-start (file-name) ":" line ":" column ": note: " (message) line-end) (warning line-start (file-name) ":" line ":" column ": warning: " (message) line-end) (error line-start (file-name) ":" line ":" column ": " (message) line-end)))
  flycheck-define-command-checker(ada-gnat "An Ada syntax checker using GNAT.\n\nUses the GNAT c..." :command ("gnatmake" "-c" "-f" "-u" "-gnatf" "-gnatef" "-D" temporary-directory (option-list "-gnat" flycheck-gnat-warnings concat) (option-list "-I" flycheck-gnat-include-path concat) (option "-gnat" flycheck-gnat-language-standard concat) (eval flycheck-gnat-args) source) :error-patterns ((error line-start (message "In file included from") " " (file-name) ":" line ":" column ":" line-end) (info line-start (file-name) ":" line ":" column ": note: " (message) line-end) (warning line-start (file-name) ":" line ":" column ": warning: " (message) line-end) (error line-start (file-name) ":" line ":" column ": " (message) line-end)) :modes ada-mode :next-checkers nil :standard-input nil :working-directory nil)
  byte-code("\300\301\302\303#\300\301\304\305#\306\307\310\311\312DD\313\314\315\316\317\320\321\322\323&\13\210\324\307\325\"\210\306\326\310\311\327DD\330\314\315\320\331\332\333\322\334..." [function-put flycheck-define-checker lisp-indent-function 1 doc-string-elt 2 custom-declare-variable flycheck-gnat-args funcall function #f(compiled-function () #<bytecode 0x1564ab321e59>) "A list of additional command line arguments.\n\nThe ..." :group flycheck-options :risky t :type (repeat (string :tag "Argument")) :package-version (flycheck . "0.20") flycheck-register-option-var ada-gnat flycheck-gnat-include-path #f(compiled-function () #<bytecode 0x1564ab321e65>) "A list of include directories for GNAT.\n\nThe value..." (repeat (directory :tag "Include directory")) :safe flycheck-string-list-p (flycheck . "0.20") flycheck-gnat-language-standard #f(compiled-function () #<bytecode 0x1564ab321e71>) "The language standard to use in GNAT.\n\nThe value o..." (choice (const :tag "Default standard" nil) (string :tag "Language standard")) stringp (flycheck . "0.20") flycheck-gnat-warnings #f(compiled-function () #<bytecode 0x1564ab321e7d>) "A list of additional Ada warnings to enable in GNA..." (repeat :tag "Warnings" (string :tag "Warning name")) (flycheck . "0.20") flycheck-ada-gnat-executable #f(compiled-function () #<bytecode 0x1564ab321e89>) "The executable of the ada-gnat syntax checker.\n\nEi..." (choice (const :tag "Default executable" nil) (string :tag "Name or path")) flycheck-executables flycheck-define-command-checker "An Ada syntax checker using GNAT.\n\nUses the GNAT c..." :command ("gnatmake" "-c" "-f" "-u" "-gnatf" "-gnatef" "-D" temporary-directory (option-list "-gnat" flycheck-gnat-warnings concat) (option-list "-I" flycheck-gnat-include-path concat) (option "-gnat" flycheck-gnat-language-standard concat) (eval flycheck-gnat-args) source) :error-patterns ...] 17)
  autoload-do-load((autoload "flycheck" "Minor mode for on-the-fly syntax checking.\n\nWhen c..." t nil) flycheck-mode)
  command-execute(flycheck-mode record)
  execute-extended-command(nil "flycheck-mode" "flycheck-mod")
  funcall-interactively(execute-extended-command nil "flycheck-mode" "flycheck-mod")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

Steps to reproduce

Steps to reproduce the behavior:

  1. emacs -Q
  2. M-x package-initialize
  3. M-x toggle-debug-on-error
  4. M-x flycheck-mode

Expected behavior

I expect to see flycheck-mode turned on as usual. :)

System configuration

Syntax checkers for buffer *scratch* in lisp-interaction-mode:

No checker to run in this buffer.

No checkers are available for this buffer.

Flycheck Mode is disabled.  Use C-u M-x flycheck-disable-checker to
enable disabled checkers.

--------------------

Flycheck version: 32snapshot (package: 20190913.1456)
Emacs version:    27.0.50
System:           x86_64-debian-linux-gnu
Window system:    x

Emacs configuration:

  • [x] Plain Emacs / Custom configuration
  • [ ] Spacemacs
  • [ ] Doom Emacs
  • [ ] Other shared configuration

Additional notes

Some notes about my system:

GNU Emacs 27.0.50 (build 1, x86_64-debian-linux-gnu, GTK+ Version 3.22.30)
 of 2019-09-26

Repository revision: 07367e5b95fe31f3d4e994b42b081075501b9b60
Configured using:
--host=x86_64-debian-linux-gnu --with-modules --with-imagemagick --with-harfbuzz

Operating system: Ubuntu 18.04.3 LTS
Window system: x11
Desktop environment: GNOME Shell 3.28.4
bug

Most helpful comment

Thanks a lot all. Can you test the patch posted on the emacs mailing list?

From be57a682edb63b071b10b989db0f2e4c0ccca800 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <[email protected]>
Date: Thu, 26 Sep 2019 11:56:39 +0200
Subject: [PATCH] Don't use internal rx functions

Use rx-to-string instead of the internal rx-submatch-n, which is gone
in Emacs 27 and never was intended for public use.
---
 flycheck.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/flycheck.el b/flycheck.el
index 99cf70a6..62090df2 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -1400,16 +1400,16 @@ Safely delete all files and directories listed in
   "Translate the `(file-name)' FORM into a regular expression."
   (let ((body (or (cdr form) '((minimal-match
                                 (one-or-more not-newline))))))
-    (rx-submatch-n `(group-n 1 ,@body))))
+    (rx-to-string `(group-n 1 ,@body) t)))

 (defun flycheck-rx-message (form)
   "Translate the `(message)' FORM into a regular expression."
   (let ((body (or (cdr form) '((one-or-more not-newline)))))
-    (rx-submatch-n `(group-n 4 ,@body))))
+    (rx-to-string `(group-n 4 ,@body) t)))

 (defun flycheck-rx-id (form)
   "Translate the `(id)' FORM into a regular expression."
-  (rx-submatch-n `(group-n 5 ,@(cdr form))))
+  (rx-to-string `(group-n 5  ,@(cdr form)) t))

 (defun flycheck-rx-to-string (form &optional no-group)
   "Like `rx-to-string' for FORM, but with special keywords:
-- 
2.21.0 (Apple Git-122)

All 5 comments

It looks like emacs reworked their rx implementation in 2ed71227c626c6cfdc684948644ccf3d9eaeb15b which removed rx-submatch-n

Thanks a lot all. Can you test the patch posted on the emacs mailing list?

From be57a682edb63b071b10b989db0f2e4c0ccca800 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <[email protected]>
Date: Thu, 26 Sep 2019 11:56:39 +0200
Subject: [PATCH] Don't use internal rx functions

Use rx-to-string instead of the internal rx-submatch-n, which is gone
in Emacs 27 and never was intended for public use.
---
 flycheck.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/flycheck.el b/flycheck.el
index 99cf70a6..62090df2 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -1400,16 +1400,16 @@ Safely delete all files and directories listed in
   "Translate the `(file-name)' FORM into a regular expression."
   (let ((body (or (cdr form) '((minimal-match
                                 (one-or-more not-newline))))))
-    (rx-submatch-n `(group-n 1 ,@body))))
+    (rx-to-string `(group-n 1 ,@body) t)))

 (defun flycheck-rx-message (form)
   "Translate the `(message)' FORM into a regular expression."
   (let ((body (or (cdr form) '((one-or-more not-newline)))))
-    (rx-submatch-n `(group-n 4 ,@body))))
+    (rx-to-string `(group-n 4 ,@body) t)))

 (defun flycheck-rx-id (form)
   "Translate the `(id)' FORM into a regular expression."
-  (rx-submatch-n `(group-n 5 ,@(cdr form))))
+  (rx-to-string `(group-n 5  ,@(cdr form)) t))

 (defun flycheck-rx-to-string (form &optional no-group)
   "Like `rx-to-string' for FORM, but with special keywords:
-- 
2.21.0 (Apple Git-122)

@cpitclaudel Works perfectly. :)

OK, then I'll make it into a PR. Thanks.

Thank you! I'll close this issue as soon as the PR is merged.

Was this page helpful?
0 / 5 - 0 ratings