changeset 72410:f945b59b4f03

(comment-indent): Fully update INDENT before checking to see if it will change the text.
author Richard M. Stallman <rms@gnu.org>
date Wed, 16 Aug 2006 05:05:56 +0000
parents 4130a8f38950
children b11613448626
files lisp/newcomment.el
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/newcomment.el	Wed Aug 16 05:05:08 2006 +0000
+++ b/lisp/newcomment.el	Wed Aug 16 05:05:56 2006 +0000
@@ -599,11 +599,16 @@
 		    (if (and other (<= other max) (> other min))
 			;; There is a comment and it's in the range: bingo.
 			(setq indent other))))))))
+	;; Update INDENT to leave at least one space
+	;; after other nonwhite text on the line.
+	(save-excursion
+	  (skip-chars-backward " \t") 
+	  (unless (bolp)
+	    (setq indent (max indent (1+ (current-column))))))
+	;; If that's different from comment's current position, change it.
 	(unless (= (current-column) indent)
-	  ;; If that's different from current, change it.
 	  (delete-region (point) (progn (skip-chars-backward " \t") (point)))
-	  (indent-to (if (bolp) indent
-		       (max indent (1+ (current-column)))))))
+	  (indent-to indent)))
       (goto-char cpos)
       (set-marker cpos nil))))