]> git.eshelyaron.com Git - emacs.git/commitdiff
(comment-indent): Fully update INDENT
authorRichard M. Stallman <rms@gnu.org>
Wed, 16 Aug 2006 05:05:56 +0000 (05:05 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 16 Aug 2006 05:05:56 +0000 (05:05 +0000)
before checking to see if it will change the text.

lisp/newcomment.el

index 5dfa1eb89598df470e26df8fafbc7cf8000d528a..358c834de738c42dcb2dc83222d405fb8afdfe3d 100644 (file)
@@ -599,11 +599,16 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any."
                    (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))))