emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH] A program to overlay Elisp regular expressions in rx form


From: Drew Adams
Subject: RE: [PATCH] A program to overlay Elisp regular expressions in rx form
Date: Sun, 15 Nov 2020 10:15:42 -0800 (PST)

> 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.

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]