[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Formatting comment lines (C code)
From: |
Peter Tury |
Subject: |
Re: Formatting comment lines (C code) |
Date: |
Thu, 21 Apr 2005 08:02:51 GMT |
Hi,
you can use
M-x replace-regexp "\(//\s \)\s *" "\1"
Note:
1. it doesn't insert a space if it is missing like in "//comment".
2. it uses "\s " what means "any character whose syntax is whitespace". See:
C-h s. ...
Br,
P
<luca.spinacci@seleniacomms.com> wrote in message
news:mailman.2351.1114065580.2895.help-gnu-emacs@gnu.org...
>
> I would like to format my comment lines
> replacing all spaces and tabs between
> '//' and the comment text with only one space.
> Ex.
> //____Text.... => //_Text
>
> where '_' is a space.
>
> I use replace-regexp "[^ a-zA-Z0-9/\.]" " "
> on a selection of my code but it
> doesn't work very well because replaces
> characters in the comment text
> - for instance replaces )(!-, etc. -.
>
> Any suggestion?
>
> Thank you very much.
> Luca
>
>
>