GNU bug report logs - #61617
M-x mark-defun doesn't work correctly in tree-sitter modes when comments exist between functions

Previous Next

Package: emacs;

Reported by: Evgeni Kolev <evgenysw <at> gmail.com>

Date: Sun, 19 Feb 2023 08:40:02 UTC

Severity: normal

Full log


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

From: Evgeni Kolev <evgenysw <at> gmail.com>
To: 61617 <at> debbugs.gnu.org
Subject: M-x mark-defun doesn't work correctly in tree-sitter modes when
 comments exist between functions
Date: Mon, 20 Feb 2023 10:30:30 +0200
Sorry, I have a typo in my Go example, the point in the code is "I"
(capital i), instead of "|" (pipe). The Rust example is OK.

Fixed steps to reproduce for go-ts-mode:

To reproduce:
1. with the following code in go-ts-mode, "|" is the point (in function sum2)
```
package main

func sum(a, b int) int {
    return a + b
}

// comment
func sum2(a, b int) int {
    |return a + b
}
```
2. Execute M-x mark-defun
3. The region selected is wrong - the empty line between the two
functions is marked. I expect only function sum2 and the preceding
comment to be marked.




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

Previous Next


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