GNU bug report logs - #59816
29.0.60; c++-ts-mode handles one-line comments badly

Previous Next

Package: emacs;

Reported by: Herman, Géza <geza.herman <at> gmail.com>

Date: Sun, 4 Dec 2022 13:00:02 UTC

Severity: normal

Found in version 29.0.60

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 59816 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: 59816 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, geza.herman <at> gmail.com
Subject: [PATCH]: bug#59816: 29.0.60; c++-ts-mode handles one-line comments
 badly
Date: Mon, 05 Dec 2022 13:44:49 +0100
[Message part 1 (text/plain, inline)]
Herman, Géza <geza.herman <at> gmail.com> writes:

> With the following simple program, emacs reports that "int a;" is in a comment:
>
> ---------------------
> void foo() {
>    // c
>    int a;
> }
> ---------------------
>
> Repro steps:
> - install tree-sitter-cpp available at
>   https://github.com/tree-sitter/tree-sitter-cpp
> - copy the program above into a buffer
> - switch to c++-ts-mode
> - at the line "int a;", put the cursor at the 'i' (or anywhere in the line,
>  exact position doesn't seem to matter)
> - M-: (nth 4 (syntax-ppss (point)))
>
> For me, this incorrectly returns "t". In c++-mode (without tree sitter), this
> correctly returns "nil".
>


You're right.  This is my bad.  This patch addresses it.  What do you
think, Eli?  BTW - I see that many modes in general don't refer to their
syntax-tables in their define-derived-mode form.  Is that intentional?

Theo

[0001-Fix-syntax-table-for-tree-sitter-modes.patch (text/x-diff, attachment)]

This bug report was last modified 2 years and 167 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.