[Top][All Lists]

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

Re: Improve `replace-regexp-in-string' ergonomics?

From: Mattias Engdegård
Subject: Re: Improve `replace-regexp-in-string' ergonomics?
Date: Tue, 12 Oct 2021 15:32:27 +0200

> you just
> have to transpose the groups down to where they were again before doing
> the replacement.

We don't even need transposing the match state at run time; we can just as well 
do the transposing in the replacement string templates at macro-expansion time. 
If those exceed the syntactic limits of group 9, then generate Lisp code as 
mentioned before. Don't do more at runtime than actually required.

Transposing the match state is only necessary when the user uses actual Lisp 
code for the replacement. Even that can be avoided by passing the group number 
offset as an argument to the user code -- I did that in one instance (although 
I recall Stefan didn't quite fancy it).

reply via email to

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