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#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top Date: Wed, 28 Jun 2023 13:11:43 -0700 Message-ID: <4A2B5016-C2B2-499C-BBD8-AFCCF676DF96@gmail.com> References: <83leg7y44c.fsf@gnu.org> <83jzvpw4n2.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="25636"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , 64283@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 28 22:13:14 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 1qEbXN-0006TM-Mk for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Jun 2023 22:13:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbXE-0002cb-NE; Wed, 28 Jun 2023 16:13:04 -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 1qEbXC-0002cI-VQ for bug-gnu-emacs@gnu.org; Wed, 28 Jun 2023 16:13:02 -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 1qEbXC-0006qr-Mo for bug-gnu-emacs@gnu.org; Wed, 28 Jun 2023 16:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qEbXC-0006dC-Hi for bug-gnu-emacs@gnu.org; Wed, 28 Jun 2023 16:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Jun 2023 20:13:02 +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.168798312525413 (code B ref 64283); Wed, 28 Jun 2023 20:13:02 +0000 Original-Received: (at 64283) by debbugs.gnu.org; 28 Jun 2023 20:12:05 +0000 Original-Received: from localhost ([127.0.0.1]:51753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEbWG-0006bo-Nx for submit@debbugs.gnu.org; Wed, 28 Jun 2023 16:12:05 -0400 Original-Received: from mail-pf1-f174.google.com ([209.85.210.174]:48447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEbWE-0006bJ-Jf for 64283@debbugs.gnu.org; Wed, 28 Jun 2023 16:12:03 -0400 Original-Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-66c729f5618so149508b3a.1 for <64283@debbugs.gnu.org>; Wed, 28 Jun 2023 13:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687983117; x=1690575117; 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=JWTy3GtRvROVK7IckGH+dhFoLwwFc46rBTcCwAHcuOQ=; b=UTRqJNTCwJ/nUeDooBQONGeyA/ksiaRZXaBL50a5I4WMr6Cu626IxwQpxUPiTSHiJQ Cq781blLdiXi3hrbFnU1NAJtMMgh2O+sDPK4YA3kMCjeWOUO8/tHxxBKwP9BeHQIt4PG z++dXnkGbLnyzMiQse183zxQLoxEL3pglwED5c/otkbX14rIowHib9chS/SjM26ZOFed yYBUlupKPDCaB0Q+0OXDLVc7+mS+DYRMeQCp/sHHQt8fudb7YiqbZkgGVrycsE7SnXVM q7ydcRTkvmOOuWGoFHGeeysp0AFo7W+ObJvb9b4PKnCcvlwB2ndyJ1//k5EazQ1aNoVi jUgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687983117; x=1690575117; 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=JWTy3GtRvROVK7IckGH+dhFoLwwFc46rBTcCwAHcuOQ=; b=ahzJ3OQy5aavAU0jYFnJkSTDIV8nAvx7eRx2M2Qqj2wG6ODMksPasYV7fZYj7Jv1HK tehYV6jsrlvxRbl5OTUpz4OQM1jp6kNbueTcxjKPpvFV/OTNICkk96Zq55/82Dz5W9e6 7ELIVw1Ma+jM29zzomjO0xbrlnGDvPQu1Ro3qBZZP6TbN56FnJNIsnLiGGsinMVLeoCr qf/HIZwzqMtrQcsNzk0lPlXdi9pNlq0qDdanwCx+9bweqxoAVCzNSOqnIqS1UJZNiGif Pz/9p+8LbZL5LNAoZz5prc/G6/l2IkRu8eQ+gz6mQ4fKg25XO9xgXNHNZv+MwwU/JzAx aa6w== X-Gm-Message-State: AC+VfDyq2PachcYyIiOO3EBbTvL+lDqa1pCMNUaFOp6IpVLYZYZwcl9+ X8FePKL8Xc/Ifm7M8GLJjys= X-Google-Smtp-Source: ACHHUZ6bZJvXPACH4JzdZ/a/sNIPYiXmrGTLapf3+SsFNyUqF4AxNOFtagF+mKGilUzd44jrGZi3Kw== X-Received: by 2002:a05:6a00:2388:b0:67a:b045:e290 with SMTP id f8-20020a056a00238800b0067ab045e290mr10571505pfc.4.1687983116657; Wed, 28 Jun 2023 13:11:56 -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 i14-20020aa78d8e000000b00654228f9e93sm7359348pfr.120.2023.06.28.13.11.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2023 13:11:56 -0700 (PDT) In-Reply-To: <83jzvpw4n2.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:264239 Archived-At: > On Jun 27, 2023, at 4:01 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Mon, 26 Jun 2023 18:42:41 -0700 >> Cc: Eli Zaretskii , >> Dmitry Gutov , >> 64283@debbugs.gnu.org >>=20 >>>=20 >>> 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. >>>=20 >>> 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. >>>=20 >>> <0001-Make-js-beginning-of-defun-return-non-nil-on-success.patch> >>=20 >> The original problem that I tried to solve is that sometimes = end-of-defun-function was called when point isn=E2=80=99t at the = beginning of a defun, contrary to what the documentation claims.=20 >>=20 >> 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=E2=80=99t break: they have change quite a bit since = then and treesit-end-of-defun don=E2=80=99t need to be called at the = beginning of the defun anymore. >=20 > Thanks. >=20 > 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=E2=80=99t see any problem :-) Yuan=