GNU logs - #60650, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#60650: 30.0.50; tree-sitter: parsing (and font locking) occasionally breaks during editing
Resent-From: Mickey Petersen <mickey@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 08 Jan 2023 10:40:01 +0000
Resent-Message-ID: <handler.60650.B.167317434714071 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 60650
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 60650 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.167317434714071
          (code B ref -1); Sun, 08 Jan 2023 10:40:01 +0000
Received: (at submit) by debbugs.gnu.org; 8 Jan 2023 10:39:07 +0000
Received: from localhost ([127.0.0.1]:59963 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pET50-0003er-Fy
	for submit <at> debbugs.gnu.org; Sun, 08 Jan 2023 05:39:06 -0500
Received: from lists.gnu.org ([209.51.188.17]:52972)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mickey@HIDDEN>) id 1pET4y-0003ed-27
 for submit <at> debbugs.gnu.org; Sun, 08 Jan 2023 05:39:04 -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 <mickey@HIDDEN>)
 id 1pET4x-0001u1-SW
 for bug-gnu-emacs@HIDDEN; Sun, 08 Jan 2023 05:39:03 -0500
Received: from mail-cwlgbr01on2133.outbound.protection.outlook.com
 ([40.107.11.133] helo=GBR01-CWL-obe.outbound.protection.outlook.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mickey@HIDDEN>)
 id 1pET4u-0003Id-9j
 for bug-gnu-emacs@HIDDEN; Sun, 08 Jan 2023 05:39:03 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=XZ6XaFtnhrQL4OMBo3cSsOXXU1AFsaCJct688YxJR1Om05ZJplUGPAFfozJnRAMyRdcnW8GXMh/fimBxSHIkAtGlSeXRdr4y95zTH0cc/59vVFCt6jCMAWZU+thHeai3cx3GGk0QaZFxD+KSzCFKBt6+rgDQSpmyW8vgVcpcg3nfT1N2ry4ZUC0HDuHNVjbSn78ATcmdcPuXlGlcEx4V968og0ZOwge6hIa9cEia+c8D63LVLQucCL+uh9jdIbrneiAJFkJpzfpdD6gc5jWkbbhFGQj6B8BuZHFcC33wcxx/usd58td269/OgCEu5ZkoBYQaxdOJiHPeyLyO1iccbw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=WOeIxNSAyowwJNUC9kxtg/rIVnT7/84oC+nnsYUmmWw=;
 b=b2pPV7/GPiUPi4a3Oou6KZi4wBunIVhdBpU5sXK8TnICGpGw1r/wQiWMzE2jWmFsdJGWzM1EkuyAn0qndcEMa4pUn56eG0W13dFRx3HlGRg2+0Y2KVJlmvnsBMldZ5VcJHZSG0LsmZ1+lZ4VYApH62V8RGuaUGuihCzuOSNI4aPupsEkDbwWEVSK78M3AdJEFwf32TKw/0JVgbhRyVn8IbQD2uTK3jw5Pz6ptCh0Ed4YLf+SgGU4VLtmxFhEb8kcOwi+VTTpNv2y2amEmKLgmDAIaq1U8KLsjHvICpHXlrNVHPmm0fJbLuf2tJKkzOKyeKx1tmW88JFlIr7u8TqJTw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 178.79.136.144) smtp.rcpttodomain=gnu.org smtp.mailfrom=masteringemacs.org;
 dmarc=pass (p=none sp=none pct=100) action=none
 header.from=masteringemacs.org; dkim=pass (signature was verified)
 header.d=masteringemacs.org; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=WOeIxNSAyowwJNUC9kxtg/rIVnT7/84oC+nnsYUmmWw=;
 b=by9P9lxbh8u6mzLxuuYTkCuw58Nms+45aDs0eOnpYKaZvpL3xU7yrCTbVrKsu1jgTsYijQEDSGUqbPovxwVMS600fzEP7DE+YyW3E/n0yzmfmuET8PH0mNzySZ3viQx+wQd6kY5HdI8Ovyg3s6zLomVHTjy+H7/WMrjnB/m4Na0=
Received: from LO2P265CA0440.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::20) by
 LO2P265MB5728.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:26a::6) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.5986.18; Sun, 8 Jan 2023 10:38:56 +0000
Received: from CWLGBR01FT039.eop-gbr01.prod.protection.outlook.com
 (2603:10a6:600:e:cafe::d6) by LO2P265CA0440.outlook.office365.com
 (2603:10a6:600:e::20) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend
 Transport; Sun, 8 Jan 2023 10:38:56 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144)
 smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified)
 header.d=masteringemacs.org;dmarc=pass action=none
 header.from=masteringemacs.org;
Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org
 designates 178.79.136.144 as permitted sender)
 receiver=protection.outlook.com; client-ip=178.79.136.144;
 helo=semantical.co.uk; pr=C
Received: from semantical.co.uk (178.79.136.144) by
 CWLGBR01FT039.mail.protection.outlook.com (10.152.40.167) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.5966.17 via Frontend Transport; Sun, 8 Jan 2023 10:38:56 +0000
Received: by semantical.co.uk (Postfix, from userid 5001)
 id E1318114002; Sun,  8 Jan 2023 10:38:55 +0000 (GMT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org;
 s=masteringemacs.org; t=1673174335;
 bh=WOeIxNSAyowwJNUC9kxtg/rIVnT7/84oC+nnsYUmmWw=;
 h=From:To:Subject:Date:From;
 b=Wxs0gE/KZBoOQOpNxNd2LZIhXHoJ3l0VJjZkQCHl68xEyvZlB0iUDYKgvu/zUXr78
 KBAQBbBW3qANv2SEnH94CTnnzrirNDJs2I7SvM6aFIzJUJ9+QtGogEKHM2ZTZYbsaz
 qGiEOSIf00Z5tAXXY7Xc2D0MBlTksukZoBqEt2DQ=
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED,
 NO_RELAYS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2
From: Mickey Petersen <mickey@HIDDEN>
Date: Sun, 08 Jan 2023 10:38:54 +0000
Message-ID: <87358ll39d.fsf@HIDDEN>
Content-Type: text/plain
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: CWLGBR01FT039:EE_|LO2P265MB5728:EE_
MIME-Version: 1.0
X-MS-Office365-Filtering-Correlation-Id: 8d3964e8-2971-4200-78db-08daf1648b48
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: BOoHTqf51XZQ8uHn1X19ziaIk1TBHiRbqC86ct9dfaOqW0TZyg0U5txe1YPR3qAzblInBJg4Zs2W+zC/YKFchU/bnl1BlI53qrTy6kcOvacs11f5ccVg+2dk/PJL+ahnIBdKTyRz28aRb6PFNaRlM9n80VHucV/fkYsFHyF7H4v17DKTZLc/Q9UYcw9W6/8L89/2i34lLRSPQMF4yE/6zEFkYjdbrsM2HvsoPx5v3zY05ub84YbgS84shhibDNmvob7C1pGcqD7KTF+PGzWbW4/o24Bt+zwuqKNQQNKH/Fit4G2r0oViAcuZ0Me7KDhNtwd0ydiuxGSCDdEHi23pVpncN5Q1vCQOeod4XsovmBO4PscZFHut9ivXu8fTqqKlxgW7/au/tBEP3a8QfqIUZRYGe9pCOap6vGKq9NDJuaibVldggkSJjgLVdxmBZuTVLg00GI2LutCJMEHHXWaylI1uQLIedztsAl9hcc/TH7YcWxCY7rDwQs82rSGalNymUv4LndUJOHHUdvh6CBwQVHNO/twEUA8yn04Ag7TvPXKA7lt1QA5WsvLeXGMDsK+o4B2pxhEY7coBenvxjybuhaTSjaiWUsbNlgxzDl2noACScubOYROffPSp6F9U+yp6x1UdmvcnnT98/pzmCrhZ+1MyEMpvvPSOR+lMa7G63xdvLSxUBg8WWMTJJHphYVdfnBHXZ+p4npSNz7yX/kp/U3CYgsqwK4pV9NtutWM/MtLNzbKrgbhx0hzEIKA6HMG+
X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE;
 SFS:(13230022)(346002)(39830400003)(136003)(376002)(396003)(451199015)(46966006)(36840700001)(47076005)(83380400001)(36860700001)(7596003)(7636003)(86362001)(356005)(2906002)(41300700001)(5660300002)(8936002)(82310400005)(40480700001)(2616005)(336012)(478600001)(6266002)(26005)(8676002)(186003)(316002)(6916009)(70206006)(42186006)(70586007)(36756003)(38230200001)(79816003)(14776008);
 DIR:OUT; SFP:1102; 
X-OriginatorOrg: masteringemacs.org
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2023 10:38:56.1793 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 8d3964e8-2971-4200-78db-08daf1648b48
X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144];
 Helo=[semantical.co.uk]
X-MS-Exchange-CrossTenant-AuthSource: CWLGBR01FT039.eop-gbr01.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO2P265MB5728
Received-SPF: pass client-ip=40.107.11.133;
 envelope-from=mickey@HIDDEN;
 helo=GBR01-CWL-obe.outbound.protection.outlook.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,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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 <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.4 (--)


It is occasionally possible to put the tree-sitter parser, I am guessing, into an erroneous state w.r.t. the contents of the buffer it is charged with parsing.

This rarely presents itself, and when it does, it only seems to happen when text is deleted and inserted in short order (`delete-region' + `insert') from an elisp command.

The resulting erroneous state then breaks font locking, resulting in mis-fontified code.

I must note that the parse tree is _correct_ and not invalid. There is no easy way to 'fix' this bug, as newlines and other manual edits rarely fixes the issue. There is also no easy way to insist that tree-sitter must re-do everything. Presumably deleting and recreating the parser could work as a workaround? I do not know.

The only way to truly and accurately fix the issue is to save and re-open the file. This then forces a complete re-parse of the buffer and fontification, fixing the issue.

I have zero means of reliably of reproducing this, unfortunately: it is sporadic, intermittent, and happens somewhat infrequently.

So I'd love some ideas on how to go about debugging this.



In GNU Emacs 30.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version
 3.24.20, cairo version 1.16.0) of 2023-01-02 built on mickey-work
Repository revision: c209802f7b3721a1b95113290934a23fee88f678
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.3 LTS

Configured using:
 'configure --with-native-compilation --with-json --with-mailutils
 --without-compress-install --with-imagemagick CC=gcc-10'





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Mickey Petersen <mickey@HIDDEN>
Subject: bug#60650: Acknowledgement (30.0.50; tree-sitter: parsing (and
 font locking) occasionally breaks during editing)
Message-ID: <handler.60650.B.167317434714071.ack <at> debbugs.gnu.org>
References: <87358ll39d.fsf@HIDDEN>
X-Gnu-PR-Message: ack 60650
X-Gnu-PR-Package: emacs
Reply-To: 60650 <at> debbugs.gnu.org
Date: Sun, 08 Jan 2023 10:40:01 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 60650 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
60650: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D60650
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#60650: 30.0.50; tree-sitter: parsing (and font locking)  occasionally breaks during editing
References: <87358ll39d.fsf@HIDDEN>
In-Reply-To: <87358ll39d.fsf@HIDDEN>
Resent-From: Yuan Fu <casouri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 09 Jan 2023 03:23:02 +0000
Resent-Message-ID: <handler.60650.B60650.16732345802509 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 60650
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Mickey Petersen <mickey@HIDDEN>
Cc: 60650 <at> debbugs.gnu.org
Received: via spool by 60650-submit <at> debbugs.gnu.org id=B60650.16732345802509
          (code B ref 60650); Mon, 09 Jan 2023 03:23:02 +0000
Received: (at 60650) by debbugs.gnu.org; 9 Jan 2023 03:23:00 +0000
Received: from localhost ([127.0.0.1]:35352 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pEikW-0000eO-5a
	for submit <at> debbugs.gnu.org; Sun, 08 Jan 2023 22:23:00 -0500
Received: from mail-pj1-f48.google.com ([209.85.216.48]:43569)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1pEikT-0000e4-3e
 for 60650 <at> debbugs.gnu.org; Sun, 08 Jan 2023 22:22:58 -0500
Received: by mail-pj1-f48.google.com with SMTP id
 b9-20020a17090a7ac900b00226ef160dcaso6267870pjl.2
 for <60650 <at> debbugs.gnu.org>; Sun, 08 Jan 2023 19:22:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:cc:date:message-id:subject:mime-version
 :content-transfer-encoding:from:from:to:cc:subject:date:message-id
 :reply-to; bh=7I2X+jPeqUOtyCyjUdYAt9ue5wBOdfcebGE8qOWODDE=;
 b=jUvhAUdNWw0kQPpeAIkQAVlfvYxmMoJHCiEfqsb1CzXpR4ZJXLRFNPVZMDH94NS9WQ
 vBwkG4whcx7xKgrQQ5FpZJf4toxMcbYS8SN6uWxkgPMYUxXlhtAVrCyklwyWz2p/oU2J
 YTVPzY04IdazUQ1LJsz4Z0GnT6NzO+MBeh6k3ATA+Aj3qT/g8RxBZmrJEPxS87Kj/JKq
 knxxlQ1veEWa9Z/5JsvQOdGAs68wtFaCAxpZ0vsF2ot/T1bUJq6QYYpwy7AYGISd5oRt
 fDmCCYEIg8kv3sXsQqBuXXhngj2ZXI2Aclwff8bTaa1R3E4QXnNioOtlcFRtb8K/Ejb0
 pRoA==
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=7I2X+jPeqUOtyCyjUdYAt9ue5wBOdfcebGE8qOWODDE=;
 b=eRsNXca769o4XrUhvb9fKeyoGTE4BTBF8+ELYC9n6vwEex7qVeQcjvCADdFn87eP/9
 qknG7z7k35J64jneguC9yk5XfGBQYHZfogmJqqhRpQy9LKlHIgLk7Cx16cpf78pBnxla
 IZvS2rxl9CsPrcyiZIvYntZMCPndWJYGHSE8bF9/nQCvT2u2fXGeE9ryK4QtbbvG1nEZ
 NbT06HyvzWKYpQ/PLIfs181Q+cidvPs9i2vAvL5qqGkQTyDkn7ufEo0KXXlLawBn/f8F
 9Om6h4IOrioeiXj2cGjgGXsB6wnkt54Bu4GkTH29yAmXeMQbtDjNJ0rVzWUHk98SZB5i
 ci9A==
X-Gm-Message-State: AFqh2kq8/Re3aJ+KSj3pqOEeeVUUIl9xP0L1wNUCi08phXywcnr3JojE
 2r0Zm/BwpyKHgXUiTSRye6JoHvMULXI=
X-Google-Smtp-Source: AMrXdXuIlX6BI6BSU4kNOAfLv2pwSJ4izO9/0c55LQDKlMASAM2/g0R5vO+0IOqHxWkF9kEJm5VQhg==
X-Received: by 2002:a17:903:130b:b0:193:1a2a:d054 with SMTP id
 iy11-20020a170903130b00b001931a2ad054mr7995307plb.30.1673234571164; 
 Sun, 08 Jan 2023 19:22:51 -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
 f5-20020a170902ce8500b00178b9c997e5sm4821073plg.138.2023.01.08.19.22.50
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 08 Jan 2023 19:22:50 -0800 (PST)
From: Yuan Fu <casouri@HIDDEN>
Content-Type: text/plain;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\))
Message-Id: <FDC429FD-DB4B-4325-AC94-7C5898E7BADC@HIDDEN>
Date: Sun, 8 Jan 2023 19:22:49 -0800
X-Mailer: Apple Mail (2.3696.120.41.1.1)
X-Spam-Score: 0.0 (/)
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 (-)


Mickey Petersen <mickey@HIDDEN> writes:

> It is occasionally possible to put the tree-sitter parser, I am
> guessing, into an erroneous state w.r.t. the contents of the buffer it
> is charged with parsing.
>
> This rarely presents itself, and when it does, it only seems to happen
> when text is deleted and inserted in short order (`delete-region' +
> `insert') from an elisp command.
>
> The resulting erroneous state then breaks font locking, resulting in =
mis-fontified code.
>
> I must note that the parse tree is _correct_ and not invalid. There is
> no easy way to 'fix' this bug, as newlines and other manual edits
> rarely fixes the issue. There is also no easy way to insist that
> tree-sitter must re-do everything. Presumably deleting and recreating
> the parser could work as a workaround? I do not know.
>
> The only way to truly and accurately fix the issue is to save and
> re-open the file. This then forces a complete re-parse of the buffer
> and fontification, fixing the issue.

What do you mean by "correct and not invalid"? If a complete re-parse
fixes the issue, then the old parse tree must be incorrect, right? As
for mis-fontified code, is the position wrong (everything skew left or
right for a few character), or there is no fontification, or something
else? If the position is wrong, then it=E2=80=99s probably a bug in =
syncing the
parser=E2=80=99s position wrt the buffer content.

> I have zero means of reliably of reproducing this, unfortunately: it =
is sporadic, intermittent, and happens somewhat infrequently.
>
> So I'd love some ideas on how to go about debugging this.

I think the first step is to better understand what=E2=80=99s happening. =
Some
screenshots are also welcome. Thanks for your effort in advance!

Yuan




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#60650: 30.0.50; tree-sitter: parsing (and font locking) occasionally breaks during editing
Resent-From: Mickey Petersen <mickey@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 09 Jan 2023 09:07:01 +0000
Resent-Message-ID: <handler.60650.B60650.167325521724123 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 60650
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Yuan Fu <casouri@HIDDEN>
Cc: 60650 <at> debbugs.gnu.org
Received: via spool by 60650-submit <at> debbugs.gnu.org id=B60650.167325521724123
          (code B ref 60650); Mon, 09 Jan 2023 09:07:01 +0000
Received: (at 60650) by debbugs.gnu.org; 9 Jan 2023 09:06:57 +0000
Received: from localhost ([127.0.0.1]:35758 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pEo7M-0006H0-Ok
	for submit <at> debbugs.gnu.org; Mon, 09 Jan 2023 04:06:57 -0500
Received: from mail-cwlgbr01on2120.outbound.protection.outlook.com
 ([40.107.11.120]:36596 helo=GBR01-CWL-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mickey@HIDDEN>) id 1pEo7I-0006Gl-8J
 for 60650 <at> debbugs.gnu.org; Mon, 09 Jan 2023 04:06:56 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=M8Ujbh8BeLtHZLLBMxAwp8Hi1SoP5hTBbwSdPVPKLwIHbpT1xT+yFeHMihHz2dIwuE18X+IUlkiBigm+qNCwqqHQ322CtteK4fJpgctEW3CJDxbf1ZrUJ2fe0cugFCw+Ig5hpCiI1xpFwIcZ0kOhgAaVQXD6V6YHzRV9TA5agW6xvU5otKgVsvaCWnzQbgX7FLxmpnD8EEeiNkvckp5CNugymzXy3sbDPXPeOS8uxxwiP+fNu78m7DV1yMaYQ+pEjNNU/bSCootO1+w/t/DBlmUx7pzXpwTMeWvD6udAIdJdtb0SvC5IVRChYbvpH5YipaGMCzm14zymWvaORre/dg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=SK6PYW4isRGtUKrndTazC2VhidjuvfqS2PcvcHyjVf0=;
 b=bUbF3Fsi1JZdZGS6X7cQ+Uj/mns63li2NtfLvxnOaTdF/F1eoEPsg6cH5hwsIL8iHBJ55lSFIRvCq7H4xsM1u10NfWLUaJMqFUmwBQ7x+APPQJ/EqsxjYTc98gzQ1NommkxMODzJxFt/JyYCH+tiGLlQoEtwEw5Y/HqKzYNfcZ+IKceDTS05McaPY+IZQALBG4joKbFx4OTNz9avqE/Impl4FfHIQgrdKKwdsRHo4/zk88xsGlV1xL6JHv0LBdC5xoGu3tUY+KQjHu3u7fLGXnvCUpVY4gqbEAmP0g9N6HEsPWbAGAOGRPorfFrfBRKPTu1e+hP5iUuHok7vdjTLJg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org
 smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100)
 action=none header.from=masteringemacs.org; dkim=pass (signature was
 verified) header.d=masteringemacs.org; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=SK6PYW4isRGtUKrndTazC2VhidjuvfqS2PcvcHyjVf0=;
 b=HGWaEJVzqZt3j8yztMnNvgcx+yOyLzdOz87X4jtb5Cp7O4fb8vuAUE/5coAMUbVLOpBn0MxE9FCYVFGIxCPy9IePFlvH61E3Ep49UOkaoBRSuw7C3lSuQkHO0OzFAOc99SUr1JAbGESMxu+AFW8oZpRO+C1taOrLmfD5otwVT6o=
Received: from LNXP265CA0028.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::16)
 by LO0P265MB6818.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2d7::9) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan
 2023 09:06:43 +0000
Received: from LO2GBR01FT027.eop-gbr01.prod.protection.outlook.com
 (2603:10a6:600:5c:cafe::4d) by LNXP265CA0028.outlook.office365.com
 (2603:10a6:600:5c::16) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend
 Transport; Mon, 9 Jan 2023 09:06:43 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144)
 smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified)
 header.d=masteringemacs.org;dmarc=pass action=none
 header.from=masteringemacs.org;
Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org
 designates 178.79.136.144 as permitted sender)
 receiver=protection.outlook.com; client-ip=178.79.136.144;
 helo=semantical.co.uk; pr=C
Received: from semantical.co.uk (178.79.136.144) by
 LO2GBR01FT027.mail.protection.outlook.com (10.152.42.153) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 09:06:43 +0000
Received: by semantical.co.uk (Postfix, from userid 5001)
 id 07A40114002; Mon,  9 Jan 2023 09:06:43 +0000 (GMT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org;
 s=masteringemacs.org; t=1673255203;
 bh=SK6PYW4isRGtUKrndTazC2VhidjuvfqS2PcvcHyjVf0=;
 h=References:From:To:Cc:Subject:Date:In-reply-to:From;
 b=vKWcImTrJgtG7b5KL/94bOL4rTUB8Ug4C6/JLke+dquGgSLHKoAnIzpNOgzwpnxmC
 Ywz//5VadRp9XUI6mMu4MMgWEMozj/cwX9tTARDlzBTQkvEEEzeGRsgEAE6Z/HQPpT
 FHwVRPGAgJz//3mtrV+SaZrOF//xTtgVTRte/KI4=
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED,
 NO_RELAYS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2
References: <FDC429FD-DB4B-4325-AC94-7C5898E7BADC@HIDDEN>
User-agent: mu4e @VERSION@; emacs 30.0.50
From: Mickey Petersen <mickey@HIDDEN>
Date: Mon, 09 Jan 2023 09:02:41 +0000
Organization: Mastering Emacs
In-reply-to: <FDC429FD-DB4B-4325-AC94-7C5898E7BADC@HIDDEN>
Message-ID: <87ilhghyam.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: LO2GBR01FT027:EE_|LO0P265MB6818:EE_
MIME-Version: 1.0
X-MS-Office365-Filtering-Correlation-Id: c2e39bbe-f6f9-45af-aa4e-08daf220d3f3
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: ve2OnVm5cOJ3MVrK7iWH8/ptPZiZ0kW0DJksK2rCeb6WAzGqlRUIwXlXZNsEBmK5Pwoe0F8ua+CrAYJA8MHGSpObIyQMzwe7+bWsiRkuU7ibCkNoe3BEFkVfQoDRKsmRhOw5W9arOd5Rn3XCZigDGaexfWyusM0rh+p8gqKDrnn/LLVkWk4zfAARGzFphqvR6N1+LNB3NfB7A1vIJlu5P9GVQPQs0rUUrCEVf3cy6wURkMobzqX/uRazqbrYlSZ+uPdi7/V9+wGFK2A6ZbgTmjXuR/dy9Y6CnHTNFfb1yHAYn22iGI9Z8W49+7BLQSNplPpDZ8JlDJfqZT9saAfPN3Fb2dyxX6rJ2e0GkLRdMmv7y5FBsF1JoJejd0BXa8jO9l/blQzYevPlfxAlYLIFeeEOSci8T40tOwwR4cjBckQdAEZgzwozkIsGibvv8pFt73Nj2XLriSnxxG9RDYrl+EBTcOWUVEjXCOT9dYgPBTOMKc1KciWHRAf4xILBjkqItReeeBNRcT+naAZWORiUV+qJ4ZuV2poW55KFo5aiBGNiQ2iPSCc8LFNDgJTqvCJgE2RtA93Sd951UdRyjlWSxK3l1ogNmlxxEnBNAZ5rjLfZ3vXpOqq10DZLYFPRI4I3Yl7q1+PxAPJePDO+gpcyhV5Ka+mzHO94B+LdR9A797uyG0YValtulursGdiKTwHOmJnIz7wkflozP4pMMSA7Y36Er/T+5ZjgZQ5rlr9ErHe6u/E+poxFfYsMnZkrpEjS
X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE;
 SFS:(13230022)(39830400003)(346002)(376002)(136003)(396003)(451199015)(36840700001)(46966006)(8676002)(70586007)(42186006)(4326008)(70206006)(316002)(36916002)(356005)(2906002)(5660300002)(7596003)(8936002)(6862004)(41300700001)(7636003)(47076005)(86362001)(36756003)(36860700001)(83380400001)(478600001)(40480700001)(336012)(2616005)(186003)(6266002)(26005)(66899015)(82310400005)(38230200001)(79816003)(14776008);
 DIR:OUT; SFP:1102; 
X-OriginatorOrg: masteringemacs.org
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 09:06:43.4870 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: c2e39bbe-f6f9-45af-aa4e-08daf220d3f3
X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144];
 Helo=[semantical.co.uk]
X-MS-Exchange-CrossTenant-AuthSource: LO2GBR01FT027.eop-gbr01.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB6818
X-Spam-Score: -0.0 (/)
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 (-)


Yuan Fu <casouri@HIDDEN> writes:

> Mickey Petersen <mickey@HIDDEN> writes:
>
>> It is occasionally possible to put the tree-sitter parser, I am
>> guessing, into an erroneous state w.r.t. the contents of the buffer it
>> is charged with parsing.
>>
>> This rarely presents itself, and when it does, it only seems to happen
>> when text is deleted and inserted in short order (`delete-region' +
>> `insert') from an elisp command.
>>
>> The resulting erroneous state then breaks font locking, resulting in mis=
-fontified code.
>>
>> I must note that the parse tree is _correct_ and not invalid. There is
>> no easy way to 'fix' this bug, as newlines and other manual edits
>> rarely fixes the issue. There is also no easy way to insist that
>> tree-sitter must re-do everything. Presumably deleting and recreating
>> the parser could work as a workaround? I do not know.
>>
>> The only way to truly and accurately fix the issue is to save and
>> re-open the file. This then forces a complete re-parse of the buffer
>> and fontification, fixing the issue.
>
> What do you mean by "correct and not invalid"? If a complete re-parse
> fixes the issue, then the old parse tree must be incorrect, right? As
> for mis-fontified code, is the position wrong (everything skew left or
> right for a few character), or there is no fontification, or something
> else? If the position is wrong, then it=E2=80=99s probably a bug in synci=
ng the
> parser=E2=80=99s position wrt the buffer content.

I mean that the source code is syntactically correct. Given a clean
slate, the parser would not report any erroneous nodes.

But, somehow, both the font lock and indentation remains incorrect, even wh=
en I type text that would otherwise force a reparse. The only way to fix th=
is is to save the buffer (in a correct state), close and re-open the file. =
That fixes it.

That, and undoing the edited steps done by the elisp code. That snaps it ba=
ck to its original state, and the parse tree is back to normal.

It's... weird.

>
>> I have zero means of reliably of reproducing this, unfortunately: it is =
sporadic, intermittent, and happens somewhat infrequently.
>>
>> So I'd love some ideas on how to go about debugging this.
>
> I think the first step is to better understand what=E2=80=99s happening. =
Some
> screenshots are also welcome. Thanks for your effort in advance!
>

Yep. Will do!


> Yuan






Last modified: Mon, 9 Jan 2023 09:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.