aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1994-08-06 21:22:51 +0000
committerRichard M. Stallman1994-08-06 21:22:51 +0000
commit62057cefc1ae55ad555bbeadea006ca951bf5b1b (patch)
tree2d60a446b3618a5ab53305861de9336dbd91a477 /lisp
parentcb88b56ea9ea0a8c2e6ee5a2d61094d432ab93af (diff)
downloademacs-62057cefc1ae55ad555bbeadea006ca951bf5b1b.tar.gz
emacs-62057cefc1ae55ad555bbeadea006ca951bf5b1b.zip
(indent-c-exp): Preserve point when handling comments.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/c-mode.el23
1 files changed, 12 insertions, 11 deletions
diff --git a/lisp/progmodes/c-mode.el b/lisp/progmodes/c-mode.el
index a2478b6edfa..f3dadc81e81 100644
--- a/lisp/progmodes/c-mode.el
+++ b/lisp/progmodes/c-mode.el
@@ -1249,17 +1249,18 @@ If within a string or comment, move by sentences instead of statements."
1249 (indent-to this-indent))) 1249 (indent-to this-indent)))
1250 ;; Indent any comment following the text. 1250 ;; Indent any comment following the text.
1251 (or (looking-at comment-start-skip) 1251 (or (looking-at comment-start-skip)
1252 (let ((beg (point))) 1252 (save-excursion
1253 (and (re-search-forward 1253 (let ((beg (point)))
1254 comment-start-skip 1254 (and (re-search-forward
1255 (save-excursion (end-of-line) (point)) t) 1255 comment-start-skip
1256 ;; Make sure the comment starter we found 1256 (save-excursion (end-of-line) (point)) t)
1257 ;; is not actually in a string or quoted. 1257 ;; Make sure the comment starter we found
1258 (let ((new-state 1258 ;; is not actually in a string or quoted.
1259 (parse-partial-sexp beg (point) 1259 (let ((new-state
1260 nil nil state))) 1260 (parse-partial-sexp beg (point)
1261 (and (not (nth 3 new-state)) (not (nth 5 new-state)))) 1261 nil nil state)))
1262 (progn (indent-for-comment) (beginning-of-line))))))))))) 1262 (and (not (nth 3 new-state)) (not (nth 5 new-state))))
1263 (indent-for-comment)))))))))))
1263 1264
1264;; Look at all comment-start strings in the current line after point. 1265;; Look at all comment-start strings in the current line after point.
1265;; Return t if one of them starts a real comment. 1266;; Return t if one of them starts a real comment.