Subject: bug#15836: 24.3; query-replace-regexp does not detect incorrect usage of \#

From: Stefan Monnier <[email-masked]>
Date: Fri, 08 Nov 2013 18:15:16 -0500

> Hmm, perhaps replace-eval-replacement could temporarily bind
> the function definition of replace-count to some informative error
> message ("\# used in function context")?

Sorry, I don't like this idea.  Much too specific to the particular way
the user screwed up.

I guess we could byte-compile the expression, which would give the user
actual warnings about his code before running it, but I'm afraid this
medicine would be worse than the disease.

Another approach would be to refrain from substituting \# and
instead to let-bind it during the evaluation.

        Stefan