From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 02 15:46:15 2022 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 03 01:34:18 2022 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 To: Theodor Thornhill In-Reply-To: <87h6ydfsag.fsf@thornhill.no> (message from Theodor Thornhill on Fri, 02 Dec 2022 21:45:59 +0100) Subject: Re: bug#59788: 29.0.60; [PATCH] Make treesit-end-of-defun handle nil node References: <87h6ydfsag.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59788 Cc: 59788@debbugs.gnu.org, casouri@gmail.com 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 debbugs-submit-bounces@debbugs.gnu.org Sat Dec 03 02:01:12 2022 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 To: Eli Zaretskii Subject: =?US-ASCII?Q?Re=3A_bug=2359788=3A_29=2E0=2E60=3B_=5BPATCH=5D_Make?= =?US-ASCII?Q?_treesit-end-of-defun_handle_nil_node?= 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-Debbugs-Envelope-To: 59788 Cc: 59788@debbugs.gnu.org, casouri@gmail.com 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 debbugs-submit-bounces@debbugs.gnu.org Mon Dec 05 01:22:55 2022 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 From unknown Sun Jun 22 04:35:25 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 02 Jan 2023 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator