GNU bug report logs -
#61617
M-x mark-defun doesn't work correctly in tree-sitter modes when comments exist between functions
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Sat, Feb 25, 2023 at 7:08 AM Yuan Fu <casouri <at> gmail.com> wrote:
> Huh, with or without comments, mark-defun always includes the empty
> lines before the defun for me. I get the same behavior in rust-ts-mode.
> This seems intentional, because this is at the end of the definition of
> mark-defun:
>
> (skip-chars-backward "[:space:]\n")
> (unless (bobp)
> (forward-line 1))
Did you check with my example or another example? With my example, the
issue I get is that only the empty lines are marked, without the
defun, without the comments. I'm attaching two screenshots - before
and after mark-defun.
Note: I get the correct behaviour when there is just one defun in the
file. But if there are more, or the defun at point is not at the top
of the file - mark-defun does not work as expected.
>
> Are you using emacs-29 or emacs-30? Theo might have changed something on master.
I've observed the issue on both. If you can't reproduce it - I'll
re-test on a fresh docker image to make sure the issue is not in my
setup. However, I'm pretty sure it's not in my setup because I used a
freshly built emacs just for this purpose (emacs-30 maybe, I'm not
sure), and ran it with emacs -Q.
[before-mark-defun.png (image/png, attachment)]
[after-mark-defun.png (image/png, attachment)]
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.