From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#36496: [PATCH] Describe the rx notation in the lisp manual Date: Sun, 7 Jul 2019 17:56:31 -0700 (PDT) Message-ID: <2a29fbfb-7e94-4022-bbde-42d8b9f90fc8@default> References: <0C783D67-9502-408B-B845-5599BD596361@acm.org> <838stdbw8e.fsf@gnu.org> <83a7draccd.fsf@gnu.org> <0458803b-c701-4706-9843-174b7373cf23@default> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="91603"; mail-complaints-to="usenet@blaine.gmane.org" Cc: mattiase@acm.org, 36496@debbugs.gnu.org To: rms@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 08 03:07:38 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hkI7z-000NYQ-Jg for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Jul 2019 03:07:35 +0200 Original-Received: from localhost ([::1]:37898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkHxs-0005hw-NV for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jul 2019 20:57:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55568) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkHxn-0005ed-5l for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 20:57:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkHxm-00073i-16 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 20:57:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48778) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hkHxl-00073R-RJ for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 20:57:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hkHxl-0007DW-Nu for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 20:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jul 2019 00:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36496 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36496-submit@debbugs.gnu.org id=B36496.156254741627731 (code B ref 36496); Mon, 08 Jul 2019 00:57:01 +0000 Original-Received: (at 36496) by debbugs.gnu.org; 8 Jul 2019 00:56:56 +0000 Original-Received: from localhost ([127.0.0.1]:57599 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkHxg-0007DC-3Z for submit@debbugs.gnu.org; Sun, 07 Jul 2019 20:56:56 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:46056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkHxd-0007Cy-Ve for 36496@debbugs.gnu.org; Sun, 07 Jul 2019 20:56:54 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x680s5fY171200; Mon, 8 Jul 2019 00:56:33 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-2018-07-02; bh=qhrJqnnxIlNOkAiWVNPJJ28lEHPRFGaDh73xip3ggl0=; b=mDKeTeoyuUeKKgT2FFZIrjQmBT7263bEM2v3Q6HUXkmDWcnDkFgb/Rq3mOnXBYUNNNo8 R1GQck5Q9UrNFTL3+YIKAqqL1+52rDmDMGTOQNeSoaqr/A+/BjdhHCeHxKdrdmyY6Git L4sDYrrqsmeT0B4F3Irsxbok7izvS0zzjzE8+XvgypAXnujcTLddNy2XST8F3CHwE9Tx cO4uyyLhXWryvJfm/yNwD8HE7HlTimOPYS+Q7+aKHrxf0PgAI2A7bOe3bmyJcjlHK9BC blt8D9Sa+jSKgPH+NgYnteR9XnufwxeUVepNYcJaUePdsvDnxNp6tSDcyJl9Ym0FghAM 3A== Original-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2tjk2tbjk8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 08 Jul 2019 00:56:33 +0000 Original-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x680rHZo169662; Mon, 8 Jul 2019 00:56:32 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2tjhpc89bg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 08 Jul 2019 00:56:32 +0000 Original-Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x680uVYc025568; Mon, 8 Jul 2019 00:56:32 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4861.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9311 signatures=668688 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907080010 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9311 signatures=668688 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907080010 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: 209.51.188.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:162314 Archived-At: > > would be great if you could invoke a command on a > > regexp (e.g. a regexp string in code) and have an > > equivalent `rx' expression pop up, for inspection > > and understanding. >=20 > I agree. That would make rx much more convenient for people who like > the shortness of some regexps. It would also help someone understand a complex regexp. It could also help someone learn about regexps by, in effect analyzing them (on demand). It would also be good to be able to select _part_ of a complex regexp - a part that is itself a valid regexp, and use such an inspection command on just that part, to show what `rx' it corresponds to. IOW, select some text, not necessarily a string, and (if its a valid regexp) get its `rx' form. > It could be part of Lisp mode, so you > could use this on a regexp constant in a source file. >=20 > I suspect that the long-windedness of rx input is a substantial > deterrent to its use. It may be better for complex patterns but worse > for simple ones. >=20 > > It would be nice to be able to have only the result > > of `rx' in the code and be able to get its `rx' > > expression on demand. >=20 > I think it would be clearer, usually, for Lisp source to have the rx > form. That would help people get used to rx. For complex patterns, > the rx form is easier to understand and change. >=20 > WHat would people think of making all the functions that want a regexp > accept an rx input equivalently? If the arg is not a string, treat it > as rx format. Do you mean they'd accept a quoted `rx' form (list)? What would a use case be - as opposed to accepting the result of macro-expanding such a form? Assuming there's good use case, maybe so.=20 [But there may be some functions that already have a (different) interpretation of a list value for the same arg that could alternatively be a regexp string. (So maybe not "all" such functions.)] > Compilation could convert a constant non-string, for > such args, to a regexp string. Same question as above, about the use case for a quoted `rx'-form arg (versus macro-expanding it to provide a regexp string arg). Even assuming such a use case, should the compiler assume that _every_ such list arg should be compiled to a regexp string? And wouldn't such compile-time conversion just amount to macro-expanding it? I guess I might be missing your point/suggestion. > Commands that read a regexp using the minibuffer could offer a key to > say that you are entering rx format. Sounds good to me. > The only problem is, which key would it be? Some non-repeatable key. Some key that can't be used (by default) to edit minibuffer text. Maybe something like `C-x x'?