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: Re: bug#1756: awk-mode: An empty line is not a paragraph separator (should be) Date: Mon, 5 Jan 2009 16:12:09 +0000 Message-ID: <20090105161209.GB2501@muc.de> References: <87sko35t3u.fsf@iki.fi> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1231170959 7256 80.91.229.12 (5 Jan 2009 15:55:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Jan 2009 15:55:59 +0000 (UTC) Cc: bug-cc-mode@gnu.org, bug-gnu-emacs@gnu.org To: Teemu Likonen , 1756@emacsbugs.donarmstrong.com Original-X-From: cc-mode-help-bounces@lists.sourceforge.net Mon Jan 05 16:57:09 2009 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.50) id 1LJrpB-0004Ud-U0 for sf-cc-mode-help@m.gmane.org; Mon, 05 Jan 2009 16:57:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by 335xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1LJrnw-0003Qi-8E; Mon, 05 Jan 2009 15:55:48 +0000 Original-Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by 335xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1LJrnv-0003Qc-1M for cc-mode-help@lists.sourceforge.net; Mon, 05 Jan 2009 15:55:47 +0000 Received-SPF: neutral (1b2kzd1.ch3.sourceforge.com: 140.186.70.10 is neither permitted nor denied by domain of muc.de) client-ip=140.186.70.10; envelope-from=acm@muc.de; helo=fencepost.gnu.org; Original-Received: from fencepost.gnu.org ([140.186.70.10]) by 1b2kzd1.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1LJrnl-0005Jq-Nq for cc-mode-help@lists.sourceforge.net; Mon, 05 Jan 2009 15:55:47 +0000 Original-Received: from mx10.gnu.org ([199.232.76.166]:54303) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1LJrmb-0003t6-UO for bug-cc-mode@gnu.org; Mon, 05 Jan 2009 10:54:26 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1LJrng-0000Xc-9r for bug-cc-mode@gnu.org; Mon, 05 Jan 2009 10:55:33 -0500 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on monty-python X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_PASS autolearn=failed version=3.1.0 Original-Received: from colin.muc.de ([193.149.48.1]:2989 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LJrnf-0000X2-OE for bug-cc-mode@gnu.org; Mon, 05 Jan 2009 10:55:32 -0500 Original-Received: (qmail 96908 invoked by uid 3782); 5 Jan 2009 15:55:26 -0000 Original-Received: from acm.muc.de (pD9E515A5.dip.t-dialin.net [217.229.21.165]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Mon, 05 Jan 2009 16:55:24 +0100 Original-Received: (qmail 7678 invoked by uid 1000); 5 Jan 2009 16:12:09 -0000 Content-Disposition: inline In-Reply-To: <87sko35t3u.fsf@iki.fi> 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 monty-python.gnu.org: FreeBSD 4.6-4.9 X-Spam-Score: -2.8 (--) X-Spam-Report: Spam detection software, running on the system "g92kzd1.ch3.sourceforge.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi, Teemu! On Thu, Jan 01, 2009 at 10:27:17AM +0200, Teemu Likonen wrote: > In awk-mode an empty line is not considered a paragraph separator, only > lines containing whitespace and "#" character(s) are. After running the > command "M-x awk-mode" the value of both paragraph-start and > paragraph-separate are set as follows: [...] Content analysis details: (-2.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [140.186.70.10 listed in list.dnswl.org] 1.2 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) X-Headers-End: 1LJrnl-0005Jq-Nq X-BeenThere: cc-mode-help@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: "Bug reports, feature requests, and general talk about CC Mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cc-mode-help-bounces@lists.sourceforge.net Xref: news.gmane.org gmane.emacs.cc-mode.general:5274 gmane.emacs.bugs:23796 Archived-At: Hi, Teemu! On Thu, Jan 01, 2009 at 10:27:17AM +0200, Teemu Likonen wrote: > In awk-mode an empty line is not considered a paragraph separator, only > lines containing whitespace and "#" character(s) are. After running the > command "M-x awk-mode" the value of both paragraph-start and > paragraph-separate are set as follows: > "[ \t]*\\(#+\\)[ \t]*$\\|^\f" > ^^ > See, at least one # is required. I think better default would be #* so > that empty lines or lines with only whitespace would be paragraph > separators too. Agreed. Thanks for the report. > I suggest doing the following change: > [ Tweaking the definition of c-comment-prefix-regexp. ] I'd rather not do it this way, because although c-comment-prefix-regexp isn't currently used anywhere else, it might be in the future. A blank line cannot be a comment prefix in AWK. > (pike-mode and "other" have a comment prefix regexp which matches a zero > number of comment prefix characters: \**) Can you please try the following patch (it might be a few lines offset from the given line numbers). It checks whether the comment prefix matches a blank line, and fixes paragraph-s{tart,eparate} if it doesn't. ######################################################################### *** orig/cc-styles.el 2009-01-05 11:49:10.753657960 +0000 --- cc-styles.el 2009-01-05 15:29:34.569332408 +0000 *************** *** 512,525 **** (assoc 'other c-comment-prefix-regexp))) c-comment-prefix-regexp)) ! (let ((comment-line-prefix ! (concat "[ \t]*\\(" c-current-comment-prefix "\\)[ \t]*"))) ! (setq paragraph-start (concat comment-line-prefix c-paragraph-start "\\|" page-delimiter) ! paragraph-separate (concat comment-line-prefix c-paragraph-separate "\\|" page-delimiter) --- 512,532 ---- (assoc 'other c-comment-prefix-regexp))) c-comment-prefix-regexp)) ! (let* ((empty-is-prefix (string-match c-current-comment-prefix "")) ! (nonws-comment-line-prefix ! (concat "\\(" c-current-comment-prefix "\\)[ \t]*")) ! (comment-line-prefix (concat "[ \t]*" nonws-comment-line-prefix)) ! (blank-or-comment-line-prefix ! (concat "[ \t]*" ! (if empty-is-prefix "" "\\(") ! nonws-comment-line-prefix ! (if empty-is-prefix "" "\\)?")))) ! (setq paragraph-start (concat blank-or-comment-line-prefix c-paragraph-start "\\|" page-delimiter) ! paragraph-separate (concat blank-or-comment-line-prefix c-paragraph-separate "\\|" page-delimiter) ######################################################################### > There is another and related bug. It is possible to configure the > comment prefix regexp with the option c-comment-prefix-regexp. But the > problem is that the option only takes effect when awk-mode is turned on. > If user later changes indentation style with the command c-set-style > (bound to C-c .) then it seems that the hard-coded default (#+) takes > preference over user's c-comment-prefix-regexp settings. I'll get back to you on this one. Thanks again for the bug report. -- Alan Mackenzie (Nuremberg, Germany). ------------------------------------------------------------------------------