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: Tue, 27 Jun 2023 14:01:21 +0300 Message-ID: <83jzvpw4n2.fsf@gnu.org> References: <83leg7y44c.fsf@gnu.org> 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="39516"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, 64283@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 Tue Jun 27 13:02:25 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 1qE6Sn-000A5Y-2q for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Jun 2023 13:02:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qE6SS-00058V-WD; Tue, 27 Jun 2023 07:02: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 1qE6SQ-000589-Um for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2023 07:02:03 -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 1qE6SQ-0001KT-FF for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2023 07:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qE6SP-0007r4-Vu for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2023 07:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Jun 2023 11:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64283 X-GNU-PR-Package: emacs Original-Received: via spool by 64283-submit@debbugs.gnu.org id=B64283.168786366930134 (code B ref 64283); Tue, 27 Jun 2023 11:02:01 +0000 Original-Received: (at 64283) by debbugs.gnu.org; 27 Jun 2023 11:01:09 +0000 Original-Received: from localhost ([127.0.0.1]:47736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qE6RY-0007py-LW for submit@debbugs.gnu.org; Tue, 27 Jun 2023 07:01:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qE6RV-0007pJ-Pl for 64283@debbugs.gnu.org; Tue, 27 Jun 2023 07:01:07 -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 1qE6RQ-00015u-D3; Tue, 27 Jun 2023 07:01:00 -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=FoiqVX2LlifbqOKjuWl6f+K7XoN/TOzO90DRbjm7HoA=; b=K/L60s4CKxvOrvdNsr2A 0LwO67PykMS5GOw8jRoBJO4FbBwA1GqXfhRbHJRYURNvk7Pg3RN9D4HMdl6NT4ybhu6jJsFg1Y701 3RB+CwlVOhs0+2Pg6my/b7UBUqXY7dt+qWU3UotV6gN0FQt0ph6MW2sCl0UJo9p8KAbjMIBqw0Red eONpdxeS4JlI456sI+7IRIZ4lPvIbHRzKcuRgZ7yFL/aEMrSZH0/hhTfvfs0CFfr8fKql+4f5Jr7G G7v9IIS1D51NCFWmW7T354LzFedfDyS7XK4pGLrnqm07q0s7e7YKZx9hsJKu7g6N36TAvfBmG/tJE Bjz1jfLgUs/LEw==; 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 1qE6RP-0004hP-Sr; Tue, 27 Jun 2023 07:01:00 -0400 In-Reply-To: (message from Yuan Fu on Mon, 26 Jun 2023 18:42:41 -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:264143 Archived-At: > 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.