all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: evgenysw@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: Fri, 24 Feb 2023 21:08:29 -0800	[thread overview]
Message-ID: <BEF4EBC8-47E3-451D-BB7B-66E2A3DCA22E@gmail.com> (raw)
In-Reply-To: <CAMCrgaUgTdPvSuZ1T0WLgu2dj69C2FMaMq7GqU8Aq2DEyZ+kng@mail.gmail.com>


Evgeni Kolev <evgenysw@gmail.com> writes:

> 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.

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))

Are you using emacs-29 or emacs-30? Theo might have changed something on master.

Yuan





  parent reply	other threads:[~2023-02-25  5:08 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 [this message]
2023-02-25  7:27   ` Evgeni Kolev
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

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

  git send-email \
    --in-reply-to=BEF4EBC8-47E3-451D-BB7B-66E2A3DCA22E@gmail.com \
    --to=casouri@gmail.com \
    --cc=61617@debbugs.gnu.org \
    --cc=evgenysw@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.