From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#31698: 27.0; `rx' help: Show equivalent regexp constructs Date: Sun, 3 Jun 2018 13:02:53 -0700 (PDT) Message-ID: <2c335f8a-d6df-45b1-b1dd-a7f42dbcb584@default> References: <66469700-731c-4a05-a06e-51dba8dd8149@default> <83fu23dc85.fsf@gnu.org> <8e6225c9-73f1-4d5c-b62e-26596d556433@default> <83efhnd8p1.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1528056131 7174 195.159.176.226 (3 Jun 2018 20:02:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 3 Jun 2018 20:02:11 +0000 (UTC) Cc: 31698@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 03 22:02:06 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPZCY-0001ml-Fm for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Jun 2018 22:02:06 +0200 Original-Received: from localhost ([::1]:36505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPZEf-00015g-J0 for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Jun 2018 16:04:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPZEX-00015N-Pf for bug-gnu-emacs@gnu.org; Sun, 03 Jun 2018 16:04:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPZES-0000bg-Mx for bug-gnu-emacs@gnu.org; Sun, 03 Jun 2018 16:04:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52686) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPZES-0000ba-J5 for bug-gnu-emacs@gnu.org; Sun, 03 Jun 2018 16:04:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fPZEP-0002S8-HG for bug-gnu-emacs@gnu.org; Sun, 03 Jun 2018 16:04:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Jun 2018 20:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31698 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31698-submit@debbugs.gnu.org id=B31698.15280561849354 (code B ref 31698); Sun, 03 Jun 2018 20:04:01 +0000 Original-Received: (at 31698) by debbugs.gnu.org; 3 Jun 2018 20:03:04 +0000 Original-Received: from localhost ([127.0.0.1]:60583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPZDT-0002Qo-VG for submit@debbugs.gnu.org; Sun, 03 Jun 2018 16:03:04 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:55830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPZDS-0002QH-5z for 31698@debbugs.gnu.org; Sun, 03 Jun 2018 16:03:02 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w53JvL1a036322; Sun, 3 Jun 2018 20:02:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=GCm3fz7sonHjzU9AuwPUS8XgGnZhZiMz4QuvRJMCaaI=; b=JAbDm+q0gOOQLpf7dpu0bbOJZdQ8iUeucELZ4+bVe9slhexowqr9HgtmTlgDMH9gKhxV sQj1f//KfB1fl6rkz/QzMeXg/emx9KnE9daArwTW9WFHEAwIFnhOBWjdeY78joQgbkFq +NOvMhqn6PZ8D12RuUMWuJTYmQypsqfn244iyYFrmn4o0kY7j25JpE7WHLV9bcTdI4Vi ZSojvoXZxE3lpYos4TbybLG0EGstP4T+M2Tltf6k3Ve2VAdGojKEYelRVEzsbpDMqMPN 6NROWdn2msCSqoKjEpNH9IqJkHsaQu58kkCn4+OmrxHjcSlD+sMFvlpAh2Ea1uItJNBk AA== Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2jbvyp9c2b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 03 Jun 2018 20:02:56 +0000 Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w53K2tMc008245 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 3 Jun 2018 20:02:55 GMT Original-Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w53K2sVu011050; Sun, 3 Jun 2018 20:02:55 GMT In-Reply-To: <83efhnd8p1.fsf@gnu.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4690.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8913 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=446 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806030248 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146926 Archived-At: > > Perhaps its not-so-widespread use is _partly_ due to > > the lack of more helpful doc? >=20 > I very much doubt that, and the recent discussion seems to concur. No, I don't think it does. The recent discussion pointed out other reasons why it is not more widely used. And I'm one of those in that discussion who explicitly agreed with those other reasons. And FWIW I think those reasons (verbosity etc.) are more important than the reason given in this report. There is, however, nothing in that discussion that argues that the reason given here is not relevant. > > I'm thinking, in particular, of people who are familiar > > with regexps (Elisp or other) but not with `rx'. >=20 > I'm one such person, and yet I see no problem with the > current documentation. Yes, you've made that clear. But please "feel free" to say it again. I too am one such person, and guess what...=20 > > > > 2. Please document (in the doc string of `rx', if nowhere else) the > > > > correspondences between each of the `rx' constructs and regexp > > > > syntax. At least please document the most important ones. For > > > > example, `zero-or-more' presumably corresponds to postfix regexp > > > > char `*'. > > > > > > Really? Doesn't "zero-or-more" define the effect as=20 > > > clearly as possible? I think it does. > > > > Perhaps you're missing the point. Yes, `zero-or-more' > > describes the effect. No, it does not tell you which > > `rx' construct corresponds to `*' in a regexp. Again, > > I'm thinking, in particular, of people who are familiar > > with regexps (Elisp or other) but not with `rx'. >=20 > Again, I'm one such person, and it was immediately clear > to me what 'zero-or-more' translates to. Again, it's about the other direction. Not finding out what `zero-or-more' means or translates to in a regexp, but finding out what `*' in a regexp translates to in `rx'. Quick, what does a shy regexp group translate to in `rx'? (There is no correspondence, because none is needed.) In general, it's _not obvious_ how a given regexp would be translated to `rx'. It would be helpful to be able to easily translate regexps to `rx' sexps. The doc for `rx' could help with that by providing an explicit mapping between the two. Do you disagree that that would be helpful? The mapping exists in the code, of course, but only in the direction rx-to-regexp. For someone new to `rx' who wants to analyze a regexp into its `rx' constituents, or who wants to replace a regexp by an equivalent `rx' sexp, documenting a regexp-to-rx mapping would help. And (as you've said more than once) "I'm one such person." In addition, it would be good to have a Lisp function that performs a regexp-to-rx translation. > > You must scan 212 lines (!) of doc string before you get to > > `and' (aka `seq', aka `:', aka `sequence'), which tells you > > how to write a sequence of patterns. > > There will always be something for which you will need to scan 212 > lines before you get to it. There isn't too much one can say on a > single line, so something's gotta give. That's an argument that says only that different orders are possible. Unless you are trying to make the even less useful argument that the order chosen makes no difference. Not everything can be stated first, clearly. Such a truism has no relevance for choosing which order to use. Different orders serve different purposes. > > > Having said all that, if someone wants to work on this and thinks > > > they can improve on the current state of affairs, feel free. > > > > I certainly _hope_ people feel free to help. I guess > > you say that to make clear that you are leaving the > > request open. >=20 > Did you see me close it? Did I say you closed it?