all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 37517@debbugs.gnu.org
Cc: "Clément Pit-Claudel" <cpitclaudel@gmail.com>,
	"Tim Cross" <theophilusx@gmail.com>, fmdkdd <fmdkdd@gmail.com>
Subject: bug#37517: New rx.el breaks a number of packages - missing symbol rx-submatch-n
Date: Thu, 26 Sep 2019 12:01:46 +0200	[thread overview]
Message-ID: <24516DC3-8F75-4544-800F-FFBBAC977B35@acm.org> (raw)
In-Reply-To: <CAC=50j-Gfkd=Mm_igW5fp-T55dpynLrpODr64zmw_70dwBcw-A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]

[CC:ed the flycheck maintainers; hope you don't mind]

Tim Cross skrev:

>The latest version of rx.el added in commit 2ed71227c626c6cfdc684 seems
>to have broken a number of packages with the error

>Symbol’s function definition is void: rx-submatch-n

>Packages affected include flycheck-color-mode-line, flycheck-joker and
>tide from MELPA.

Thanks for the report. The old rx code was apparently written prior to the double-hyphen convention for marking package-internal symbols, and `rx-submatch-n' is clearly an internal function; I'm not sure why it is used by flycheck.

Of course we could attempt to implement `rx-submatch-n' and what other internal stuff happen to be used by external packages, but that's an open-ended endeavour. Furthermore, it may not always be possible to replicate the expected semantics (internal variables are particularly difficult in that respect).

I'd much rather work with package maintainers to promote the use of stable interfaces. What about the attached patch (untested)?


[-- Attachment #2: 0001-Don-t-use-internal-rx-functions.patch --]
[-- Type: application/octet-stream, Size: 1482 bytes --]

From be57a682edb63b071b10b989db0f2e4c0ccca800 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
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)


  reply	other threads:[~2019-09-26 10:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26  1:45 bug#37517: New rx.el breaks a number of packages - missing symbol rx-submatch-n Tim Cross
2019-09-26 10:01 ` Mattias Engdegård [this message]
2019-09-26 10:53   ` Eli Zaretskii
2019-09-26 12:42     ` Mattias Engdegård
2019-09-26 14:28       ` Eli Zaretskii
2019-09-29 12:57         ` Mattias Engdegård
2019-09-29 13:05           ` Eli Zaretskii
2019-09-29 15:07             ` Mattias Engdegård
2019-09-29 15:17               ` Eli Zaretskii
2019-09-26 14:04   ` Clément Pit-Claudel
2019-09-26 14:33     ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24516DC3-8F75-4544-800F-FFBBAC977B35@acm.org \
    --to=mattiase@acm.org \
    --cc=37517@debbugs.gnu.org \
    --cc=cpitclaudel@gmail.com \
    --cc=fmdkdd@gmail.com \
    --cc=theophilusx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.