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#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top Date: Thu, 29 Jun 2023 08:41:00 +0300 Message-ID: <83o7kyu8pf.fsf@gnu.org> References: <83leg7y44c.fsf@gnu.org> <83jzvpw4n2.fsf@gnu.org> <4A2B5016-C2B2-499C-BBD8-AFCCF676DF96@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="40287"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, 64283-done@debbugs.gnu.org, mardani29@yahoo.es To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 29 07:41: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 1qEkPF-000AF3-7w for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Jun 2023 07:41:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEkPD-0002xG-6Q; Thu, 29 Jun 2023 01:41:23 -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 1qEkOt-0002uu-J3 for bug-gnu-emacs@gnu.org; Thu, 29 Jun 2023 01:41:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEkOs-0006NJ-Df for bug-gnu-emacs@gnu.org; Thu, 29 Jun 2023 01:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qEkOs-0004Fg-9P for bug-gnu-emacs@gnu.org; Thu, 29 Jun 2023 01:41:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Jun 2023 05:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 64283 X-GNU-PR-Package: emacs Mail-Followup-To: 64283@debbugs.gnu.org, eliz@gnu.org, mardani29@yahoo.es Original-Received: via spool by 64283-done@debbugs.gnu.org id=D64283.168801724216306 (code D ref 64283); Thu, 29 Jun 2023 05:41:01 +0000 Original-Received: (at 64283-done) by debbugs.gnu.org; 29 Jun 2023 05:40:42 +0000 Original-Received: from localhost ([127.0.0.1]:52083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEkOX-0004Ew-Dn for submit@debbugs.gnu.org; Thu, 29 Jun 2023 01:40:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEkOV-0004Ei-3D for 64283-done@debbugs.gnu.org; Thu, 29 Jun 2023 01:40:40 -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 1qEkOP-0006HG-JP; Thu, 29 Jun 2023 01:40:33 -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=IML3DkjHHeHrASmM4CirQJizTP3RrUCyTKust2OgucU=; b=rgUTAwwBmAxynggLcJdy PL2KgXU+U68ZeL7qLiKfldkUWOSgIdZd9J7OI+CYbHPqYq4XaS+pFJ0n7r898b5Z/UB6dqYeSm1Pc loUAwKT7o0OgRgAcj06emB96xIe0wyAuuW8to1ovViymhL7pOi/0uf7QKA222u880cwUHkZl3cnRb iTpC982ZwaRS4Rfcohttjij8eh3fCU9vW+fq/CnoLXso/KTeiZyx3YoeRuBbzugJ5E1SXXPV3ayJz e9jghirfdUqg09S+UeRKHlRQDspZEI80OVJjunzJl3yDsCA9g5St06jkJO7MaogpTDxuUXZYOfQNb L59KwNLpWW2NLA==; 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 1qEkOO-0003PK-TG; Thu, 29 Jun 2023 01:40:33 -0400 In-Reply-To: <4A2B5016-C2B2-499C-BBD8-AFCCF676DF96@gmail.com> (message from Yuan Fu on Wed, 28 Jun 2023 13:11:43 -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:264257 Archived-At: > From: Yuan Fu > Date: Wed, 28 Jun 2023 13:11:43 -0700 > Cc: Daniel Martín , > Dmitry Gutov , > 64283@debbugs.gnu.org > > > > > On Jun 27, 2023, at 4:01 AM, Eli Zaretskii wrote: > > > >> From: Yuan Fu > >> Date: Mon, 26 Jun 2023 18:42:41 -0700 > >> Cc: Eli Zaretskii , > >> Dmitry Gutov , > >> 64283@debbugs.gnu.org > >> > >>> > >>> What I see is that, after 4489450f37deafb013b1f0fc00c89f0973fda14a, > >>> defun movement may be subtly broken if beginning-of-defun-function does > >>> not return non-nil when it found the beginning of a defun. One of the > >>> affected modes is js-mode, but who knows if there are more out there. > >>> > >>> We could either revert 4489450f37deafb013b1f0fc00c89f0973fda14a, because > >>> of the incompatibilities it may cause (Yuan, what is the bug it tries to > >>> fix?), or maybe adjust js-mode so that it follows the documentation of > >>> beginning-of-defun-function and returns non-nil when it found the > >>> beginning of a defun. I've attached a patch that follows this second > >>> approach, with some unit tests. It fixes the bug on my side. > >>> > >>> <0001-Make-js-beginning-of-defun-return-non-nil-on-success.patch> > >> > >> The original problem that I tried to solve is that sometimes end-of-defun-function was called when point isn’t at the beginning of a defun, contrary to what the documentation claims. > >> > >> I first find out about it when writing defun movement functions for tree-sitter, but if you revert the commit now tree-sitter defun functions wouldn’t break: they have change quite a bit since then and treesit-end-of-defun don’t need to be called at the beginning of the defun anymore. > > > > Thanks. > > > > Do you (or anyone else) see a problem with the alternative proposed by > > Daniel? If not, I'd prefer not to revert at this stage, but instead > > to apply the simple fix Daniel suggested. > > I don’t see any problem :-) Thanks. So I've now installed Daniel's patch on the released branch, and I'm therefore closing this bug.