[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1756: awk-mode: An empty line is not a paragraph separator (should b
From: |
Alan Mackenzie |
Subject: |
bug#1756: awk-mode: An empty line is not a paragraph separator (should be) |
Date: |
Mon, 5 Jan 2009 16:12:09 +0000 |
User-agent: |
Mutt/1.5.9i |
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).