unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Daniel Martín" <mardani29@yahoo.es>
To: emacs-devel@gnu.org
Subject: [PATCH] A program to overlay Elisp regular expressions in rx form
Date: Sun, 15 Nov 2020 12:16:52 +0100	[thread overview]
Message-ID: <m1a6vi27kr.fsf@yahoo.es> (raw)
In-Reply-To: m1a6vi27kr.fsf.ref@yahoo.es

[-- Attachment #1: Type: text/plain, Size: 1134 bytes --]


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.

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.

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.

A first version of this program is attached to this email, along with
some tests that demonstrate how it works.

Thanks.

[1] https://elpa.gnu.org/packages/xr.html


[-- Attachment #2: regexp-expand.el --]
[-- Type: application/emacs-lisp, Size: 8702 bytes --]

[-- Attachment #3: regexp-expand-test.el --]
[-- Type: application/emacs-lisp, Size: 5027 bytes --]

       reply	other threads:[~2020-11-15 11:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m1a6vi27kr.fsf.ref@yahoo.es>
2020-11-15 11:16 ` Daniel Martín [this message]
2020-11-15 11:21   ` Re:[PATCH] A program to overlay Elisp regular expressions in rx form tumashu
2020-11-15 11:50   ` [PATCH] " Jean Louis
2020-11-15 14:03   ` Clément Pit-Claudel
2020-11-16 19:20     ` Daniel Martín
2020-11-15 18:15   ` Drew Adams
2020-11-16 13:25     ` Daniel Martín

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1a6vi27kr.fsf@yahoo.es \
    --to=mardani29@yahoo.es \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).