unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: 64442@debbugs.gnu.org
Subject: bug#64442: 29.0.92; treesit-beginning-of-defun fails in DEFUN functions in C
Date: Mon, 14 Aug 2023 14:59:02 +0300	[thread overview]
Message-ID: <83jztxbzsp.fsf@gnu.org> (raw)
In-Reply-To: <5EA1F5AD-C6C4-4838-8265-5A7ECF69041D@gmail.com> (message from Yuan Fu on Sun, 13 Aug 2023 22:20:56 -0700)

> From: Yuan Fu <casouri@gmail.com>
> Date: Sun, 13 Aug 2023 22:20:56 -0700
> Cc: 64442@debbugs.gnu.org
> 
> > I like this much better than what we have now, thanks.  But I have a
> > question: can we perhaps recognize the "function" of the body as such,
> > and then automatically move to the previous defun, which is the right
> > place?  The "defun" that is the body has no name, so maybe that could
> > be used as a sign?  
> 
> We can easily tell the body from the declaration, but we can’t easily tell whether we should automatically move forward or backward. When point arrives at the point between the declaration and the body, should it move to the beginning of the next defun or the beginning of the declaration? This, plus it’s not straightforward to know whether we are in between a body and a declaration. I really don’t want to add even more cursed hacks into c-ts-mode.el :-)

Too bad, but okay.

> > That would allow "C-x 4 a" to work inside a DEFUN,
> > something that still works less reliably with this patch: you must be
> > in the "first defun" to get it to find the name of the function.
> 
> C-x 4 a should’ve been fixed already. And it shouldn’t rely on this fix to work. Do you have a recipe for when it doesn’t work?

Just try it with your patch.  If point is inside the body, the
function's name is not captured by "C-x 4 a".





  reply	other threads:[~2023-08-14 11:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 17:13 bug#64442: 29.0.92; treesit-beginning-of-defun fails in DEFUN functions in C Eli Zaretskii
2023-07-04  8:41 ` Yuan Fu
2023-07-04 11:39   ` Eli Zaretskii
2023-07-07  6:15     ` Yuan Fu
2023-07-07  6:40       ` Eli Zaretskii
2023-07-12  2:10         ` Yuan Fu
2023-07-30  7:10           ` Eli Zaretskii
2023-08-10  9:18             ` Eli Zaretskii
2023-08-10 21:33               ` Yuan Fu
2023-08-12 14:59                 ` Eli Zaretskii
2023-08-14  5:20                   ` Yuan Fu
2023-08-14 11:59                     ` Eli Zaretskii [this message]
2023-08-15  7:30                       ` Yuan Fu
2023-08-17  8:18                         ` Eli Zaretskii
2023-08-19 22:00 ` Yuan Fu

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=83jztxbzsp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=64442@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    /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).