[comp.emacs] query-replace anomaly

steve@yetti.UUCP (11/04/87)

I've noticed a problem with query-replace (GNU EMACS v18.47).  When I wish to 
do a query-replace to a capitalized word all goes well (the capitalization  
remains intact).  HOwever, when replacing the same word elsewhere in the 
file (that are not capitalized) they get capitalized.  Anybody notice this 
problem.  Anybody got a fix for it?

Steve Azmier

jr@LF-SERVER-2.BBN.COM (John Robinson) (11/09/87)

No fix should be necessary, according to the documentation:

 query-replace:
 Replace some occurrences of FROM-STRING with TO-STRING.
 As each match is found, the user must type a character saying
 what to do with it.  For directions, type C-h at that time.

 Preserves case in each replacement if  case-replace  and  case-fold-search
 are non-nil and FROM-STRING has no uppercase letters.
 Third arg DELIMITED (prefix arg if interactive) non-nil means replace
 only matches surrounded by word boundaries.

If you set case-replace and case-fold-search and only use lower case
in the FROM-STRING (first) argument, capitalization of the
replacement should match that of the replaced text.  It's always
worked fine for me.

/jr
jr@bbn.com or jr@bbn.uucp

wolfgang@mgm.mit.edu (Wolfgang Rupprecht) (11/09/87)

In article <8711091504.AA25772@ucbvax.Berkeley.EDU> jr@ALEXANDER.BBN.COM writes:
>No fix should be necessary ...

No there is indeed a compiler bug on some machines. (I know that at
one time Sun-3's were buggy, while Vax's were ok.) The bug causes ALL
replacements to be up-shifted if case-replace and case-fold-search are
t. I seem to recall that it was due bad code being generated for
'register char' variables on the Sun. I don't have a Sun any more, so
I can't say if it is still a problem. If Sun could provide me with a
test machine ... 	;-)
--
Wolfgang Rupprecht	UUCP: mit-eddie!mgm.mit.edu!wolfgang
				(or) mirror!mit-mgm!wolfgang
			ARPA: wolfgang@mgm.mit.edu (IP addr 18.82.0.114)