bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character

Yuan Fu <[email protected]> Tue, 4 Aug 2026 21:09:40 -0700
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Sorry for the delay.

> On Jul 31, 2026, at 10:24=E2=80=AFAM, Juri Linkov <[email protected]> =
wrote:
>=20
>>> -(defun treesit-forward-comment (&optional count)
>>> +(defun treesit-forward-comment (count)
>>=20
>> I'd refrain from including this part of the change.
>=20
> I don't remember why I made this argument optional.
> Probably by mistake because it was intended to have
> the same signature as `forward-comment` where the
> argument is not optional.  So it would be nice to fix
> this blunder before this function's first release.
>=20
>> Also, I'm not sure we need the whole =
`treesit--likely-line-comment-p`:
>> can we just test if `comment-end` is nil instead?
>=20
> Testing for an empty `comment-end` should work at least
> for c-ts-more and lua-ts-mode where the comment thing is set.

I don=E2=80=99t think testing comment-end by itself makes sense. =
Comment-end being nil doesn=E2=80=99t tell us anything about a comment. =
Comment-end only tells us whether we can use comment-start to =
distinguish line and block comments, because if a major mode defines =
comment-end, the corresponding comment start must be the beginning of a =
block comment.

Yuan