[EMAIL PROTECTED] writes:

> If I use M-x replace-regexp followed by
> "\(//\)[[:space:]] *" <RET> "\1 " <RET>
> the behaviour is correct - replacing any space
> between '//' ed comment text
> Ex.
> //___Text... => //_Text...
> where '_' is a space
>
> If I use the same
> replace-regexp "\(//\)[[:space:]] *" "\1 "
> in a function no replacing is done - Replaced 0 occurences -
>
> (defun comment-formatting(start end)
>  (interactive "*r")
>   (save-excursion
>     (save-restriction
>       (narrow-to-region start end)
>       (goto-char start)
>       (replace-regexp "\(//\)[[:space:]] *" "\1 "))))
>
> So M-x comment-formatting has differnt behaviour. Why?

It hasn't.  Just use
C-x ESC ESC
after the manual replacement to get a peek at what this did.  You'll
notice that the backslashes in string syntax have to be doubled.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to