[comp.emacs] script files

yehuda@victoria.CWRU.EDU (Yechiel Yehuda) (02/27/89)

	After I create a script file of something and send it to be 
  printed, I first have to go into Emacs and edit all those damn
  ^M and ^Ds.  It is such a pain.  A sysop here wrote a little C
  program to clean the files but I still want to see if I can do it in 
  Emacs.

	Is there any way to *quickly* clean a file of control characters
  in Emacs?
				Thanks,
				Gil Yehuda

--
Y. Gil Yehuda     gil@bach.ces.cwru.edu   yehuda@skybridge.scl.cwru.edu
							 ^.sdi.cwru.edu
See'yag Li'chachma Shtika 

mesard@bbn.com (Wayne Mesard) (02/27/89)

In article <517@cwjcc.CWRU.Edu> yehuda@victoria.UUCP (Yechiel Yehuda) writes:
>	Is there any way to *quickly* clean a file of control characters
>  in Emacs?

Well how *quickly* can you type the following (when you're at the top of
the buffer):

  =>    <Escape> x query-replace-regexp <Return>
                  This runs the Query Replace Regexp command.
  =>    [<Ctrl-Q><Ctrl-@>-<Ctrl-Q><Ctrl-H><Ctrl-Q><Ctrl-K>
         <Ctrl-Q><Ctrl-M>-<Ctrl-Q><Ctrl-_>]+<Return>
                  This results in: "[^@-^H^K^M-^_]+" and is a regular expression
                  describing a string of one or more control chars (excluding
                  Tabs, Linefeeds and page breaks).
  =>   <Return>
                  Enters an empty replacement string.
  =>   !
                  Tells Emacs to do all the replacements it can without
                  asking you to confirm them.

[It's not as difficult as my verbose description makes it sound.  It can
be done in two dozen keystrokes, actually.]
 
The above assumes you're using GNU Emacs, although you didn't say:-(

Disclaimer: For the next two weeks people will be sending you elisp code
            to do what you've asked.  Don't worry, they mean well :-)

-- 
unsigned *Wayne_Mesard();
MESARD@BBN.COM
BBN, Cambridge, MA       

jbw@bucsb.UUCP (jbw) (02/28/89)

In article <517@cwjcc.CWRU.Edu> yehuda@victoria.UUCP (Yechiel Yehuda) writes:
>	After I create a script file of something and send it to be 
>  printed, I first have to go into Emacs and edit all those damn
>  ^M and ^Ds.  It is such a pain.  A sysop here wrote a little C
>  program to clean the files but I still want to see if I can do it in 
>  Emacs.
>	Is there any way to *quickly* clean a file of control characters
>  in Emacs?

Try this:
ESC ESC (load "man")
M-x nuke-nroff-bs

This usually works for me.  (I've also got a short shell script that
does this.)

--
Joe Wells
INTERNET: jbw%bucsf.bu.edu@bu-it.bu.edu    IP: [128.197.2.9]
UUCP: ...!harvard!bu-cs!bucsf!jbw