unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Evgeni Kolev <evgenysw@gmail.com>
To: Yuan Fu <casouri@gmail.com>
Cc: Theodor Thornhill <theo@thornhill.no>, 61617@debbugs.gnu.org
Subject: bug#61617: M-x mark-defun doesn't work correctly in tree-sitter modes when comments exist between functions
Date: Sat, 25 Feb 2023 09:27:17 +0200	[thread overview]
Message-ID: <CAMCrgaUkGR=MeQUsKaf600j=KGCOhYfDEatV=MvkSWPJKakDOw@mail.gmail.com> (raw)
In-Reply-To: <BEF4EBC8-47E3-451D-BB7B-66E2A3DCA22E@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]

On Sat, Feb 25, 2023 at 7:08 AM Yuan Fu <casouri@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.

[-- Attachment #2: before-mark-defun.png --]
[-- Type: image/png, Size: 88615 bytes --]

[-- Attachment #3: after-mark-defun.png --]
[-- Type: image/png, Size: 85871 bytes --]

  reply	other threads:[~2023-02-25  7:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-19  8:39 bug#61617: M-x mark-defun doesn't work correctly in tree-sitter modes when comments exist between functions Evgeni Kolev
2023-02-20  8:30 ` Evgeni Kolev
2023-02-25  5:08 ` Yuan Fu
2023-02-25  7:27   ` Evgeni Kolev [this message]
2023-02-27  0:42     ` Yuan Fu
2023-02-27  9:24       ` Yuan Fu
2023-02-27 16:03         ` Evgeni Kolev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMCrgaUkGR=MeQUsKaf600j=KGCOhYfDEatV=MvkSWPJKakDOw@mail.gmail.com' \
    --to=evgenysw@gmail.com \
    --cc=61617@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).