[Top][All Lists]

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

Re: (query-replace-regexp " +" " " nil) on single spaced text

From: David Kastrup
Subject: Re: (query-replace-regexp " +" " " nil) on single spaced text
Date: 15 Dec 2001 09:17:31 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

address@hidden (Dan Jacobson) writes:

> No, emacs is not as smart as it could be.  For instance I did
> (query-replace-regexp " +" " " nil)
> and it goes to all the single space areas like the spaces between
> these words and asks if I want to replace one space with one space.
> OK, maybe blame me instead for the weak regexp, but it is just a shame
> to see emacs do something obviously not so smart.  Ok, I should use "  +".
> Hmmm, well, at least it is acting correctly.  Probably safer than
> making it over smart.  Ok, never mind.

Please not that replacing a single space by a single space is *not* a
noop.  It touches the buffer and changes its modification date.  It
collapses all markers around the space, then moves them to before and
behind the replaced space according to their insertion type (actually,
does it really do that? Have not tried it).  It removes all original
text properties from the original space and replaces them by the text
properties derived from inserting the new space.

It makes one heck of a mess, in short.  I found out the hard way
because filling paragraphs might in cases mean replacing spaces with
spaces, and a package of mine reacts to changes because it keeps
visual overlays on the stuff.

David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: address@hidden

reply via email to

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