From: Yuan Fu Date: Mon, 5 Aug 2024 03:46:45 +0000 (-0700) Subject: Fix c-ts-common filling X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=69858ae4eabbd56fe9840cd149ba006dea509660;p=emacs.git Fix c-ts-common filling * lisp/progmodes/c-ts-common.el: (c-ts-common--fill-block-comment): Exclude the last line from filling if it only has non-word characters like *=-. * test/lisp/progmodes/c-ts-mode-resources/filling.erts: Fir the multi-line test and add a single line test. (cherry picked from commit 5ecd35555e9e20de9717f0184f58a15d8a2e68a3) --- diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el index 022d21e11a1..674623a5e61 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el @@ -186,9 +186,9 @@ comment." ;; filling region. (when (not end-marker) (goto-char end) - (when (looking-back (rx "*/") 2) - (backward-char 2) - (skip-syntax-backward "-") + (forward-line 0) + (when (looking-at (rx (* (or (syntax whitespace) "*" "=" "-")) + "*/" eol)) (setq end (point)))) ;; Let `fill-paragraph' do its thing. diff --git a/test/lisp/progmodes/c-ts-mode-resources/filling.erts b/test/lisp/progmodes/c-ts-mode-resources/filling.erts index e58b8e91c90..5425519b3d7 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/filling.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/filling.erts @@ -101,7 +101,7 @@ Name: Type 4 =-= /*================================================================ * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy - woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy + * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy * ================================================================*/ =-= @@ -112,6 +112,20 @@ Name: Type 4 * ================================================================*/ =-=-= +Name: Type 4 Single-line + +=-= +/*================================================================ + * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy + * ================================================================*/ +=-= +/*================================================================ + * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy + * woooomy woooomy + * ================================================================*/ +=-=-= + + Name: Type 5 /* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy