GNU bug report logs -
#63918
28.2; re-builder rx fails to match
Previous Next
To reply to this bug, email your comments to 63918 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#63918
; Package
emacs
.
(Tue, 06 Jun 2023 04:09:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Carl Allendorph <callendorph <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 06 Jun 2023 04:09:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I'm having trouble using the `re-builder` tool in emacs. I find
that if I use `rx` mode - the built regexp does not behave as
expected. I'm not an elisp expert - so it is very possible I'm
doing something wrong.
Steps:
1. Create a buffer and put "ad ac" on line 1.
2. Run `M-x re-builder`
3. Press `C-c TAB` and enter `rx` to enter rx mode.
4. Enter the following: `(rx (and (or "a" "b") "c"))`
5. No Matches are discovered - I expect `ac` to match
6. Switch to back to `string` mode with `C-c TAB` and enter `string`
7. The shown regex string is `"\(?:\[ab]c\)"`
I think the problem is the `\[` character escape is invalid. In string
mode, if I remove the `\` character and make the regex string "\(?:[ab]c\)"
- then it
matches on `ac` like I expect.
I believe the problem is in `reb-cook-regexp` - specifically in
the call to `rx-to-string`:
(rx-to-string (rx (and (or "a" "b") "c")))
"\\(?:\\[ab]c\\)"
I've checked this in Emacs 26.3 on an Ubuntu 20.04 machine as well and get
the same behavior.
Can anyone confirm this behavior ?
In GNU Emacs 28.2 (build 1, aarch64-apple-darwin21.1.0, NS appkit-2113.00
Version 12.0.1 (Build 21A559))
of 2023-02-22 built on armbob.lan
Windowing system distributor 'Apple', version 10.3.2113
System Description: macOS 12.4
Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules --with-x-toolkit=no'
Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS
TOOLKIT_SCROLL_BARS ZLIB
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Text
Minor modes in effect:
delete-selection-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils misearch multi-isearch
help-fns radix-tree cl-print debug backtrace help-mode find-func delsel
re-builder rx time-date package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue cocoa ns multi-tty
make-network-process emacs)
Memory information:
((conses 16 71017 6463)
(symbols 48 8112 1)
(strings 32 24554 990)
(string-bytes 1 780996)
(vectors 16 16939)
(vector-slots 8 223944 10903)
(floats 8 36 168)
(intervals 56 652 133)
(buffers 992 18))
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#63918
; Package
emacs
.
(Tue, 06 Jun 2023 09:32:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 63918 <at> debbugs.gnu.org (full text, mbox):
The problem is that re-builder's handling of rx is badly designed, and you are not the first to be annoyed by this. In 'rx' mode, re-builder expects you to write a Lisp expression that can be used as argument to `rx-to-string`, something that nobody wants to do. In your case, instead of
(rx (or "a" "b") "c")
you would have to write something like
'(seq (or "a" "b") "c")
Note the quote (because the expression is evaluated) and `seq` (because `rx-to-string` only takes a single rx expression as input; `rx` forms an implicit `seq` of its arguments).
Previous bugs:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60196
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54107
Forcibly Merged 60196 63918.
Request was from
Mattias Engdegård <mattias.engdegard <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 06 Jun 2023 13:08:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#63918
; Package
emacs
.
(Sun, 11 Jun 2023 03:17:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 63918 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thank you for the kind response. I understand what I was doing wrong now.
On Tue, Jun 6, 2023 at 2:31 AM Mattias Engdegård <
mattias.engdegard <at> gmail.com> wrote:
> The problem is that re-builder's handling of rx is badly designed, and you
> are not the first to be annoyed by this. In 'rx' mode, re-builder expects
> you to write a Lisp expression that can be used as argument to
> `rx-to-string`, something that nobody wants to do. In your case, instead of
>
> (rx (or "a" "b") "c")
>
> you would have to write something like
>
> '(seq (or "a" "b") "c")
>
> Note the quote (because the expression is evaluated) and `seq` (because
> `rx-to-string` only takes a single rx expression as input; `rx` forms an
> implicit `seq` of its arguments).
>
> Previous bugs:
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60196
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54107
>
>
[Message part 2 (text/html, inline)]
This bug report was last modified 2 years and 66 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.