Subject: Re: bug#31953: feature request - `highlight-rx` interactively

From: VanL <[email-masked]>
Date: Sat, 02 Nov 2019 19:30:46 +1100

Juri Linkov <[email-masked]> writes:

>>> i.e. These would be equivalent:
>>>
>>> M-x highlight-rx RET (or "foo" "bar") RET
>>> M-x highlight-regexp RET \(foo\|bar\) RET
>>
>> What I can tell from the emacs-devel list and the git log is the rx
>> feature is being worked on.  I'd like to use rx everywhere regexp occurs
>> and highlight-rx would be the first easy use case.
>
> Do you mean using rx also in all search and replace commands?

I guess so if that makes sense to do farther down the track.
The advantage to using rx is to avoid those repeating
pathological toothpick sequences that are difficult to track.
For now, highlight-rx for searching is enough.

> But the documentation says:
>
>      The ‘rx’ notation is mainly useful in Lisp code; it cannot be used in
>   most interactive situations where a regexp is requested, such as when
>   running ‘query-replace-regexp’ or in variable customisation.

For search and replace, I don't know if it would be possible to
use in org-mode in the future, say, a table of three columns
having

1. input pattern
2. output 'desired' pattern
3. rx pattern which is generated automatically for 2

>> At the limit there are things expressible in regexp that rx won't be
>> able to.  And, in that case, I'd like to see in the rx documentation
>> a sign post to regexp at depth for that.  And, if there are patterns
>> rx and/or regexp are unable to express then providing a see also for
>> those would be a help.
>
> There is still some shortcomings in the current rx shorthands: ...

I guess the rx keywords will evolve to fit better with
experience.  Statistics are beginning to be collected on the
reported bugs.  Perhaps, rx can be used there where it makes
sense.