From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83jztxbzsp.fsf@gnu.org> References: <83a5wcncj8.fsf@gnu.org> <83pm57lxbo.fsf@gnu.org> <835y6wgr77.fsf@gnu.org> <93E5B9EA-D349-4316-B314-D6994329C261@gmail.com> <83r0oplvro.fsf@gnu.org> <83y1iji7b7.fsf@gnu.org> <2134730B-05A4-4032-84B6-42FD3CDC48AE@gmail.com> <83a5uwe27a.fsf@gnu.org> <5EA1F5AD-C6C4-4838-8265-5A7ECF69041D@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40258"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64442@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 14 14:00:33 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qVWFN-000AES-BM for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Aug 2023 14:00:33 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVWF9-0000MQ-P3; Mon, 14 Aug 2023 08:00:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVWEv-0000Jm-Kn for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2023 08:00:09 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVWEt-0001ce-LO for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2023 08:00:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qVWEt-00086W-8o for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2023 08:00:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Aug 2023 12:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64442 X-GNU-PR-Package: emacs Original-Received: via spool by 64442-submit@debbugs.gnu.org id=B64442.169201435130948 (code B ref 64442); Mon, 14 Aug 2023 12:00:03 +0000 Original-Received: (at 64442) by debbugs.gnu.org; 14 Aug 2023 11:59:11 +0000 Original-Received: from localhost ([127.0.0.1]:33063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVWE2-000836-Mp for submit@debbugs.gnu.org; Mon, 14 Aug 2023 07:59:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVWE1-00082d-2r for 64442@debbugs.gnu.org; Mon, 14 Aug 2023 07:59:09 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVWDv-0000sA-Ew; Mon, 14 Aug 2023 07:59:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=PH43il1ULEpSzk6RIx7lxyymUDh7wGgZw7SH+3W1oJk=; b=Y+/XV7pzBlp6XNlEkmW5 dWOqdOGaCZsMxojqvzYvQoqpH2CLtpIm8S4EmEVuMau9hwe62KKCT2vyPG9d8sKEa69mXm0mjkb5e 9q4KwqJ/GyXBi13fLFxcVxTZUotIzeFR2h5rHo07YpOd3Ulyh4/ZzsuxyS7MYcwKc7paFZNtWqHy/ 1FczpNdP9bOrSdCZDRdHkvEz1iQCtr0ONikquezSVYf+xaYbOancvkXWPJwIVhEq1R7IyA9KbQAk+ Pet4FZX0uzlrM+ZCZlASWcm+UTfbbyPriaXBJ/lY9eW9ycvjTUvNTMCooMkoEXf+HgVCxma6osCT2 wcNK7bKzA7kJ2A==; In-Reply-To: <5EA1F5AD-C6C4-4838-8265-5A7ECF69041D@gmail.com> (message from Yuan Fu on Sun, 13 Aug 2023 22:20:56 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267409 Archived-At: > From: Yuan Fu > 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".