]> git.eshelyaron.com Git - emacs.git/commitdiff
(c-forward-conditional):
authorRichard M. Stallman <rms@gnu.org>
Wed, 25 Jan 1995 00:41:22 +0000 (00:41 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 25 Jan 1995 00:41:22 +0000 (00:41 +0000)
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.

lisp/progmodes/c-mode.el

index c59efbfd821bb29acca27d355510a2925006eee8..cb993c5c4629d69ba52390aa1cfa63ff7988aad9 100644 (file)
@@ -447,6 +447,15 @@ preserving the comment indentation or line-starting decorations."
                                  (search-forward "*/" nil 'move)
                                  (forward-line 1)
                                  (point)))
+             (goto-char (point-max))
+             (forward-line -1)
+             ;; And comment terminator was on a separate line before,
+             ;; keep it that way.
+             ;; This also avoids another problem:
+             ;; if the fill-prefix ends in a *, it could eat up
+             ;; the * of the comment terminator.
+             (if (looking-at "[ \t]*\\*/")
+                 (narrow-to-region (point-min) (point)))
              (fill-paragraph arg)
              (save-excursion
                ;; Delete the chars we inserted to avoid clobbering
@@ -1504,7 +1513,9 @@ move backward across a preprocessor conditional."
                    (if forward (forward-line 1))
                    ;; If this line exits a level of conditional, exit inner loop.
                    (if (< depth 0)
-                       (setq found (point)))))))
+                       (setq found (point))))
+               ;; If the line is not really a conditional, skip past it.
+               (if forward (end-of-line)))))
          (or found
              (error "No containing preprocessor conditional"))
          (goto-char (setq new found)))