]> git.eshelyaron.com Git - emacs.git/commit
Fix filling in c-ts-mode (bug#72116)
authorYuan Fu <casouri@gmail.com>
Sat, 27 Jul 2024 21:50:19 +0000 (14:50 -0700)
committerEshel Yaron <me@eshelyaron.com>
Wed, 31 Jul 2024 14:33:13 +0000 (16:33 +0200)
commit3aba0616dc8210aa8cf7393aaa68ee1c8d9e601a
tree3606079dd6aad565112632e005b0647654027038
parent0a5db866f225ce6f94c916e3fc9210f30f7f9a51
Fix filling in c-ts-mode (bug#72116)

The previous fix introduced a regression in the case when there's only a
single line in the block comment.  In that case we don't want to add a
start at the second line:

/* foo foo foo */ should => /* foo foo
                               foo */

rather than   /* foo foo
               * foo */

This commit fixes that.

* lisp/progmodes/c-ts-common.el:
(c-ts-common--fill-block-comment): Don't mask the /*.
(c-ts-common--adaptive-fill-prefix): New function.
(c-ts-common-comment-setup): Don't set adaptive-regexp, change
adaptive-fill-first-line-regexp to work with the new
adaptive-fill-function.
* test/lisp/progmodes/c-ts-mode-resources/filling.erts: New tests

(cherry picked from commit 74bb1e5897f4532fbdefddada28258a8d3d5c95f)
lisp/progmodes/c-ts-common.el
test/lisp/progmodes/c-ts-mode-resources/filling.erts