From unknown Sun Jun 22 08:09:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#59788: 29.0.60; [PATCH] Make treesit-end-of-defun handle nil node Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: casouri@gmail.com, eliz@gnu.org, bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Dec 2022 20:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59788 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 59788@debbugs.gnu.org Cc: casouri@gmail.com, eliz@gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: casouri@gmail.com, eliz@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16700139754280 (code B ref -1); Fri, 02 Dec 2022 20:47:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Dec 2022 20:46:15 +0000 Received: from localhost ([127.0.0.1]:48772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1CvG-00016y-NF for submit@debbugs.gnu.org; Fri, 02 Dec 2022 15:46:15 -0500 Received: from lists.gnu.org ([209.51.188.17]:34014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1CvA-00016s-P2 for submit@debbugs.gnu.org; Fri, 02 Dec 2022 15:46:13 -0500 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 1p1CvA-0000FS-Fa for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 15:46:08 -0500 Received: from out-82.mta0.migadu.com ([2001:41d0:1004:224b::52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1Cv5-0007o5-Jx for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 15:46:08 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670013960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=e9EVCIhLAhMp3K01lnSaIjeHHdPBGYhmZWmIuxXWlcg=; b=HzEOOs4i+TNruBLwxIUL/UnNneuqOb7qBAGT4hSMrioSpMhsYtowH3SjZLXx+YzsJOn6ZH wLhyHTtzuSM9e/zqfIJdJnO8ke0JKbBQAQliXzaJnOcw25UaLuU4nZXaC6NKE5K94PGO1M Gc/RJCggLN+4kD0KqyVy1blw9d4cc0wYLy0jOVJHuUpJ56QRAgyL+X+rWwEpFU4sUWYZ/4 y5M4Jj+a835ASwXAVAxF81YkzR7xZ8yEMUBkhXxmVnRb/cDVRseVZUQ+dDSDdJ3mDA73nw NQHUMslg/YBE5mtM7vuNIv/QNDAnL8PBrW7cTOmeuBfnO1lqKq28wPMqfdbKIw== From: Theodor Thornhill Date: Fri, 02 Dec 2022 21:45:59 +0100 Message-ID: <87h6ydfsag.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::52; envelope-from=theo@thornhill.no; helo=out-82.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Hi Eli, Yuan and others, mark-defun errors when node is missing in the call to goto-char. Repro: emacs -Q find-file xdisp.c M-g M-g 450 RET M-x mark-defun Observe that emacs is erroring. This patch fixes this bug. However, I notice that treesit-beginning-of-defun returns t after it is done. Is there a reason for end-of-defun not to return the same? Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-treesit-end-of-defun-handle-nil-node.patch >From 5e85e6e23f6dde43fc6433bed819c6d9f827007c Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Fri, 2 Dec 2022 21:40:50 +0100 Subject: [PATCH] Make treesit-end-of-defun handle nil node * lisp/treesit.el (treesit-end-of-defun): Change from 'let*' to 'when-let*'. --- lisp/treesit.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 0de0e283c3..e0949d7328 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1611,9 +1611,9 @@ treesit-end-of-defun "Tree-sitter `end-of-defun' function." ;; Why not simply get the largest node at point: when point is at ;; (point-min), that gives us the root node. - (let* ((node (treesit-search-forward - (treesit-node-at (point)) treesit-defun-type-regexp t t)) - (top (treesit--defun-maybe-top-level node))) + (when-let* ((node (treesit-search-forward + (treesit-node-at (point)) treesit-defun-type-regexp t t)) + (top (treesit--defun-maybe-top-level node))) (goto-char (treesit-node-end top)))) ;;; Activating tree-sitter -- 2.34.1 --=-=-=-- From unknown Sun Jun 22 08:09:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#59788: 29.0.60; [PATCH] Make treesit-end-of-defun handle nil node Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Dec 2022 06:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59788 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Theodor Thornhill Cc: 59788@debbugs.gnu.org, casouri@gmail.com Received: via spool by 59788-submit@debbugs.gnu.org id=B59788.167004925920682 (code B ref 59788); Sat, 03 Dec 2022 06:35:02 +0000 Received: (at 59788) by debbugs.gnu.org; 3 Dec 2022 06:34:19 +0000 Received: from localhost ([127.0.0.1]:51259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1M6M-0005NW-LD for submit@debbugs.gnu.org; Sat, 03 Dec 2022 01:34:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1M6K-0005NQ-3K for 59788@debbugs.gnu.org; Sat, 03 Dec 2022 01:34:17 -0500 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 1p1M6E-0003mt-GZ; Sat, 03 Dec 2022 01:34:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UhRulD+yjyRfUIzjYHBAQ0nTibhElAQC+TkskK4whI0=; b=f5Dx3bV3g3Vg Fvh51IxCGCSr8z18eVqjiZRpbqfqewX3gsi1R0IvGOvvhuwsP59/5P+Xoq4MEu7dQOp618GwRJc68 aXuF+5Fjq4weGQl6FzZsXhD37BVa7LR9YNNw9FNmZUbiqXQlTcLf2mZzscKbXiwJiOXO7Q4ceJoQ6 FTHJtvhtvD22KOPQodmpfeD9rL3Q35JMtaPVl7HF+TNijwGXx+J88RPyFEczZrdLQRbg/Liad7aWr x+JeO3AFOLeDx2bm9jN7DE3Z7YCVUFDzk1zk31XuiBai+Futg+jHGDSutmzCj/+o6V4hpPc0+cAa6 O7v6eZZ0++e/74O3KpkEmg==; 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 1p1M6D-0000cN-V0; Sat, 03 Dec 2022 01:34:10 -0500 Date: Sat, 03 Dec 2022 08:33:46 +0200 Message-Id: <83tu2ddmid.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87h6ydfsag.fsf@thornhill.no> (message from Theodor Thornhill on Fri, 02 Dec 2022 21:45:59 +0100) References: <87h6ydfsag.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: casouri@gmail.com, eliz@gnu.org > From: Theodor Thornhill > Date: Fri, 02 Dec 2022 21:45:59 +0100 > > However, I notice that treesit-beginning-of-defun returns t after it is > done. Is there a reason for end-of-defun not to return the same? The return value of end-of-defun is not documented, so it can be anything. From unknown Sun Jun 22 08:09:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#59788: 29.0.60; [PATCH] Make treesit-end-of-defun handle nil node Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Dec 2022 07:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59788 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 59788@debbugs.gnu.org, casouri@gmail.com Received: via spool by 59788-submit@debbugs.gnu.org id=B59788.167005087221773 (code B ref 59788); Sat, 03 Dec 2022 07:02:02 +0000 Received: (at 59788) by debbugs.gnu.org; 3 Dec 2022 07:01:12 +0000 Received: from localhost ([127.0.0.1]:51289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1MWO-0005f7-AF for submit@debbugs.gnu.org; Sat, 03 Dec 2022 02:01:12 -0500 Received: from out-29.mta0.migadu.com ([91.218.175.29]:50860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1MWJ-0005f1-Qx for 59788@debbugs.gnu.org; Sat, 03 Dec 2022 02:01:10 -0500 Date: Sat, 03 Dec 2022 08:00:17 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670050864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AuXi65mUtXnOlXoX8hZr+0S8G+oNHFxFDvS4ceUTaRc=; b=Ta3OPTbHUT3DVu/uyJpPiYXXc+EDDDEtDaJW1hi0kkPMxLzGGhCIyyjBjbzGzZkDQzGPSz waHFEnPb3cRzgUFrEpvodec0zHOFjA6Uzvel+1AsGP47g5/4tj7i6F/AbNOC7ssOPqcIF1 fsuv6UNfMCzqcrQ5+hzS5w7ArABlqyEA81GnWImOkMWpG1nfvVr1s5BeiMdQw5HN/C82Jz JlKoFJJZDKW8L2nV+/EPzK+y/j5mbHaBpDPIg6H/lGXwpQiuuMVW2QtD9QX9HyDoEQEnNZ +a+1o66x283Gdg4qMV1bibOZeZT0xRpRxNGJm/xnI4xugcMyFbOB+I3B/fDTcQ== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill In-Reply-To: <83tu2ddmid.fsf@gnu.org> References: <87h6ydfsag.fsf@thornhill.no> <83tu2ddmid.fsf@gnu.org> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 3 December 2022 07:33:46 CET, Eli Zaretskii wrote: >> Cc: casouri@gmail=2Ecom, eliz@gnu=2Eorg >> From: Theodor Thornhill >> Date: Fri, 02 Dec 2022 21:45:59 +0100 >>=20 >> However, I notice that treesit-beginning-of-defun returns t after it is >> done=2E Is there a reason for end-of-defun not to return the same? > >The return value of end-of-defun is not documented, so it can be anything= =2E Ok thanks, then I think this patch is ok now :) Theo From unknown Sun Jun 22 08:09:53 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Theodor Thornhill Subject: bug#59788: closed (Re: bug#59788: 29.0.60; [PATCH] Make treesit-end-of-defun handle nil node) Message-ID: References: <87h6ydfsag.fsf@thornhill.no> X-Gnu-PR-Message: they-closed 59788 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 59788@debbugs.gnu.org Date: Mon, 05 Dec 2022 06:23:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1670221382-374-1" This is a multi-part message in MIME format... ------------=_1670221382-374-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #59788: 29.0.60; [PATCH] Make treesit-end-of-defun handle nil node which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 59788@debbugs.gnu.org. --=20 59788: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D59788 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1670221382-374-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 59788-done) by debbugs.gnu.org; 5 Dec 2022 06:22:55 +0000 Received: from localhost ([127.0.0.1]:33951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p24sQ-00005i-Rc for submit@debbugs.gnu.org; Mon, 05 Dec 2022 01:22:55 -0500 Received: from mx0b-0016e101.pphosted.com ([148.163.141.31]:43062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p24sM-00005c-SO for 59788-done@debbugs.gnu.org; Mon, 05 Dec 2022 01:22:53 -0500 Received: from pps.filterd (m0151357.ppops.net [127.0.0.1]) by mx0b-0016e101.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B56DMMX007410 for <59788-done@debbugs.gnu.org>; Sun, 4 Dec 2022 22:22:45 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucsd.edu; h=from : content-type : content-transfer-encoding : mime-version : subject : message-id : date : cc : to; s=campus; bh=bWpxNAr9AAWQ7pljWHO9/pTXFD23jTDXbU82aLoqaOU=; b=pOuZe0PPiM5t6CuuzaE0/juLbbm/D1D4wB0RdhwOiqDNSv2116mkjwQO63rLhSmpo2/m 8w76xv7CZyRytQnILop1UPjzVpzysCvqBd261nv9t3RHwQvQ4hpCLdfs7vvoB4DTGAwH zVkdISXVa1rjw7hp0K+H2g4m7cSk778ml2ZGueHM/ppdu5zWaQLBxqmSnK6p9kTAj5+d /zFBaIv+Owpg4OfFi5n/lV4IZ0qFMmqQohzLt/KcQrYO83jN22rJnfi3KaMePzwHXD3/ RJiiNaNsw4ksmblKNxqSnUTFzgL8VROrI/2CKRF+mj83eK13km6K1ySHpXr5DK8asvmc 9g== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0b-0016e101.pphosted.com (PPS) with ESMTPS id 3m96kh9gd4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for <59788-done@debbugs.gnu.org>; Sun, 04 Dec 2022 22:22:44 -0800 Received: by mail-pg1-f198.google.com with SMTP id r126-20020a632b84000000b004393806c06eso9368467pgr.4 for <59788-done@debbugs.gnu.org>; Sun, 04 Dec 2022 22:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucsd.edu; s=google; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=bWpxNAr9AAWQ7pljWHO9/pTXFD23jTDXbU82aLoqaOU=; b=l/ALOcQ4uxklJ7fJHnlFQCultMmC4mXvYOOs0GQtea2I5FdaVcTBkh+ewUGDRA9OvO hlosGp2S+StwbTBp2XQPRqBcZXNCR/YO/e4UZwhK2s//p9fxj2lF/AW9kmxZyDblEIxA xuf0PTEUylxGZjrFg8iKqwh3IgXzFnduyb61Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bWpxNAr9AAWQ7pljWHO9/pTXFD23jTDXbU82aLoqaOU=; b=DhQZme05V1GoRAvqYWuCHdI26s/8uYX3Jm+TtaurfnAMf469sz3bTA/w07zs3wleZM XkCAsltF2Gx3BWOjwpMSA8fyMHLKSnTDtPeJtNGuqf5o7DtcCQBzNNw6geLLj10pF3oF 8B+Ucy1dkWGQiroxQk+vPY/dd/OyCw4R3f0P22OwIJDEw0rZb+JdjG1XHiNYKWJifXE9 OMH99NBZhbjnjXHOA5GA8ngEhy4zOuL95qahcyT3XDHnImarK4wnxMNWUkjquG55BNhe eAqyktMU79VbcJ7moTuoF0m0ZRVWsTJevdGIv4JTVFsJNRhc9eGRbn/w+TfkZknKZqeC Q/pw== X-Gm-Message-State: ANoB5pm9/f7vkXh/jW904ZCMTvlkRbse6GMPXVfEx4Y7tRQv2M1Jfv9t a3rSw2zJ+KbQPv5DkiY4z1qVE/5/9P0jfr0Xy+HuHCPa1uUqO3vgENupaJlG4cSzAuC/YrFo5P/ 06iboczTpkokAW0AS0SJ6 X-Received: by 2002:a05:6a00:1625:b0:576:48b4:2b06 with SMTP id e5-20020a056a00162500b0057648b42b06mr15900815pfc.30.1670221363487; Sun, 04 Dec 2022 22:22:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf64pB1O+Onwb1N7cQwtMdj79kTPvXWNSNTMGGTE7YM7sh50RReaqPGj+ifVVLaj5XCTz9Y/uQ== X-Received: by 2002:a05:6a00:1625:b0:576:48b4:2b06 with SMTP id e5-20020a056a00162500b0057648b42b06mr15900794pfc.30.1670221363197; Sun, 04 Dec 2022 22:22:43 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id e7-20020a630f07000000b004777c56747csm7516645pgl.11.2022.12.04.22.22.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Dec 2022 22:22:42 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: bug#59788: 29.0.60; [PATCH] Make treesit-end-of-defun handle nil node Message-Id: Date: Sun, 4 Dec 2022 22:22:41 -0800 To: Theodor Thornhill X-Mailer: Apple Mail (2.3696.120.41.1.1) X-campus_gsuite: gsuite_33445511 X-Proofpoint-ORIG-GUID: jgz3Inc-l25TIMei7yNeulsMKE-bHJTh X-Proofpoint-GUID: jgz3Inc-l25TIMei7yNeulsMKE-bHJTh pp_allow_relay: proofpoint_allowed X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-05_01,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1011 phishscore=0 mlxlogscore=662 adultscore=0 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212050026 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59788-done Cc: eliz@gnu.org, 59788-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Theodor Thornhill writes: > On 3 December 2022 07:33:46 CET, Eli Zaretskii wrote: >>> Cc: casouri@gmail.com, eliz@gnu.org >>> From: Theodor Thornhill >>> Date: Fri, 02 Dec 2022 21:45:59 +0100 >>> >>> However, I notice that treesit-beginning-of-defun returns t after it is >>> done. Is there a reason for end-of-defun not to return the same? >> >>The return value of end-of-defun is not documented, so it can be anything. > > Ok thanks, then I think this patch is ok now :) > > Theo I think I applied a similar patch sent in another bug report, closing this. Thanks as always :-) Yuan ------------=_1670221382-374-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 2 Dec 2022 20:46:15 +0000 Received: from localhost ([127.0.0.1]:48772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1CvG-00016y-NF for submit@debbugs.gnu.org; Fri, 02 Dec 2022 15:46:15 -0500 Received: from lists.gnu.org ([209.51.188.17]:34014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1CvA-00016s-P2 for submit@debbugs.gnu.org; Fri, 02 Dec 2022 15:46:13 -0500 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 1p1CvA-0000FS-Fa for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 15:46:08 -0500 Received: from out-82.mta0.migadu.com ([2001:41d0:1004:224b::52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1Cv5-0007o5-Jx for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 15:46:08 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670013960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=e9EVCIhLAhMp3K01lnSaIjeHHdPBGYhmZWmIuxXWlcg=; b=HzEOOs4i+TNruBLwxIUL/UnNneuqOb7qBAGT4hSMrioSpMhsYtowH3SjZLXx+YzsJOn6ZH wLhyHTtzuSM9e/zqfIJdJnO8ke0JKbBQAQliXzaJnOcw25UaLuU4nZXaC6NKE5K94PGO1M Gc/RJCggLN+4kD0KqyVy1blw9d4cc0wYLy0jOVJHuUpJ56QRAgyL+X+rWwEpFU4sUWYZ/4 y5M4Jj+a835ASwXAVAxF81YkzR7xZ8yEMUBkhXxmVnRb/cDVRseVZUQ+dDSDdJ3mDA73nw NQHUMslg/YBE5mtM7vuNIv/QNDAnL8PBrW7cTOmeuBfnO1lqKq28wPMqfdbKIw== From: Theodor Thornhill To: bug-gnu-emacs@gnu.org Subject: 29.0.60; [PATCH] Make treesit-end-of-defun handle nil node X-Debbugs-CC: casouri@gmail.com, eliz@gnu.org Date: Fri, 02 Dec 2022 21:45:59 +0100 Message-ID: <87h6ydfsag.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::52; envelope-from=theo@thornhill.no; helo=out-82.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Hi Eli, Yuan and others, mark-defun errors when node is missing in the call to goto-char. Repro: emacs -Q find-file xdisp.c M-g M-g 450 RET M-x mark-defun Observe that emacs is erroring. This patch fixes this bug. However, I notice that treesit-beginning-of-defun returns t after it is done. Is there a reason for end-of-defun not to return the same? Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-treesit-end-of-defun-handle-nil-node.patch >From 5e85e6e23f6dde43fc6433bed819c6d9f827007c Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Fri, 2 Dec 2022 21:40:50 +0100 Subject: [PATCH] Make treesit-end-of-defun handle nil node * lisp/treesit.el (treesit-end-of-defun): Change from 'let*' to 'when-let*'. --- lisp/treesit.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 0de0e283c3..e0949d7328 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1611,9 +1611,9 @@ treesit-end-of-defun "Tree-sitter `end-of-defun' function." ;; Why not simply get the largest node at point: when point is at ;; (point-min), that gives us the root node. - (let* ((node (treesit-search-forward - (treesit-node-at (point)) treesit-defun-type-regexp t t)) - (top (treesit--defun-maybe-top-level node))) + (when-let* ((node (treesit-search-forward + (treesit-node-at (point)) treesit-defun-type-regexp t t)) + (top (treesit--defun-maybe-top-level node))) (goto-char (treesit-node-end top)))) ;;; Activating tree-sitter -- 2.34.1 --=-=-=-- ------------=_1670221382-374-1--