aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-01-25 00:41:22 +0000
committerRichard M. Stallman1995-01-25 00:41:22 +0000
commit29869734a590d0b400d5fbdb4b4867e0a14949e4 (patch)
tree11dc59ab1b88498757a3f5df473f2ad866d5b222
parent5f63637658b029f362aa03ade8b323c304d4291b (diff)
downloademacs-29869734a590d0b400d5fbdb4b4867e0a14949e4.tar.gz
emacs-29869734a590d0b400d5fbdb4b4867e0a14949e4.zip
(c-forward-conditional):
If an apparent conditional is not really a conditional, skip past it. (c-fill-paragraph): If comment terminator is on a separate line, don't include that line in the filling.
-rw-r--r--lisp/progmodes/c-mode.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/progmodes/c-mode.el b/lisp/progmodes/c-mode.el
index c59efbfd821..cb993c5c462 100644
--- a/lisp/progmodes/c-mode.el
+++ b/lisp/progmodes/c-mode.el
@@ -447,6 +447,15 @@ preserving the comment indentation or line-starting decorations."
447 (search-forward "*/" nil 'move) 447 (search-forward "*/" nil 'move)
448 (forward-line 1) 448 (forward-line 1)
449 (point))) 449 (point)))
450 (goto-char (point-max))
451 (forward-line -1)
452 ;; And comment terminator was on a separate line before,
453 ;; keep it that way.
454 ;; This also avoids another problem:
455 ;; if the fill-prefix ends in a *, it could eat up
456 ;; the * of the comment terminator.
457 (if (looking-at "[ \t]*\\*/")
458 (narrow-to-region (point-min) (point)))
450 (fill-paragraph arg) 459 (fill-paragraph arg)
451 (save-excursion 460 (save-excursion
452 ;; Delete the chars we inserted to avoid clobbering 461 ;; Delete the chars we inserted to avoid clobbering
@@ -1504,7 +1513,9 @@ move backward across a preprocessor conditional."
1504 (if forward (forward-line 1)) 1513 (if forward (forward-line 1))
1505 ;; If this line exits a level of conditional, exit inner loop. 1514 ;; If this line exits a level of conditional, exit inner loop.
1506 (if (< depth 0) 1515 (if (< depth 0)
1507 (setq found (point))))))) 1516 (setq found (point))))
1517 ;; If the line is not really a conditional, skip past it.
1518 (if forward (end-of-line)))))
1508 (or found 1519 (or found
1509 (error "No containing preprocessor conditional")) 1520 (error "No containing preprocessor conditional"))
1510 (goto-char (setq new found))) 1521 (goto-char (setq new found)))