From 58ac467ee734a08adc2bea34e49a2b512119417d Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Wed, 17 May 1995 20:44:36 +0000 Subject: [PATCH] (c-fill-paragraph): Don't alter point when deciding to narrow at the end for the sake of a comment ender. --- lisp/progmodes/c-mode.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/c-mode.el b/lisp/progmodes/c-mode.el index e8f060b1251..959bb9f06b1 100644 --- a/lisp/progmodes/c-mode.el +++ b/lisp/progmodes/c-mode.el @@ -458,15 +458,16 @@ 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))) + (save-excursion + (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 -- 2.39.2