[comp.emacs] MicroEmacs replace-string query

rda@epistemi.ed.ac.uk (Robert Dale) (10/23/88)

Sometimes, in MicroEmacs (I'm using 3.9e), I find I want to replace
^Ms at the end of lines by ^Js (sometimes I grab text from another
system where this is the convention, and I want to change it in the
editor).   However, if I say

	replace-string ^Q ^M <META> ^Q ^J <META>

(which is what I'd do in Gnu, for example) both the ^M and the ^J
appear on the screen as <NL>s, and no replacements are made.

Does anyone know of a way around this?

R
-- 
Robert Dale	   Phone: +44 31 667 1011 x6470	| University of Edinburgh
UUCP:	...!uunet!mcvax!ukc!its63b!epistemi!rda	| Centre for Cognitive Science
ARPA:	rda%epistemi.ed.ac.uk@nss.cs.ucl.ac.uk  | 2 Buccleuch Place
JANET:	rda@uk.ac.ed.epistemi			| Edinburgh EH8 9LW Scotland

andy@ocsmd.OCS.COM (Andy Liwen) (10/25/88)

In article <801@epistemi.ed.ac.uk> rda@epistemi.ed.ac.uk (Robert Dale) writes:
>Sometimes, in MicroEmacs (I'm using 3.9e), I find I want to replace
>^Ms at the end of lines by ^Js (sometimes I grab text from another
>system where this is the convention, and I want to change it in the
>editor).   However, if I say
>
>	replace-string ^Q ^M <META> ^Q ^J <META>
>
>(which is what I'd do in Gnu, for example) both the ^M and the ^J
>appear on the screen as <NL>s, and no replacements are made.
>
>Does anyone know of a way around this?

Miraculously, microEMACS uses the tab character as an escape character. 
In input.c the function getstring() does this wonderous deed.  We have
patched the routine to also check for a backslash as escape.  You can
get microE to do the search and replace you want by prefixing these
control symbols with the escape, <tab> [ed. ug!], symbol. 

//Andy Liwen


--
Andrew B. Liwen                                                    301/353-8514
Online Computer Systems                                      andy@brave.OCS.COM
20251 Century Blvd.                                         ..!uunet!ocsmd!andy
Germantown, MD 20874                         ..{ames|rutgers}!netsys!ocsmd!andy

jbayer@ispi.UUCP (id for use with uunet/usenet) (10/25/88)

In article <801@epistemi.ed.ac.uk>, rda@epistemi.ed.ac.uk (Robert Dale) writes:
> Sometimes, in MicroEmacs (I'm using 3.9e), I find I want to replace
> ^Ms at the end of lines by ^Js (sometimes I grab text from another
> system where this is the convention, and I want to change it in the
> editor).   However, if I say
> 
> 	replace-string ^Q ^M <META> ^Q ^J <META>
> 
> (which is what I'd do in Gnu, for example) both the ^M and the ^J
> appear on the screen as <NL>s, and no replacements are made.

I am using uEmacs 3.9n on a Xenix 386 system.  I tried the above and it worked.
It is possible that the terminal you are using is doing something funny, also
the stty settings may be screwed up.  If that is not the case then try to 
get 3.9n (from Daniel Lawrence's BBS) and try that.

Jonathan Bayer
Intelligent Software Products, Inc.

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (10/26/88)

In article <801@epistemi.ed.ac.uk> rda@epistemi.ed.ac.uk (Robert Dale) writes:
| Sometimes, in MicroEmacs (I'm using 3.9e), I find I want to replace
| ^Ms at the end of lines by ^Js (sometimes I grab text from another
| system where this is the convention, and I want to change it in the
| editor).   However, if I say
| 
| 	replace-string ^Q ^M <META> ^Q ^J <META>
| 
| (which is what I'd do in Gnu, for example) both the ^M and the ^J
| appear on the screen as <NL>s, and no replacements are made.

In input.c there is code about line 413 to change return into newline. I
found this to be a problem sometimes, and changed it. The code follows a
comment about the change, and the original looks like:
	if (c == (CTRL | 0x4d))
change the code to read:
	if (c == (CTRL | 0x4d) && !quotef)

This will cause the return to be taken as is in search and replace
strings. I just tried it, and 3.9e was the last version I got working
this way. The behavior you describe is in 3.9n and 3.9p.
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me