diff Misc/python-mode.el @ 9136:e1b710e30acf legacy-trunk

(py-block-comment-prefix): Remove trailing space. Also explain that this string should not end with whitespace. (py-compute-indentation): Append whitespace regexp to py-block-comment-prefix so that any combination of intervening whitespace will be recognized.
author Barry Warsaw <barry@python.org>
date Tue, 22 Sep 1998 19:51:47 +0000
parents ce52e922fbb2
children 881b86398c20
line wrap: on
line diff
--- a/Misc/python-mode.el	Tue Sep 22 02:38:42 1998 +0000
+++ b/Misc/python-mode.el	Tue Sep 22 19:51:47 1998 +0000
@@ -156,12 +156,12 @@
 		 (const :tag "Align to column zero" nil))
   :group 'python)
 
-(defcustom py-block-comment-prefix "## "
+(defcustom py-block-comment-prefix "##"
   "*String used by \\[comment-region] to comment out a block of code.
 This should follow the convention for non-indenting comment lines so
 that the indentation commands won't get confused (i.e., the string
 should be of the form `#x...' where `x' is not a blank or a tab, and
-`...' is arbitrary)."
+`...' is arbitrary).  However, this string should not end in whitespace."
   :type 'string
   :group 'python)
 
@@ -1710,14 +1710,15 @@
 	(if (and (eq py-honor-comment-indentation nil)
 		 (fboundp 'forward-comment))
 	    (forward-comment (- (point-max)))
-	  (let (done)
+	  (let ((prefix-re (concat py-block-comment-prefix "[ \t]*"))
+		done)
 	    (while (not done)
 	      (re-search-backward "^[ \t]*\\([^ \t\n#]\\|#\\)" nil 'move)
 	      (setq done (or (bobp)
 			     (and (eq py-honor-comment-indentation t)
 				  (save-excursion
 				    (back-to-indentation)
-				    (not (looking-at py-block-comment-prefix))
+				    (not (looking-at prefix-re))
 				    ))
 			     (and (not (eq py-honor-comment-indentation t))
 				  (save-excursion