Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 62158) by debbugs.gnu.org; 20 Mar 2023 18:22:32 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 20 14:22:31 2023 Received: from localhost ([127.0.0.1]:56771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1peK9P-0007XD-LC for submit <at> debbugs.gnu.org; Mon, 20 Mar 2023 14:22:31 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:59373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1peK9N-0007Wx-Rc; Mon, 20 Mar 2023 14:22:30 -0400 Received: (Authenticated sender: juri@HIDDEN) by mail.gandi.net (Postfix) with ESMTPSA id 26422E0008; Mon, 20 Mar 2023 18:22:20 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#62158: treesit-end-of-defun error In-Reply-To: <48E5D6CC-3249-4A5E-82B6-D3B9BF37D40A@HIDDEN> (Yuan Fu's message of "Mon, 13 Mar 2023 15:04:37 -0700") Organization: LINKOV.NET References: <868rg13y9w.fsf_-_@HIDDEN> <48E5D6CC-3249-4A5E-82B6-D3B9BF37D40A@HIDDEN> Date: Mon, 20 Mar 2023 20:21:38 +0200 Message-ID: <868rfrthal.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62158 Cc: 62158 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) close 62158 29.0.60 thanks >>> The fix seems to be easy: >>> >>> diff --git a/lisp/treesit.el b/lisp/treesit.el >>> index c118f5d52a4..b271a1f0c4b 100644 >>> --- a/lisp/treesit.el >>> +++ b/lisp/treesit.el >>> @@ -1882,6 +1882,7 @@ treesit-end-of-defun >>> `treesit-defun-skipper'." >>> (interactive "^p\nd") >>> (let ((orig-point (point))) >>> + (if (or (null arg) (= arg 0)) (setq arg 1)) >>> (catch 'done >>> (dotimes (_ 2) ; Not making progress is better than infloop. >>> >>> But I'm not quite sure if that is what we want to do. > > This looks good to me. So Dmitry's fix is pushed to emacs-29.
bug-gnu-emacs@HIDDEN
:bug#62158
; Package emacs
.
Full text available.Received: (at 62158) by debbugs.gnu.org; 13 Mar 2023 22:04:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 13 18:04:58 2023 Received: from localhost ([127.0.0.1]:35757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1pbqHq-0007CK-1P for submit <at> debbugs.gnu.org; Mon, 13 Mar 2023 18:04:58 -0400 Received: from mail-pl1-f174.google.com ([209.85.214.174]:38610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1pbqHo-0007C8-Km for 62158 <at> debbugs.gnu.org; Mon, 13 Mar 2023 18:04:57 -0400 Received: by mail-pl1-f174.google.com with SMTP id ja10so4892794plb.5 for <62158 <at> debbugs.gnu.org>; Mon, 13 Mar 2023 15:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678745091; 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=jklrmpaHIu7ryTNuNTajo2ZUpOYjFrb8FwFeHpS7x5w=; b=dzUX8UyIXr4Qmr8BSAHoPtrEsBJoKi6VkTt9ouhckOIXSWPcAw8bxRtsQQSa97oUcb e33JQhotlo322igPc77nMMDwXfg4JYQTf03VnAhFb1I4QV6SIsm1dxhOpK+YRveb+zjI fyY5HyOsU3uG8DidzDQmOzeurNHVYKwuvnmpjvyceEv61jgFgaNqwEAIAJ6HmydsDbHu Uh9YotM65vTGYVJPu4LCSRUp354FnEBWs/5Rih3RkY9JTDZzY2pA2GuIidKtXqS9H8C0 Y7Veno0vXbHhn1d8kEGp84V1gW392hzJa0rizVkKwlUldL5re954NVj/6bQ0AkD+NffY B62Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678745091; 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=jklrmpaHIu7ryTNuNTajo2ZUpOYjFrb8FwFeHpS7x5w=; b=S4exoAMHH3dpBEHBULcRkF4ykftmpwxY2uqKuCeU5xaT3ux8MFfsDZ37KEBZKS2INB MXMNXY7dJ5lutw8s3UKNMghAaPlAAuAMenYDXEN7TGpgGyQuiZxguLMfzzwYFfw876Y4 Q7c6RIBymuPdQl8kQVMb0wfovYgxtKRRpvkrGrpZTNpvNU3B0k2x8KOvJ2UScX1wKtYR a4xnPiMza5Lwiraqz9pMm/CUdPcRxMeqiQmbxqY2u+5MBSOiLeZ36zHb9ca7YzORDlDj d+NI5A9BoFSqSoKN8wcnVYNlYh+UvnDw7pjByzG6OEjlEI/wWgFlhcd+pjPUnP/z5RB3 zpOg== X-Gm-Message-State: AO0yUKXmvzfxZvpzr5cpeN7LPovU78RMCZ74Vs2EKbhrX/CojHY8ebMb aDzMS4g0xqOqOivRmn30tZ0= X-Google-Smtp-Source: AK7set+XtoBEcxZfGOCL96fXG41LZcbs6Z64SSWrRtD8RlAXIgmti+luA8ewtEHGaIBC3szZ5xjFsQ== X-Received: by 2002:a17:902:c407:b0:19e:21d0:5b90 with SMTP id k7-20020a170902c40700b0019e21d05b90mr21716619plk.4.1678745090775; Mon, 13 Mar 2023 15:04:50 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id h4-20020a170902748400b001a0616d7624sm285722pll.302.2023.03.13.15.04.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Mar 2023 15:04:50 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: bug#62158: treesit-end-of-defun error From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <868rg13y9w.fsf_-_@HIDDEN> Date: Mon, 13 Mar 2023 15:04:37 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <48E5D6CC-3249-4A5E-82B6-D3B9BF37D40A@HIDDEN> References: <868rg13y9w.fsf_-_@HIDDEN> To: Juri Linkov <juri@HIDDEN> X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62158 Cc: 62158 <at> debbugs.gnu.org, dmitry gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > On Mar 13, 2023, at 12:28 AM, Juri Linkov <juri@HIDDEN> wrote: >=20 > X-Debbugs-Cc: Yuan Fu <casouri@HIDDEN>, Dmitry Gutov = <dgutov@HIDDEN> >=20 > Since this is a separate problem, I'm closing bug#62086 > and opening a new bug report: >=20 >>>>> I don't know if the second bug is related to this, but while >>>>> in the same file, also type 'C-M-l' ('reposition-window'). >>>>> It raises the error: >>>>> Debugger entered--Lisp error: (wrong-type-argument = number-or-marker-p nil) >>>>> treesit-end-of-defun() >>>>> end-of-defun(-1) >>>>> reposition-window(nil nil) >>>>> reposition-window(nil 89) >>>>> funcall-interactively(reposition-window nil 89) >>>>> command-execute(reposition-window) >>> I see it only in some files in = test/lisp/progmodes/ruby-mode-resources/ >>> e.g. ruby-parenless-call-arguments-indent.rb, = ruby-method-call-indent.rb, >>> ruby-block-indent.rb. But not in e.g. = ruby-after-operator-indent.rb. >>> Also everywhere in = test/lisp/progmodes/js-resources/js-indent-init-dynamic.js, >>> js-indent-init-t.js. But not in e.g. js-chain.js. >>=20 >> Thanks, I can repro. I might have been trying the wrong binding at = the end >> last night (C-l instead of C-M-l). >>=20 >> The fix seems to be easy: >>=20 >> diff --git a/lisp/treesit.el b/lisp/treesit.el >> index c118f5d52a4..b271a1f0c4b 100644 >> --- a/lisp/treesit.el >> +++ b/lisp/treesit.el >> @@ -1882,6 +1882,7 @@ treesit-end-of-defun >> `treesit-defun-skipper'." >> (interactive "^p\nd") >> (let ((orig-point (point))) >> + (if (or (null arg) (=3D arg 0)) (setq arg 1)) >> (catch 'done >> (dotimes (_ 2) ; Not making progress is better than infloop. >>=20 >> But I'm not quite sure if that is what we want to do. This looks good to me. >>=20 >> More naturally, I think, would be to remove the argument from >> treesit-end-of-defun altogether (and adjust the code accordingly), = because >> end-of-defun-function is documented to take no arguments. >>=20 >> The only other place where treesit-end-of-defun seems to be used is = the >> <remap> <end-of-defun> binding set up by treesit-major-mode-setup. >>=20 >> Why not keep the default bindings for these? When >> beginning-of-defun-function and end-of-defun-function are set >> appropriately, they should work fine. Don't they? We tried that initially, but end-of-defun doesn=E2=80=99t have the = notion of nested defuns, which leads to problems when = end-of-defun-function recognizes nested defuns. In the following code (defun xxx () | (defun yyy () ...) (defun zzz () ...) ) If point is at =E2=80=9C|=E2=80=9D and you call end-of-defun, you=E2=80=99= d expect point to move to the end of yyy, but instead it moves to the = end of xxx. That=E2=80=99s because end-of-defun first runs = (beginning-of-defun -1) followed by (end-of-defun 1) to check if the = starting point is in a defun or between two defuns. This is fine in = non-nested defuns, but in this example, the point first goes to the = beginning of xxx, then goes to the end of xxx. And end-of-defun thinks = that we started in a defun and now is at an end of defun, job=E2=80=99s = done, and finishes. The plan is to improve end-of-defun to support nested defuns in Emacs = 30. For now we rebind end-of-defun to treesit-end-of-defun. Yuan=
bug-gnu-emacs@HIDDEN
:bug#62158
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 13 Mar 2023 07:35:33 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 13 03:35:32 2023 Received: from localhost ([127.0.0.1]:33523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1pbciS-0002JV-Ig for submit <at> debbugs.gnu.org; Mon, 13 Mar 2023 03:35:32 -0400 Received: from lists.gnu.org ([209.51.188.17]:41778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1pbciQ-0002JI-Br for submit <at> debbugs.gnu.org; Mon, 13 Mar 2023 03:35:30 -0400 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 <juri@HIDDEN>) id 1pbciP-0008Lp-Lf for bug-gnu-emacs@HIDDEN; Mon, 13 Mar 2023 03:35:30 -0400 Received: from relay7-d.mail.gandi.net ([2001:4b98:dc4:8::227]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1pbciO-0008PZ-03 for bug-gnu-emacs@HIDDEN; Mon, 13 Mar 2023 03:35:29 -0400 Received: (Authenticated sender: juri@HIDDEN) by mail.gandi.net (Postfix) with ESMTPSA id F31AC20005 for <bug-gnu-emacs@HIDDEN>; Mon, 13 Mar 2023 07:35:21 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: treesit-end-of-defun error Organization: LINKOV.NET Date: Mon, 13 Mar 2023 09:28:59 +0200 Message-ID: <868rg13y9w.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2001:4b98:dc4:8::227; envelope-from=juri@HIDDEN; helo=relay7-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.6 (--) X-Debbugs-Cc: Yuan Fu <casouri@HIDDEN>, Dmitry Gutov <dgutov@HIDDEN> Since this is a separate problem, I'm closing bug#62086 and opening a new bug report: >>>> I don't know if the second bug is related to this, but while >>>> in the same file, also type 'C-M-l' ('reposition-window'). >>>> It raises the error: >>>> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) >>>> treesit-end-of-defun() >>>> end-of-defun(-1) >>>> reposition-window(nil nil) >>>> reposition-window(nil 89) >>>> funcall-interactively(reposition-window nil 89) >>>> command-execute(reposition-window) >> I see it only in some files in test/lisp/progmodes/ruby-mode-resources/ >> e.g. ruby-parenless-call-arguments-indent.rb, ruby-method-call-indent.rb, >> ruby-block-indent.rb. But not in e.g. ruby-after-operator-indent.rb. >> Also everywhere in test/lisp/progmodes/js-resources/js-indent-init-dynamic.js, >> js-indent-init-t.js. But not in e.g. js-chain.js. > > Thanks, I can repro. I might have been trying the wrong binding at the end > last night (C-l instead of C-M-l). > > The fix seems to be easy: > > diff --git a/lisp/treesit.el b/lisp/treesit.el > index c118f5d52a4..b271a1f0c4b 100644 > --- a/lisp/treesit.el > +++ b/lisp/treesit.el > @@ -1882,6 +1882,7 @@ treesit-end-of-defun > `treesit-defun-skipper'." > (interactive "^p\nd") > (let ((orig-point (point))) > + (if (or (null arg) (= arg 0)) (setq arg 1)) > (catch 'done > (dotimes (_ 2) ; Not making progress is better than infloop. > > But I'm not quite sure if that is what we want to do. > > More naturally, I think, would be to remove the argument from > treesit-end-of-defun altogether (and adjust the code accordingly), because > end-of-defun-function is documented to take no arguments. > > The only other place where treesit-end-of-defun seems to be used is the > <remap> <end-of-defun> binding set up by treesit-major-mode-setup. > > Why not keep the default bindings for these? When > beginning-of-defun-function and end-of-defun-function are set > appropriately, they should work fine. Don't they? > > Cc'ing Yuan on that subject.
Juri Linkov <juri@HIDDEN>
:casouri@HIDDEN, dgutov@HIDDEN, bug-gnu-emacs@HIDDEN
.
Full text available.casouri@HIDDEN, dgutov@HIDDEN, bug-gnu-emacs@HIDDEN
:bug#62158
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.