From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#64442: 29.0.92; treesit-beginning-of-defun fails in DEFUN functions in C Date: Sun, 13 Aug 2023 22:20:56 -0700 Message-ID: <5EA1F5AD-C6C4-4838-8265-5A7ECF69041D@gmail.com> 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> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3478"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64442@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 14 07:22:26 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 1qVQ26-0000hv-Ha for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Aug 2023 07:22:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVQ1j-00043D-7u; Mon, 14 Aug 2023 01:22:03 -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 1qVQ1i-000435-DB for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2023 01:22: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 1qVQ1i-0004Ch-3g for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2023 01:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qVQ1h-0004OM-V7 for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2023 01:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Aug 2023 05:22: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.169199047716828 (code B ref 64442); Mon, 14 Aug 2023 05:22:01 +0000 Original-Received: (at 64442) by debbugs.gnu.org; 14 Aug 2023 05:21:17 +0000 Original-Received: from localhost ([127.0.0.1]:60856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVQ0y-0004NM-EP for submit@debbugs.gnu.org; Mon, 14 Aug 2023 01:21:16 -0400 Original-Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:45067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVQ0w-0004N7-5x for 64442@debbugs.gnu.org; Mon, 14 Aug 2023 01:21:15 -0400 Original-Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-565439b6b3fso2219061a12.2 for <64442@debbugs.gnu.org>; Sun, 13 Aug 2023 22:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691990468; x=1692595268; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6f8Oe4Kn+tuvD6Mqj4kNj6UrvB/DQj7ot+NPnFMac64=; b=qme+EeLHT+IQioxb0d5LINFcMH7rKpzQAm4F30oe3bZ1MyjcEma50Rnwug8Ca6TSpR 23t1l7qhMrSZmvUy8V+jpwBp7zi/tgwWdyDJZC0GiDp6UZgG5lotl0rzCub1FDaLdf5C vkIkoIqLXqBnThR98r/cl/9kLOlaO5qEEeBgdCtrkENW3b6KYfGzr22lSzsumuKRiNrZ McvKgVm3O0wlM5P00yLYk08H0SoxNBbNIY0m3JJ1PKcqXeudfTPzpebAOFccn6ZFw+UV k4u/gqlxcNv7/m4zTo3pq2PH2sujsiKC2sk9FpQ7yt/xVedoVMMBPDEvvyD+YlnBOYyK XreQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691990468; x=1692595268; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6f8Oe4Kn+tuvD6Mqj4kNj6UrvB/DQj7ot+NPnFMac64=; b=RxbEcQJXZCWL+mivP7br8rF/Yrgbfem7TIFT0TQyuTf4w4utUj4hZS96JaxQ3hUgos 2AkC2x630pbTR0bOMLPysJsAaIbEIRcHNhySMPicXE03HCHg7e4CBgyD83aSvhHv0Nfs ycXCHqMsoVXtMSahR9vY5IJVBS1QjvhYVykzhK+eaT6y4bshJ/pOnR+yGgtIumvX7PMi Fn37BJ0LUzUshG8DBIfsS/7wpyVwy8dcOuRzVfABxc+lZRxdNL7NIAJEjHz5vqu7Ylt8 nefn+6avUOeBGYoihjnSHNUVmAgqvFrPrit0fpxmrqw1IRti99x48PbLLAn6NxBl4bkF V8Dw== X-Gm-Message-State: AOJu0YyD03Q2Jq7wHp/XklAb5PUzz07MhkDMS0ARRQ+x+ExuioO/0G4P P6wfJ5JfXd6L9/sm/qEGw4E= X-Google-Smtp-Source: AGHT+IEbmCXtyw9eswrTK5QmwbR0dATQw8CKHDcJbUTjGaKVMrATG4DycG7pFfio4DV4x7dUiEKRjg== X-Received: by 2002:a05:6a21:9994:b0:130:7803:5843 with SMTP id ve20-20020a056a21999400b0013078035843mr10687333pzb.4.1691990468307; Sun, 13 Aug 2023 22:21:08 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id y10-20020a17090322ca00b001bb8895848bsm8364878plg.71.2023.08.13.22.21.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Aug 2023 22:21:08 -0700 (PDT) In-Reply-To: <83a5uwe27a.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.600.7) 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:267394 Archived-At: > On Aug 12, 2023, at 7:59 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Thu, 10 Aug 2023 14:33:09 -0700 >> Cc: 64442@debbugs.gnu.org >>=20 >> I still don=E2=80=99t have a good solution. But I just realized that = we might be able to make a little compromise: what if Emacs recognizes = DEFUN, but as two separate parts (the declaration and the body), rather = than one? It=E2=80=99s hard to make it recognize DEFUN as a single = defun, but making it recognize DEFUN as two parts is easy. >>=20 >> Try this patch and see if you like the behavior. Personally I find it = quite alright. >=20 > 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? =20 We can easily tell the body from the declaration, but we can=E2=80=99t = 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=E2=80=99s not straightforward to know = whether we are in between a body and a declaration. I really don=E2=80=99t= want to add even more cursed hacks into c-ts-mode.el :-) > 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=E2=80=99ve been fixed already. And it shouldn=E2=80=99t = rely on this fix to work. Do you have a recipe for when it doesn=E2=80=99t= work? Yuan=