emacs-devel
[Top][All Lists]

Re: query-replace doesn't match spaces with soft newlines

 From: Juri Linkov Subject: Re: query-replace doesn't match spaces with soft newlines Date: Mon, 11 Feb 2008 00:52:40 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> It appears that query-replace' (or whatever this runs) does not properly
> match spaces in the search string with soft newlines. It  should do that
> just like isearch does now.
>
> I encountered this when I had longlines-mode' turned on and tried to
> replace a string in the following line(s):
>
> \item Adjoin: Combine the \slot{New Type} with the {\sc Context
> Type}   according to one of the combinatorial rules.
>
> Note that this is one paragraph, with a soft newline in between "Context"
> and "Type". To reproduce, enter it as one line and have  longlines-mode
> turned on (perhaps adjusting fill-column) so that it  breaks right there.
>
> Then do M-% {\s Context Type} RET bar RET
>
> The string will not be replaced.

Perhaps I missed a discussion about the design of longlines-mode,
so I don't understand why longlines-mode doesn't put a display'
property with a newline on whitespace to display it as soft newlines.
This would avoid many such problems.

If this is not possible, and replacing spaces with newlines is unavoidable,
then I suggest changing the plain search to the regexp search and
using search-spaces-regexp' to convert spaces to newlines to be able
to match them in search and replace commands.

--