changeset 8467:b2cfcc126dac

(indent-c-exp): Preserve point when handling comments.
author Richard M. Stallman <rms@gnu.org>
date Sat, 06 Aug 1994 21:22:51 +0000
parents 3cca823100db
children 52940ba43041
files lisp/progmodes/c-mode.el
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/c-mode.el	Sat Aug 06 19:25:24 1994 +0000
+++ b/lisp/progmodes/c-mode.el	Sat Aug 06 21:22:51 1994 +0000
@@ -1249,17 +1249,18 @@
 		  (indent-to this-indent)))
 	    ;; Indent any comment following the text.
 	    (or (looking-at comment-start-skip)
-		(let ((beg (point)))
-		  (and (re-search-forward
-			comment-start-skip
-			(save-excursion (end-of-line) (point)) t)
-		       ;; Make sure the comment starter we found
-		       ;; is not actually in a string or quoted.
-		       (let ((new-state
-			      (parse-partial-sexp beg (point)
-						  nil nil state)))
-			 (and (not (nth 3 new-state)) (not (nth 5 new-state))))
-		      (progn (indent-for-comment) (beginning-of-line)))))))))))
+		(save-excursion
+		  (let ((beg (point)))
+		    (and (re-search-forward
+			  comment-start-skip
+			  (save-excursion (end-of-line) (point)) t)
+			 ;; Make sure the comment starter we found
+			 ;; is not actually in a string or quoted.
+			 (let ((new-state
+				(parse-partial-sexp beg (point)
+						    nil nil state)))
+			   (and (not (nth 3 new-state)) (not (nth 5 new-state))))
+			 (indent-for-comment)))))))))))
 
 ;; Look at all comment-start strings in the current line after point.
 ;; Return t if one of them starts a real comment.