unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38170: 27.0.50; [PATCH] rx.el: Fix misplaced "char" identifiers.
@ 2019-11-11 10:24 Zhu Zihao
  2019-11-11 13:37 ` Mattias Engdegård
  0 siblings, 1 reply; 3+ messages in thread
From: Zhu Zihao @ 2019-11-11 10:24 UTC (permalink / raw)
  To: 38170

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


New rx implementation introduce some bug:

1. (rx char) throw an error "Unknown rx symbol char"
2. (rx (char ?A ?B)) return a regexp match A or B.

This patch aims to fix this.


[-- Attachment #2: 0001-rx.el-Fix-misplaced-char-identifiers.patch --]
[-- Type: text/plain, Size: 1385 bytes --]

From 1b5d28b8b2bcbf91ad32991d3602de45ef9bef76 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
To: bug-gnu-emacs@gnu.org
Date: Sun, 10 Nov 2019 20:02:44 +0800
Subject: 27.0.50; [PATCH] rx.el: Fix misplaced "char" identifiers.

---
 lisp/emacs-lisp/rx.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 52a35ffa2a7..c5f341a7b0a 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -153,7 +153,7 @@ rx--translate-symbol
   (pcase sym
     ;; Use `list' instead of a quoted list to wrap the strings here,
     ;; since the return value may be mutated.
-    ((or 'nonl 'not-newline 'any) (cons (list ".") t))
+    ((or 'nonl 'not-newline 'any 'char) (cons (list ".") t))
     ((or 'anychar 'anything)      (cons (list "[^z-a]") t))
     ('unmatchable                 (rx--empty))
     ((or 'bol 'line-start)        (cons (list "^") 'lseq))
@@ -857,7 +857,7 @@ rx--translate-form
     (pcase (car form)
       ((or 'seq : 'and 'sequence) (rx--translate-seq body))
       ((or 'or '|)              (rx--translate-or body))
-      ((or 'any 'in 'char)      (rx--translate-any nil body))
+      ((or 'any 'in)            (rx--translate-any nil body))
       ('not-char                (rx--translate-any t body))
       ('not                     (rx--translate-not nil body))
 
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#38170: 27.0.50; [PATCH] rx.el: Fix misplaced "char" identifiers.
  2019-11-11 10:24 bug#38170: 27.0.50; [PATCH] rx.el: Fix misplaced "char" identifiers Zhu Zihao
@ 2019-11-11 13:37 ` Mattias Engdegård
  2019-11-11 13:54   ` Zhu Zihao
  0 siblings, 1 reply; 3+ messages in thread
From: Mattias Engdegård @ 2019-11-11 13:37 UTC (permalink / raw)
  To: 38170; +Cc: Zhu Zihao

Thanks for the report! However, there may be a misunderstanding:

(char ...) as an alias for (any ...) was a documented feature of the old implementation and was therefore preserved in the re-write; it cannot be removed without a very good justification.

'char' as an alias for 'not-newline' was never documented in the first place and because of the rather intuitive meaning, it was considered to be an implementation accident and therefore not included.

Therefore I'd rather not apply the proposed changes.






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#38170: 27.0.50; [PATCH] rx.el: Fix misplaced "char" identifiers.
  2019-11-11 13:37 ` Mattias Engdegård
@ 2019-11-11 13:54   ` Zhu Zihao
  0 siblings, 0 replies; 3+ messages in thread
From: Zhu Zihao @ 2019-11-11 13:54 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: 38170, Zhu Zihao

On Mon, 11 Nov 2019 21:37:09 +0800,
Mattias Engdegård wrote:
> 
> Thanks for the report! However, there may be a misunderstanding:
> 
> (char ...) as an alias for (any ...) was a documented feature of the old implementation and was therefore preserved in the re-write; it cannot be removed without a very good justification.
> 
> 'char' as an alias for 'not-newline' was never documented in the first place and because of the rather intuitive meaning, it was considered to be an implementation accident and therefore not included.
> 
> Therefore I'd rather not apply the proposed changes.

Thanks for your explanation. I' m going to adjust my code instead :)






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-11 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 10:24 bug#38170: 27.0.50; [PATCH] rx.el: Fix misplaced "char" identifiers Zhu Zihao
2019-11-11 13:37 ` Mattias Engdegård
2019-11-11 13:54   ` Zhu Zihao

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).