all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* query-replace doesn't match spaces with soft newlines
@ 2008-02-08 12:08 David Reitter
  2008-02-10 22:52 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: David Reitter @ 2008-02-08 12:08 UTC (permalink / raw)
  To: emacs-pretest-bug

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

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.

This is with an up-to-date Emacs 22 CVS build.


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2193 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: query-replace doesn't match spaces with soft newlines
  2008-02-08 12:08 query-replace doesn't match spaces with soft newlines David Reitter
@ 2008-02-10 22:52 ` Juri Linkov
  2008-02-11  1:45   ` Miles Bader
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2008-02-10 22:52 UTC (permalink / raw)
  To: David Reitter; +Cc: emacs-pretest-bug

> 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.

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: query-replace doesn't match spaces with soft newlines
  2008-02-10 22:52 ` Juri Linkov
@ 2008-02-11  1:45   ` Miles Bader
  2008-02-12  0:16     ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Miles Bader @ 2008-02-11  1:45 UTC (permalink / raw)
  To: Juri Linkov; +Cc: David Reitter, emacs-pretest-bug

Juri Linkov <juri@jurta.org> writes:
> 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.

Because doing that makes many important emacs commands work incorrectly
(from the user's viewpoint) -- e.g., C-e will move to the end of the
paragraph...

-Miles

-- 
Marriage, n. The state or condition of a community consisting of a master, a
mistress and two slaves, making in all, two.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: query-replace doesn't match spaces with soft newlines
  2008-02-11  1:45   ` Miles Bader
@ 2008-02-12  0:16     ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2008-02-12  0:16 UTC (permalink / raw)
  To: Miles Bader; +Cc: David Reitter, emacs-pretest-bug

>> 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.
>
> Because doing that makes many important emacs commands work incorrectly
> (from the user's viewpoint) -- e.g., C-e will move to the end of the
> paragraph...

Ok, I see now.  Many commands are expected to work on the visual
representation, so only a few commands that incorrectly treat inserted
newlines should be fixed.  I see no problem in matching additional
newlines in `query-replace' and the regexp search, but I don't see
how to distinguish soft newlines inserted by longlines-mode and hard
newlines with the `hard' property using the regexp search, i.e. how
(re-search-forward "[ \t\n]") could find soft newlines and skip
hard newlines?

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-12  0:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-08 12:08 query-replace doesn't match spaces with soft newlines David Reitter
2008-02-10 22:52 ` Juri Linkov
2008-02-11  1:45   ` Miles Bader
2008-02-12  0:16     ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.