* Formatting comment lines (C code)
@ 2005-04-21 6:38 luca.spinacci
0 siblings, 0 replies; 2+ messages in thread
From: luca.spinacci @ 2005-04-21 6:38 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Formatting comment lines (C code)
[not found] <mailman.2351.1114065580.2895.help-gnu-emacs@gnu.org>
@ 2005-04-21 8:02 ` Peter Tury
0 siblings, 0 replies; 2+ messages in thread
From: Peter Tury @ 2005-04-21 8:02 UTC (permalink / raw)
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
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-21 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.2351.1114065580.2895.help-gnu-emacs@gnu.org>
2005-04-21 8:02 ` Formatting comment lines (C code) Peter Tury
2005-04-21 6:38 luca.spinacci
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.