From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59498: 29.0.50; c++-ts-mode get wrong-type-argument error when enabled Date: Sun, 27 Nov 2022 08:24:21 +0200 Message-ID: <83ilj0rk2y.fsf@gnu.org> References: <6_5zC6qq_eQV2whwZ7epZMUlEN-yk5iOlJBLuVnNDLzl4RUGCPFnbIN12pG-DyNvCAYlRJTTopEe_RxX2_B7nSJQyBCJrzo915uBA51qW8A=@rjt.dev> <838rjyt15i.fsf@gnu.org> <5ADA88E0-A105-47B5-B590-2591253781C1@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25251"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dev@rjt.dev, aqua0210@foxmail.com, 59498@debbugs.gnu.org, mardani29@yahoo.es To: Yuan Fu , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 27 07:25:14 2022 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 1ozB6I-0006NQ-Bv for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Nov 2022 07:25:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozB68-0004jZ-At; Sun, 27 Nov 2022 01:25:04 -0500 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 1ozB67-0004jQ-2q for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 01:25:03 -0500 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 1ozB66-0007kg-Oe for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 01:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ozB66-0004K8-Jk for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 01:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Nov 2022 06:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59498 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59498-submit@debbugs.gnu.org id=B59498.166953024516604 (code B ref 59498); Sun, 27 Nov 2022 06:25:02 +0000 Original-Received: (at 59498) by debbugs.gnu.org; 27 Nov 2022 06:24:05 +0000 Original-Received: from localhost ([127.0.0.1]:41921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozB5A-0004Jk-TV for submit@debbugs.gnu.org; Sun, 27 Nov 2022 01:24:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozB59-0004JE-ED for 59498@debbugs.gnu.org; Sun, 27 Nov 2022 01:24:04 -0500 Original-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 1ozB51-0007aF-9M; Sun, 27 Nov 2022 01:23:55 -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=MsTY88kfTNGoPmddeX1D6agEmJ6xCKtB1o69Tv8pS30=; b=iiSj5GJCFLLL 4i1osgk10zG/NK4pM2W5/9Sbf7gK5YW3jWp3sJUCjXo5AZDxUvdt0YeCI5Mhzzw4nOEn0R1jkgKyC Bs8ACLM3RgvT+ZNCO4WDbvaOvb+IaN4glNwvcEbSLdbIYkbf+UnjoiFVzVmA0ez5v5ziP/AsCCCUj vD08VULwBnLH6QtikQVK9Tu79I5lX7PLqA/SU57TcZqqu5s0TogTaMIDlA7N7a8OOX8mdBoEjYpoK mCqRzwUQqgbf23qUW+nALLHulAzEbhyIPNPXgleL/v9lxSt0VG5/CS7LNhAKZOt8gMJlqFDehhh+T fCcVitNHM8zA6nMj2zmLPg==; Original-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 1ozB50-00072O-MZ; Sun, 27 Nov 2022 01:23:55 -0500 In-Reply-To: <5ADA88E0-A105-47B5-B590-2591253781C1@gmail.com> (message from Yuan Fu on Sat, 26 Nov 2022 14:11:48 -0800) 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:249171 Archived-At: > From: Yuan Fu > Date: Sat, 26 Nov 2022 14:11:48 -0800 > Cc: Randy Taylor , > aqua0210@foxmail.com, > 59498@debbugs.gnu.org, > mardani29@yahoo.es > > >> + (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*")))) > >> + (setq-local treesit-comment-end (rx (+ (or "*")) "/")) > >> > >> (treesit-parser-create 'cpp) > > > > Thanks, but this doesn't look right to me: why should c++-ts-mode set > > variables for treesit.el? It is more likely that treesit.el should use the > > buffer-local values of comment-start and comment-end instead, and fall back > > on generic values (if they make sense) only if the local values are not set. > > > > Yuan, WDYT? > > I added treesit-comment-start/end to help indenting comments. So this is the correct way to use them. The following comment explains why I created new variables: > > ;; `comment-start' and `comment-end' assume there is only one type of > ;; comment, and that the comment spans only one line. So they are not > ;; sufficient for our purpose. ??? This is surprisingly unclean, IMO. For starters, the names of the variables are confusing. The need to define two sets of comment-start and comment-end regexps is also a nuisance and a source of errors. How do non-treesit modes handle this issue? Why do the treesit-based modes need something special here? Stefan, any ideas?