[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#193: Fix for bug#193.
From: |
Alan Mackenzie |
Subject: |
bug#193: Fix for bug#193. |
Date: |
Sun, 11 Jul 2010 18:55:59 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Christoph,
On Fri, Jul 09, 2010 at 07:41:12PM -0600, Christoph wrote:
> Hi Alan,
> On 7/9/2010 12:51 PM, Alan Mackenzie wrote:
> >Hi, Deniz,
> >On Sun, Jun 27, 2010 at 02:47:52PM +0200, Deniz Dogan wrote:
> >>Did anyone ever agree on what needs to be done to fix the problem?
> >Would you try this patch, please, and then tell me whether or not it
> >works fully. Thanks!
> M-q works fine for me with C as well as C++ style comments, both ways,
> i.e. shorting long comments and extending short comments to fill the line.
> The only "quirk" I found:
> Using C-style comments, if the original comment looks like this:
> /* This is a short comment
> which is extended */
> the resulting comment is:
> /* This is a short comment which is extended */
> Notice the two spaces after the last word 'extended', before the close
> comment marker.
The reason being that the filling function assumed that a comment ends
with a sentence, and should therefore leave two spaces after it.
However, if there's no full stop (etc.), the two spaces is silly.
> This might be nitpicking but I thought I bring it up.
We need nitpickers. ;-) Thanks for drawing it to my attention. Would
you please try this amended patch: It should leave just one space after
"is extended", but two spaces after "is extended.".
*** orig/cc-cmds.el 2010-07-05 20:17:46.000000000 +0000
--- cc-cmds.el 2010-07-11 18:46:13.066679040 +0000
***************
*** 3975,3980 ****
--- 3975,3988 ----
(goto-char ender-start)
(current-column)))
(point-rel (- ender-start here))
+ (sentence-ends-comment
+ (save-excursion
+ (goto-char ender-start)
+ (and (search-backward-regexp
+ (c-sentence-end) (c-point 'bol) t)
+ (goto-char (match-end 0))
+ (looking-at "[ \t]*")
+ (= (match-end 0) ender-start))))
spaces)
(save-excursion
***************
*** 4017,4023 ****
(setq spaces
(max
(min spaces
! (if sentence-end-double-space 2 1))
1)))
;; Insert the filler first to keep marks right.
(insert-char ?x spaces t)
--- 4025,4033 ----
(setq spaces
(max
(min spaces
! (if (and sentence-ends-comment
! sentence-end-double-space)
! 2 1))
1)))
;; Insert the filler first to keep marks right.
(insert-char ?x spaces t)
***************
*** 4229,4236 ****
(let ((fill-paragraph-function
;; Avoid infinite recursion.
(if (not (eq fill-paragraph-function 'c-fill-paragraph))
! fill-paragraph-function)))
! (c-mask-paragraph t nil 'fill-paragraph arg))
;; Always return t. This has the effect that if filling isn't done
;; above, it isn't done at all, and it's therefore effectively
;; disabled in normal code.
--- 4239,4249 ----
(let ((fill-paragraph-function
;; Avoid infinite recursion.
(if (not (eq fill-paragraph-function 'c-fill-paragraph))
! fill-paragraph-function))
! (start-point (point-marker)))
! (c-mask-paragraph
! t nil (lambda () (fill-region-as-paragraph (point-min) (point-max) arg)))
! (goto-char start-point))
;; Always return t. This has the effect that if filling isn't done
;; above, it isn't done at all, and it's therefore effectively
;; disabled in normal code.
> Christoph
Looking forward to hearing back from you,
--
Alan Mackenzie (Nuremberg, Germany).