all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 68664@debbugs.gnu.org, Troy Brown <brownts@troybrown.dev>,
	mardani29@yahoo.es
Subject: bug#68664: 29.1.50; treesit defun commands broken with nested functions
Date: Sat, 27 Jan 2024 20:03:30 -0800	[thread overview]
Message-ID: <CA205B7D-5C60-40D0-A7D5-643BD8A2C247@gmail.com> (raw)
In-Reply-To: <86a5or9qpq.fsf@gnu.org>



> On Jan 26, 2024, at 11:32 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> Cc: 68664@debbugs.gnu.org, Daniel Martín <mardani29@yahoo.es>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 26 Jan 2024 20:26:38 -0800
>> 
>>> To add further support to my belief that the current implementation is
>>> not the expected behavior, consider how the current implementation
>>> behaves when used with mark-defun.  When the point is on the call to
>>> innerFunction and I execute "M-x mark-defun RET", the nested function
>>> following the point (i.e., innerFunction2) is selected rather than the
>>> function containing point.  For comparison, the non-tree-sitter
>>> python-mode behaves correctly and selects the function containing
>>> point, not the next nested function.
>> 
>> Yeah, I mean, I can definitely see the validity of the behavior you’re describing. But I think the current behavior is equally valid. Right now you can easily go to the previous/next sibling in the same level, _and_ go to the beginning/end of the parent. You just need to press a few more times. OTOH if you go straight to the parent, there’s no way to go to siblings.
> 
> Maybe we could support both behaviors via specially-valued prefix
> arguments?  Like "C-u" means something, "C-u C-u" means something
> else, etc.?

Beginning/end-of-defun already take a numerical interactive arg, unless I missed something we can’t add another. If we want to change behavior interactively we would need something more elaborate, maybe transient maps.

> 
>> As for mark-defun, I think it’s similarly equally valid to either mark the next sibling or the parent. Right now mark-defun doesn’t really have a notion of nested defun, we should upgrade it to support nested defun like we did beginning/end-of-defun, either by a toggle like mark-defun-tactic or let user control which defun to mark interactively.
> 
> Same here.
> 
> WDYT?

Same for mark-defun, it also has an interactive arg already.

I feel like I missed something, surely you know they already have interactive args :-)

Yuan






  reply	other threads:[~2024-01-28  4:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 23:10 bug#68664: 29.1.50; treesit defun commands broken with nested functions Troy Brown
2024-01-23  0:32 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-23 14:30   ` Troy Brown
2024-01-24  6:29     ` Yuan Fu
2024-01-24 14:13       ` Troy Brown
2024-01-24 17:25         ` Troy Brown
2024-01-27  4:26           ` Yuan Fu
2024-01-27  7:32             ` Eli Zaretskii
2024-01-28  4:03               ` Yuan Fu [this message]
2024-01-28  6:53                 ` Eli Zaretskii
2024-01-28  7:29                   ` Yuan Fu
2024-01-28  7:43                     ` Eli Zaretskii

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=CA205B7D-5C60-40D0-A7D5-643BD8A2C247@gmail.com \
    --to=casouri@gmail.com \
    --cc=68664@debbugs.gnu.org \
    --cc=brownts@troybrown.dev \
    --cc=eliz@gnu.org \
    --cc=mardani29@yahoo.es \
    /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.