changeset 100926:ce85ae6ea7e8

(c-setup-paragraph-variables): Ensure paragraph-\(start\|separate\) match blank lines. For AWK Mode.
author Alan Mackenzie <acm@muc.de>
date Mon, 05 Jan 2009 21:22:20 +0000
parents dc25be6304b8
children 2530b3352d7a
files lisp/progmodes/cc-styles.el
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/cc-styles.el	Mon Jan 05 21:21:04 2009 +0000
+++ b/lisp/progmodes/cc-styles.el	Mon Jan 05 21:22:20 2009 +0000
@@ -510,14 +510,21 @@
 			  (assoc 'other c-comment-prefix-regexp)))
 	  c-comment-prefix-regexp))
 
-  (let ((comment-line-prefix
-	 (concat "[ \t]*\\(" c-current-comment-prefix "\\)[ \t]*")))
+  (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 comment-line-prefix
+    (setq paragraph-start (concat blank-or-comment-line-prefix
 				  c-paragraph-start
 				  "\\|"
 				  page-delimiter)
-	  paragraph-separate (concat comment-line-prefix
+	  paragraph-separate (concat blank-or-comment-line-prefix
 				     c-paragraph-separate
 				     "\\|"
 				     page-delimiter)