From: martin rudalics <address@hidden>
To: Herbert Euler <address@hidden>
CC: address@hidden, address@hidden, address@hidden,
address@hidden, address@hidden, address@hidden
Subject: Re: Fill for // style comments in C
Date: Mon, 27 Nov 2006 10:47:29 +0100
> And in c-mode, pressing M-q in between comments like this:
>
> // A real long comment that will cause the fill command in Emacs C mode
> making mistakes.
>
> will get
>
> // A real long comment that will cause the fill command in Emacs C
> mode making mistakes.
It's because `c-fill-paragraph' calls `c-mask-paragraph' the latter
calls `fill-paragraph' and `fill-paragraph' gets it wrong since it has
`comment-end' set to " */" instead of nil. Does the attached workaround
remove the problem?
*** progmodes/cc-cmds.el Mon Nov 27 10:32:48 2006
--- progmodes/cc-cmds.el Mon Nov 27 10:33:20 2006
***************
*** 3897,3903 ****
(prog1
(save-restriction
(narrow-to-region beg end)
! (apply fun args))
(if point-rel
;; Restore point if it was outside the region.
(if (< point-rel 0)
--- 3897,3905 ----
(prog1
(save-restriction
(narrow-to-region beg end)
! (if (eq c-lit-type 'c++)
! (apply 'fill-comment-paragraph args)
! (apply fun args)))
(if point-rel
;; Restore point if it was outside the region.
(if (< point-rel 0)