From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: [PATCH] A program to overlay Elisp regular expressions in rx form Date: Sun, 15 Nov 2020 10:15:42 -0800 (PST) Message-ID: <7da5af26-fa27-42af-bf36-af4a8ffe85d6@default> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36897"; mail-complaints-to="usenet@ciao.gmane.io" To: =?iso-8859-1?B?RGFuaWVsIE1hcnTtbg==?= , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 15 19:17:05 2020 Return-path: Envelope-to: ged-emacs-devel@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 1keMaD-0009Nu-HE for ged-emacs-devel@m.gmane-mx.org; Sun, 15 Nov 2020 19:17:01 +0100 Original-Received: from localhost ([::1]:35744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1keMaC-0001LE-9n for ged-emacs-devel@m.gmane-mx.org; Sun, 15 Nov 2020 13:17:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keMZ8-0000XB-3T for emacs-devel@gnu.org; Sun, 15 Nov 2020 13:15:54 -0500 Original-Received: from userp2120.oracle.com ([156.151.31.85]:59384) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keMZ5-0001ht-PG for emacs-devel@gnu.org; Sun, 15 Nov 2020 13:15:53 -0500 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AFI9eTR125049; Sun, 15 Nov 2020 18:15:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=mcwsehBGp/d2efZ0Q/zBAx4oVpSAu8vbXzrTFjwKQ0w=; b=lcVg8qaBWHZ/tdln9NgLQknUCzKGd2tfBCzjL+tBZgBMjDMsQ8zKR2cwYniBlhuJtljT H4STfUgnORAy6QyfwDtc0aEPvJ50xAl5XbCzm6GRjGE6XgBHDd7EhdTzvy77Wo7t7qTi 2UTIxx66XKK7snqGhONrzmntXQZi8b+8QlkIs2uJxRXCKqkFVRGy9PJCw3deqDGpHoKl 3KkA/WRc0SrBew2gsE2p2vbN/PnC6rtE+iVUP4oTX2ChPKsklFxNRznLU7fRX3ady50w bIkuQ0sT8U1DeYp878DKJaUqnHi3mb0J7ObkGFzZXWD2jxR/tYzwS5h0MZtRt3AKYBYB Qg== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 34t7vmtk8k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 15 Nov 2020 18:15:49 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AFIAPrH060525; Sun, 15 Nov 2020 18:15:49 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 34ts5tvbj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 15 Nov 2020 18:15:49 +0000 Original-Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AFIFh9Q003455; Sun, 15 Nov 2020 18:15:48 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5071.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9806 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 phishscore=0 suspectscore=0 mlxscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011150118 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9806 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 mlxscore=0 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011150118 Received-SPF: pass client-ip=156.151.31.85; envelope-from=drew.adams@oracle.com; helo=userp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/15 13:15:50 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:259202 Archived-At: > Understanding complex regular expressions in Emacs Lisp code (for > example, the ones in compile.el) is sometimes difficult with all the > backslashes, so I've written a program that, using the ELPA package > xr[1], enters a minor mode that overlays the rx form of any regular > expression string. This idea came from macroexpand and how it helps > with understanding Lisp macros. >=20 > This program autoloads a new function: regexp-expand. When the point > is > in a program string and regexp-expand is invoked, Emacs enters a minor > mode that puts the buffer temporarily in read-only mode and shows the > regular expression in rx form as an overlay. You can ask for help > about > the rx notation by pressing e. You can exit the minor mode and return > to the original text by pressing q. >=20 > Is there general interest in this kind of functionality as a free > program? I don't know if this could be a new feature of the xr package > (most probably), or if it could be its own separate package. >=20 > A first version of this program is attached to this email, along with > some tests that demonstrate how it works. This kind of feature was discussed earlier (here, I think). I'm glad to see it get implemented. Thanks for working on this. Seeing a corresponding rx expression in an overlay helps. I think it would also help to be able to get hold of that rx expression, as usable text. Think of `pp.el', for example. You can show the output in the echo area or in a separate buffer. (Library `pp+.el' lets you optionally show it in a tooltip.) My point is that there are different use cases, including (1) various ways to view the rx expression and (2) some way to obtain, and make use of, its text. Typically in Emacs (in the past), the gimme-the-plain-text feature (i.e., #2) has come first. It's the most useful, I think. Maybe you or Clement have already provided a way to optionally show the text in a separate buffer (i.e., #2). If so, great. If not, maybe consider that as a possible enhancement. ___ https://www.emacswiki.org/emacs/PpPlus https://www.emacswiki.org/emacs/download/pp%2b.el