all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to remove strange return-commands ?
@ 2002-10-08 14:08 Martin Horoba
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Horoba @ 2002-10-08 14:08 UTC (permalink / raw)


Hi,

I want to get some files from noEmacs-windows-editors into Linux GNU
Emacs Editor.

But you cannot work because of "strange" return-commands from windows
in these files (->  ^M ).

How it's possible to remove/replace these commands with Emacs or any
other tools in Unix-Systems ?
(with the Emacs-replace-function you cannot find ^M)

Thanks for Help,
	Martin

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

* RE: How to remove strange return-commands ?
@ 2002-10-08 14:40 Bingham, Jay
  0 siblings, 0 replies; 4+ messages in thread
From: Bingham, Jay @ 2002-10-08 14:40 UTC (permalink / raw)


Those are carriage return characters (decimal value 13).  If you were searching for an up arrow (shift 6) followed by an M emacs will not match that with a carriage return.
Try this to match them:  C-Q C-M
This will insert a carriage return character into the search string.

I have seen much discussion on removing these from a buffer.  I am certain that there are many packages available to do this.  Since I wrote my own function before I discovered emacs packages I have not paid much attention to them.  You might want to take a look at the packages list at http://www.emacswiki.org/elisp/.  Or you could look in the archives of this list.  (My function is not quite ready for primetime).

-_
J_)
C_)ingham
.    HP - NonStop Austin Software & Services - Software Product Assurance
.    Austin, TX
. Language is the apparel in which your thoughts parade in public.
. Never clothe them in vulgar and shoddy attire.          -Dr. George W. Crane-

 -----Original Message-----
From: 	Martin Horoba [mailto:00spam00@gmx.net] 
Sent:	Tuesday, October 08, 2002 9:09 AM
To:	help-gnu-emacs@gnu.org
Subject:	How to remove strange return-commands ?

Hi,

I want to get some files from noEmacs-windows-editors into Linux GNU
Emacs Editor.

But you cannot work because of "strange" return-commands from windows
in these files (->  ^M ).

How it's possible to remove/replace these commands with Emacs or any
other tools in Unix-Systems ?
(with the Emacs-replace-function you cannot find ^M)

Thanks for Help,
	Martin
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: How to remove strange return-commands ?
       [not found] <mailman.1034088073.19575.help-gnu-emacs@gnu.org>
@ 2002-10-08 15:21 ` Richard V. Molen
  2002-10-09  7:06   ` Tim Cross
  0 siblings, 1 reply; 4+ messages in thread
From: Richard V. Molen @ 2002-10-08 15:21 UTC (permalink / raw)



>> I want to get some files from noEmacs-windows-editors into Linux GNU
>> Emacs Editor.
>> 
>> But you cannot work because of "strange" return-commands from windows
>> in these files (->  ^M ).
>> 
>> How it's possible to remove/replace these commands with Emacs or any
>> other tools in Unix-Systems ?
>> (with the Emacs-replace-function you cannot find ^M)

"Bingham, Jay" <Jay.Bingham@hp.com> writes:

> Those are carriage return characters (decimal value 13).  If you
> were searching for an up arrow (shift 6) followed by an M emacs will
> not match that with a carriage return.
> Try this to match them:  C-Q C-M
> This will insert a carriage return character into the search string.

I made a keyboard macro out of this which removes all ^M and saves the file.

;strip MS-DOS carriage return from file thus:
;1. goto top of file, 2. S-M-% C-Q C-M <RET> <RET> ! 3. C-x s
(fset 'stripCR
   [home ?\M-% ?\C-q ?\C-m return return ?! ?\C-x ?\C-s])
(global-set-key [f11] 'stripCR)

> 
> I have seen much discussion on removing these from a buffer.  I am
> certain that there are many packages available to do this.  Since I
> wrote my own function before I discovered emacs packages I have not
> paid much attention to them.  You might want to take a look at the
> packages list at http://www.emacswiki.org/elisp/.  Or you could look
> in the archives of this list.  (My function is not quite ready for
> primetime).
> 

For RedHat & Cygwin the dos2unix utility works nicely.  When uploading bash
scripts (for instance) from an M$ box to a RH Linux box, I run...
     dos2unix -k *.sh
...and that removes the carriage returns from all scripts ending in '.sh'.

Other *nix OSes use something else as I noticed in a post in this
group some time in the past month.

-- 
Richard V. Molen

Warning!!
Signature under construction, safety glasses required.

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

* Re: How to remove strange return-commands ?
  2002-10-08 15:21 ` Richard V. Molen
@ 2002-10-09  7:06   ` Tim Cross
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Cross @ 2002-10-09  7:06 UTC (permalink / raw)


rvmolen@bambecksystems.com (Richard V. Molen) writes:

> > Those are carriage return characters (decimal value 13).  If you
> > were searching for an up arrow (shift 6) followed by an M emacs will
> > not match that with a carriage return.
> > Try this to match them:  C-Q C-M
> > This will insert a carriage return character into the search string.
> 

Many people use perl to do this. The perl script is about 3 lines long
(actually, you can probably do it in one line). 

I'm wondering though - perhaps you can achieve the desired behavior by
playing around with the various coding style settings? I have'nt tried
it, but it may be worth looking at.

Tim
-- 
find / -iname microsoft -exec rm -rf {} \;

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

end of thread, other threads:[~2002-10-09  7:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-08 14:40 How to remove strange return-commands ? Bingham, Jay
     [not found] <mailman.1034088073.19575.help-gnu-emacs@gnu.org>
2002-10-08 15:21 ` Richard V. Molen
2002-10-09  7:06   ` Tim Cross
  -- strict thread matches above, loose matches on Subject: below --
2002-10-08 14:08 Martin Horoba

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.