From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Carl Allendorph Newsgroups: gmane.emacs.bugs Subject: bug#63918: 28.2; re-builder rx fails to match Date: Mon, 5 Jun 2023 09:20:18 -0700 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000000cf6e05fd64483e" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35906"; mail-complaints-to="usenet@ciao.gmane.io" To: 63918@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 06 06:09:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q6O0b-0009FN-M5 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Jun 2023 06:09:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6O0N-0006Yz-Q9; Tue, 06 Jun 2023 00:09:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6O0G-0006YR-Bn for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 00:09:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q6O0E-0007Lz-FU for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 00:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q6O0D-0006Hx-WD for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 00:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Carl Allendorph Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Jun 2023 04:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63918 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168602450824128 (code B ref -1); Tue, 06 Jun 2023 04:09:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Jun 2023 04:08:28 +0000 Original-Received: from localhost ([127.0.0.1]:50640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6Nzf-0006H3-Nv for submit@debbugs.gnu.org; Tue, 06 Jun 2023 00:08:28 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6Cwd-0004EN-W0 for submit@debbugs.gnu.org; Mon, 05 Jun 2023 12:20:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Cwd-00081U-If for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2023 12:20:35 -0400 Original-Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q6Cwb-0000X0-1N for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2023 12:20:34 -0400 Original-Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f63006b4e3so404694e87.1 for ; Mon, 05 Jun 2023 09:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685982030; x=1688574030; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=YhBrtk9gpXIZLpDELm0byRNSl5Lhlu4wftpNVbALQUo=; b=f3745FVcBygxy9JzhSIRwdOzJ6dZ4MfzpTrvPlfID6q6EvI0VGVvz6XOBHkTQYMsUG 2SI4mUbjqzzWyEtMScaeuUKgHVzzTUUGZFcTw1XdOpumNvbzBM36EBLzv/8nEznOB8H4 CxTsyUxyA5zAyU/z4w/oJ1e2MeZLjqI5JwaE0c+enjQTrXxmi8H20da8HUv7CRzsOmtf uzhMuVjQlijizhbqY1EetRO72JC7RIdb8C8f0r9EOC6RP37Ygn25DIonZmUX6901FZys rhinPZZAi1LmtVRjjFHWJGnwWp8nYazWvRNdFlj1FV/eZG/OOklQcgSMazyqKWoeM0c7 MIGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685982030; x=1688574030; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=YhBrtk9gpXIZLpDELm0byRNSl5Lhlu4wftpNVbALQUo=; b=aiO2GZoeCtPIslqLvZcNke+W76KA3+Nkq/mmZRTtRjfFpFuJLpu6eaUSy9Cxv2bsdw M6uFY9e1UdRgsv/3mDEtNJLaWKne+VJgw2842+Yy2EjhBSqs+jH1UOgJn47k4dSAYb1H m4tvOLxmdEdEJlGIz4WLoNh4nHqn4mRhptJj5LRhyX4OXI0SNf6rys9lk2ZLfVjCMW1z TQ++rIsqanGWl+y6JUClJwHv2oIj9kyhsSpTQkNUUhwWu7e2BILpkN4Ljp5tP0hYa05n 7txB2qaVRac2PdWPkFOAgfBMIIVawu6Qu3zJsqmS94g/36s2e5SY9Bx+C3gRU8Fsnheg DZbA== X-Gm-Message-State: AC+VfDwEMSB5dcecdsMCgyFChldS6hWhCpaAyAY2+mlpvV5IKGcxfUKC QIWoCBvR+hcpWWwvWpuzdROPOvpzizup7tu1QDS/HiC8+3I= X-Google-Smtp-Source: ACHHUZ7El37gNoEY6IcUT5a8Q+gIg0OBiWLwEHWw2lfJv5UCw+h3bFVZDLad/jDrsb7T1bzkLNNVfvxcRkECwTaErr4= X-Received: by 2002:a2e:9810:0:b0:2b1:d210:10c9 with SMTP id a16-20020a2e9810000000b002b1d21010c9mr2549337ljj.43.1685982030121; Mon, 05 Jun 2023 09:20:30 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=callendorph@gmail.com; helo=mail-lf1-x131.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 06 Jun 2023 00:08:24 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263040 Archived-At: --00000000000000cf6e05fd64483e Content-Type: text/plain; charset="UTF-8" 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)) --00000000000000cf6e05fd64483e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm having trouble using the = `re-builder` tool in emacs. I find
that if I use `rx` mode - the built r= egexp does not behave as
expected. I'm not an elisp expert - so it i= s very possible I'm
doing something wrong.

Steps:

1.= =C2=A0 Create a buffer and put "ad ac" on line 1.
2.=C2=A0 Run= `M-x re-builder`
3.=C2=A0 Press `C-c TAB` and enter `rx` to enter rx mo= de.
4.=C2=A0 Enter the following: `(rx (and (or "a" "b&qu= ot;) "c"))`
5.=C2=A0 No Matches are discovered - I expect `ac`= to match
6.=C2=A0 Switch to back to `string` mode with `C-c TAB` and en= ter `string`
7.=C2=A0 The shown regex string is `"\(?:\[ab]c\)"= ;`

I think the problem is the `\[` character escape is invalid. In s= tring mode, if I remove the `\` character and make the regex string "\= (?:[ab]c\)" - then it
matches on `ac` like I expect.

I belie= ve 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 th= is in Emacs 26.3 on an Ubuntu 20.04 machine as well and get the same behavi= or.=C2=A0

Can anyone confirm this behavior ?=C2=A0

In GNU Ema= cs 28.2 (build 1, aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.= 0.1 (Build 21A559))
=C2=A0of 2023-02-22 built on armbob.lan
Windowing= system distributor 'Apple', version 10.3.2113
System Descriptio= n: =C2=A0macOS 12.4

Configured using:
=C2=A0'configure --with= -ns '--enable-locallisppath=3D/Library/Application
=C2=A0Support/Ema= cs/${version}/site-lisp:/Library/Application
=C2=A0Support/Emacs/site-li= sp' --with-modules --with-x-toolkit=3Dno'

Configured feature= s:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS<= br>TOOLKIT_SCROLL_BARS ZLIB

Important settings:
=C2=A0 value of $= LANG: en_US.UTF-8
=C2=A0 locale-coding-system: utf-8-unix

Major m= ode: Text

Minor modes in effect:
=C2=A0 delete-selection-mode: t<= br>=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 show-par= en-mode: t
=C2=A0 electric-indent-mode: t
=C2=A0 mouse-wheel-mode: t<= br>=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-s= hadow-mode: t
=C2=A0 global-font-lock-mode: t
=C2=A0 font-lock-mode: = t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-composition-mode: t
=C2= =A0 auto-encryption-mode: t
=C2=A0 auto-compression-mode: t
=C2=A0 li= ne-number-mode: t
=C2=A0 indent-tabs-mode: t
=C2=A0 transient-mark-mo= de: 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-loadde= fs 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-dat= e package browse-url url url-proxy url-privacy
url-expand url-methods ur= l-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse = auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cach= e json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv c= l-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-op= t fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode= register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer selec= t
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colorsframe minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnam= ese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew gr= eek romanian slovak czech european ethiopic indian cyrillic
chinese comp= osite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook he= lp simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-= face macroexp files window text-properties overlay
sha1 md5 base64 forma= t env code-pages mule custom widget
hashtable-print-readable backquote t= hreads kqueue cocoa ns multi-tty
make-network-process emacs)

Memo= ry information:
((conses 16 71017 6463)
=C2=A0(symbols 48 8112 1)
= =C2=A0(strings 32 24554 990)
=C2=A0(string-bytes 1 780996)
=C2=A0(vec= tors 16 16939)
=C2=A0(vector-slots 8 223944 10903)
=C2=A0(floats 8 36= 168)
=C2=A0(intervals 56 652 133)
=C2=A0(buffers 992 18))
<= /div>
--00000000000000cf6e05fd64483e--