* bug#63918: 28.2; re-builder rx fails to match
@ 2023-06-05 16:20 Carl Allendorph
2023-06-06 9:31 ` Mattias Engdegård
0 siblings, 1 reply; 3+ messages in thread
From: Carl Allendorph @ 2023-06-05 16:20 UTC (permalink / raw)
To: 63918
[-- Attachment #1: Type: text/plain, Size: 4140 bytes --]
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))
[-- Attachment #2: Type: text/html, Size: 4784 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-11 3:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-05 16:20 bug#63918: 28.2; re-builder rx fails to match Carl Allendorph
2023-06-06 9:31 ` Mattias Engdegård
2023-06-11 3:16 ` Carl Allendorph
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).