From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.cc-mode.general,gmane.emacs.bugs Subject: bug#193: Fix for bug#193. Date: Sun, 11 Jul 2010 18:55:59 +0000 Message-ID: <20100711185559.GE3134@muc.de> References: <4820D259.2060805@bbn.com> <20100709185115.GA3036@muc.de> <4C37CFB8.2020707@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1278874822 18704 80.91.229.12 (11 Jul 2010 19:00:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 11 Jul 2010 19:00:22 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Christoph Original-X-From: cc-mode-help-bounces@lists.sourceforge.net Sun Jul 11 21:00:20 2010 Return-path: Envelope-to: sf-cc-mode-help@m.gmane.org Original-Received: from lists.sourceforge.net ([216.34.181.88]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OY1lD-00086b-Sc for sf-cc-mode-help@m.gmane.org; Sun, 11 Jul 2010 21:00:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1OY1lC-00068p-Fe; Sun, 11 Jul 2010 19:00:18 +0000 Original-Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1OY1lA-00068i-N1 for cc-mode-help@lists.sourceforge.net; Sun, 11 Jul 2010 19:00:16 +0000 X-ACL-Warn: Original-Received: from fencepost.gnu.org ([140.186.70.10]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1OY1l9-0002Ci-DL for cc-mode-help@lists.sourceforge.net; Sun, 11 Jul 2010 19:00:16 +0000 Original-Received: from mail.gnu.org ([199.232.76.166]:55298 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OY1l3-0002UE-No for bug-cc-mode@gnu.org; Sun, 11 Jul 2010 15:00:09 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51209) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OY1l3-0000c3-Cv for bug-cc-mode@gnu.org; Sun, 11 Jul 2010 15:00:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OY1l1-0003K0-So for bug-cc-mode@gnu.org; Sun, 11 Jul 2010 15:00:08 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55470) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OY1l1-0003Jv-QG; Sun, 11 Jul 2010 15:00:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OY1XO-00063E-9f; Sun, 11 Jul 2010 14:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 11 Jul 2010 18:46:02 +0000 Resent-Message-ID: X-GNU-PR-Message: followup 193 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.127887394123254 (code B ref -1); Sun, 11 Jul 2010 18:46:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Jul 2010 18:45:41 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OY1X3-000631-11 for submit@debbugs.gnu.org; Sun, 11 Jul 2010 14:45:41 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OY1Wy-00062t-3z for submit@debbugs.gnu.org; Sun, 11 Jul 2010 14:45:39 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:56798) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OY1Wh-0000RE-LB for submit@debbugs.gnu.org; Sun, 11 Jul 2010 14:45:19 -0400 Original-Received: from [140.186.70.92] (port=37182 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OY1We-0007vy-U8 for bug-gnu-emacs@gnu.org; Sun, 11 Jul 2010 14:45:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OY1Wb-0001la-W4 for bug-gnu-emacs@gnu.org; Sun, 11 Jul 2010 14:45:15 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:2260 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OY1Wb-0001lH-KX for bug-gnu-emacs@gnu.org; Sun, 11 Jul 2010 14:45:13 -0400 Original-Received: (qmail 62677 invoked by uid 3782); 11 Jul 2010 18:45:11 -0000 Original-Received: from acm.muc.de (pD9E5395F.dip.t-dialin.net [217.229.57.95]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 11 Jul 2010 20:45:10 +0200 Original-Received: (qmail 10688 invoked by uid 1000); 11 Jul 2010 18:55:59 -0000 Content-Disposition: inline In-Reply-To: <4C37CFB8.2020707@gmail.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 11 Jul 2010 14:46:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.4 AWL AWL: From: address is in the auto white-list X-Headers-End: 1OY1l9-0002Ci-DL X-BeenThere: cc-mode-help@lists.sourceforge.net List-Id: "Bug reports, feature requests, and general talk about CC Mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: cc-mode-help-bounces@lists.sourceforge.net Errors-To: cc-mode-help-bounces@lists.sourceforge.net Xref: news.gmane.org gmane.emacs.cc-mode.general:5416 gmane.emacs.bugs:38410 Archived-At: 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). ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first