[Top][All Lists]

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

Re: Suggestion: check for \n, \t in regexp for query-replace-regexp

From: Michael J Downes
Subject: Re: Suggestion: check for \n, \t in regexp for query-replace-regexp
Date: 04 Dec 2001 09:20:53 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

address@hidden (Richard Stallman) writes:

> I made it warn about such input but not reject it.
> After all, you might want to replace a backslash and an n.

(?) Maybe I am misunderstanding something here, but the regular
expression that I supplied in the prototype function
probable-regexp-error for checking the string entered by the user did
not give a false match for that case (that was one of the cases that I
explicitly tested because of the obvious potential for going wrong
there). Or did I miss some boundary case somewhere?

If we are on the same page, then when the user is prompted for a regexp,
'x\\n' should be accepted and search for three characters x \ n, 'xn'
should be accepted and search for two characters x n, but 'x\n' should
probably always get a warning because it does not do anything more
useful than 'xn' and is more cumbersome to enter, but most of all
because the user almost certainly was wishing to get a newline character
for the \n.

Indeed it might be worth considering whether it should simply be
silently converted to a newline character, for the sake of user
friendliness---bearing in mind that I am only talking about the case
where the expression is entered interactively in a user-level
command---even though that would not be strictly consistent with the
advertised regexp rules.

Michael Downes

reply via email to

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