GNU bug report logs - #25123
25.1.50; rx.el errs on character alternatives which include both ?\] and ?-

Previous Next

Package: emacs;

Reported by: Patrick Xarles Hayes <pxhayes <at> gmail.com>

Date: Tue, 6 Dec 2016 07:14:01 UTC

Severity: normal

Tags: fixed, patch

Found in versions 24.3, 25.1.50

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #12 received at control <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Patrick Xarles Hayes <pxhayes <at> gmail.com>
Cc: 25123 <at> debbugs.gnu.org
Subject: Re: bug#25123: 25.1.50;
 rx.el errs on character alternatives which include both ?\] and ?-
Date: Wed, 07 Dec 2016 23:23:41 -0500
[Message part 1 (text/plain, inline)]
found 25123 24.3
tags 25123 patch
quit

Patrick Xarles Hayes <pxhayes <at> gmail.com> writes:

> The following fails in both Emacs 24.3.1 and 25.1.50.1:
>
> (require 'rx)
> (rx-any '(char (93 . 123) (60 . 91) (45 . 58)))
>
> I rewrote `rx-any' to the following, and it seems to work (though it may
> be introducing new bugs I'm not noticing):
>

There seems to be a lot of changes there, I can't really follow it.
Here's a more minimal patch:

[v1-0001-Fix-rx-any-with-range-with-and.patch (text/plain, inline)]
From ccb763c86dbb58972b49a26d5ffe5cf195a5975a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Wed, 7 Dec 2016 23:17:37 -0500
Subject: [PATCH v1] Fix rx-any with range with ?\] and ?-

* lisp/emacs-lisp/rx.el: Make sure not to produce a circular list.
---
 lisp/emacs-lisp/rx.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 66d295e..d305597 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -521,7 +521,7 @@ rx-any
 	     (setq args (nconc (delq ?- args) (list ?-))))
 	    ((setq m (assq ?- args))
 	     ;; next to the bracket's range, make the second range
-	     (setcdr args (cons m (delq m args))))))
+	     (setcdr args (cons m (delq m (cdr args)))))))
      ;; bracket in the end range
      ;;	 => "[]...-]"
      ((setq m (rassq ?\] args))
-- 
2.9.3


This bug report was last modified 8 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.