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: Sun, 30 Jul 2023 10:10:35 +0300 Message-ID: <83r0oplvro.fsf@gnu.org> References: <83a5wcncj8.fsf@gnu.org> <83pm57lxbo.fsf@gnu.org> <835y6wgr77.fsf@gnu.org> <93E5B9EA-D349-4316-B314-D6994329C261@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="17505"; 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 Sun Jul 30 09:18:46 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 1qQ0hS-0004K7-1a for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Jul 2023 09:18:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQ0a1-0004v7-Cq; Sun, 30 Jul 2023 03:11:05 -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 1qQ0Zy-0004uv-Bo for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 03:11:02 -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 1qQ0Zy-0001a1-37 for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 03:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qQ0Zx-0000Wr-N4 for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 03:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Jul 2023 07:11:01 +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.16907010452010 (code B ref 64442); Sun, 30 Jul 2023 07:11:01 +0000 Original-Received: (at 64442) by debbugs.gnu.org; 30 Jul 2023 07:10:45 +0000 Original-Received: from localhost ([127.0.0.1]:49257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQ0Zg-0000WM-Tj for submit@debbugs.gnu.org; Sun, 30 Jul 2023 03:10:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQ0Ze-0000W9-3I for 64442@debbugs.gnu.org; Sun, 30 Jul 2023 03:10:43 -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 1qQ0ZY-0001Py-Iy; Sun, 30 Jul 2023 03:10:36 -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=pWx9fk0cWf9X5Mz2LavgXzIcl6r2VMIZ5+GMAoV2KS4=; b=oFllIOYOJFeFHqxiv+aV kg/3G8o1XFy/KrpxqVwxkcn890bOAxJ3nzocwMmP74dOwtHyXpZeC9ibqgekmJjd7Oouv6z7hWqZi z2qWP9DKL41yc7eQF2EYoA7R4qEDiucj/sBpykLWCIFvSxA4GMdI1g1/82niT8Dd6uqpijbjcibCF UZCcr/qESPW3zOyyZWOO/rIpMypa8sj98Kkfo9y4yqgKx5MjQY+AoP00LgLuPeRXt6Fa6w7KpAyhf Ano+/4RG2hfp9N55fpgY8nG3BRfrlX0zM0Qg3cu44B7qrXEoCIobY2XqczNMbqdXl6jrIv3q6reck 7MAypTkZ7+O+ZQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQ0ZX-0002Gj-RQ; Sun, 30 Jul 2023 03:10:36 -0400 In-Reply-To: <93E5B9EA-D349-4316-B314-D6994329C261@gmail.com> (message from Yuan Fu on Tue, 11 Jul 2023 19:10:01 -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:266354 Archived-At: > From: Yuan Fu > Date: Tue, 11 Jul 2023 19:10:01 -0700 > Cc: 64442@debbugs.gnu.org > > > > > On Jul 6, 2023, at 11:40 PM, Eli Zaretskii wrote: > > > >> From: Yuan Fu > >> Date: Thu, 6 Jul 2023 23:15:00 -0700 > >> Cc: 64442@debbugs.gnu.org > >> > >>> On Jul 4, 2023, at 4:39 AM, Eli Zaretskii wrote: > >>> > >>> Why cannot we look for a top-level expression_statement node which is > >>> a call_expression whose function identifier is "DEFUN" and whose > >>> position is between the place where C-M-a was invoked and the place > >>> where it does find a defun? > >> > >> It’s gonna be ugly, but I can take a jab at it this weekend. I’m thinking of a wrapper function that tries to detect DEFUN before falling back to the ordinary tree-sitter defun movement function. > > > > Thanks. let's see how ugly it is before deciding whether it's worth it. > > > >>> DEFUN's cannot be nested, so we don't need to consider that. > >> > >> Yeah, in general C sources don’t have nested defuns, only C++ ones do. > > > > No, I meant the use of DEFUN macros in Emacs cannot be nested. > > Just an update. I didn’t forget about this, but it’s more harder than I thought and I’m still working on it :-( Any progress with this? It would be good to have a solution in Emacs 29.2, if possible. Thanks.