From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#59763: 29.0.60; Filling for c-ts-mode Date: Sat, 7 Jan 2023 15:11:07 -0800 Message-ID: <5BD2B9A3-8D59-4942-9A97-213AF41DCE8F@gmail.com> References: <69D98973-6824-47B3-900F-6DBEE669932F@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9334"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59763-done@debbugs.gnu.org To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 08 00:12:21 2023 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 1pEIMP-0002E3-7O for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Jan 2023 00:12:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEIM8-0004wt-Dx; Sat, 07 Jan 2023 18:12: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 1pEIM6-0004wX-K0 for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2023 18:12: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 1pEIM6-0001LT-B3 for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2023 18:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pEIM6-0007OS-5x for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2023 18:12:02 -0500 In-Reply-To: <69D98973-6824-47B3-900F-6DBEE669932F@gmail.com> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Jan 2023 23:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 59763 X-GNU-PR-Package: emacs Mail-Followup-To: 59763@debbugs.gnu.org, casouri@gmail.com, casouri@gmail.com Original-Received: via spool by 59763-done@debbugs.gnu.org id=D59763.167313307628357 (code D ref 59763); Sat, 07 Jan 2023 23:12:01 +0000 Original-Received: (at 59763-done) by debbugs.gnu.org; 7 Jan 2023 23:11:16 +0000 Original-Received: from localhost ([127.0.0.1]:59208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEILL-0007NI-Ri for submit@debbugs.gnu.org; Sat, 07 Jan 2023 18:11:16 -0500 Original-Received: from mail-pj1-f52.google.com ([209.85.216.52]:40536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEILJ-0007N3-QL for 59763-done@debbugs.gnu.org; Sat, 07 Jan 2023 18:11:14 -0500 Original-Received: by mail-pj1-f52.google.com with SMTP id c8-20020a17090a4d0800b00225c3614161so8967911pjg.5 for <59763-done@debbugs.gnu.org>; Sat, 07 Jan 2023 15:11:13 -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=NarGmpTQ+32DaItfSuVtmvest5DT40T9j4xf7MaTPsk=; b=V0RsAQ6Ff0ZcLAO0Li/UtstAMQOq6zQ/d7zWNNm4r2BUaUnA5Y/6EUtzie8XhKT3Us JR25BZhBbbC/rjnvknuUYxGAB20LpFj1omsQQ050GC7l+XiHYEWXgSgdDGxVOXkGnVJh URBqUmVSQU6FzOEmkBt0i7xSrJqbqdp8KElnStrXryYoX6ifQUzWPRkZbsCUwtMyrcMR hnT0uG7YGMnHgFd3dyLCjImOGum1lWUfa5GSBImOntTy4t13x//ry5UKJxtZEKArxxvR yv3Re6L90UTcYzP/VLqpUvGE8Ad7alW8vV58fc3l/4CL/NI/UL2y2OOc0KFuPE/bc/UU QhAg== 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=NarGmpTQ+32DaItfSuVtmvest5DT40T9j4xf7MaTPsk=; b=YKPEY66HTK8ejNJPmjI6dozG2OKrcU9505L6VqRj4f1dqgSuVmQAz+XziOcIqQXfa4 z2cxV9ikYith3Y2UOhg5v8jfrPeD+2ucCdL1SvPLTe08GOSG6fTAxH60GaIHABDTayeC uJo6Bk3Xd3m7pQquU1B6uOsnIyA4QE3XwveaQKSj9OyehaTTW2qYfr+fTvPgxzm8/Vwm GAmHhC6pe3w5eau+QOtBcP7TohBLSulLorvtcSRWrtUxWOo8TRN0YiIFDBjqpzogZMb4 jx0g36Ls1OJvAPP1P115t16jHAUIAwvjv4XKEas893422n/JelCPz8e2v+ozIBRLNC1t ed4A== X-Gm-Message-State: AFqh2kpvv2xXmqGSs8POS6QaGA1cr6oOlZHqlsEfNFvi8R3WyJldAGZ0 kLR5qGo3KlYu734YfW6BbW19wx8UhGI= X-Google-Smtp-Source: AMrXdXuGIBmoy0/yi/vY2tmsyxxsno0zYwP0VzLm+bht6OtmK/WOnJWYGqDko7Fng0PVCpd8yup2Jg== X-Received: by 2002:a05:6a20:4290:b0:ad:4642:c671 with SMTP id o16-20020a056a20429000b000ad4642c671mr92297045pzj.12.1673133068187; Sat, 07 Jan 2023 15:11:08 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id 187-20020a6214c4000000b005828071bf7asm2006031pfu.22.2023.01.07.15.11.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jan 2023 15:11:07 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:252838 Archived-At: Theodor Thornhill writes: > Yuan Fu writes: > >>> On Dec 26, 2022, at 2:03 PM, Theodor Thornhill = wrote: >>>=20 >>> Yuan Fu writes: >>>=20 >>>> Theodor Thornhill writes: >>>>=20 >>>>> On 25 December 2022 02:30:35 CET, Yuan Fu = wrote: >>>>>>=20 >>>>>> Theodor Thornhill writes: >>>>>>=20 >>>>>>> On 24 December 2022 09:36:21 CET, Yuan Fu = wrote: >>>>>>>>=20 >>>>>>>> Theodor Thornhill writes: >>>>>>>>=20 >>>>>>>>> Yuan Fu writes: >>>>>>>>>=20 >>>>>>>>>>> On Dec 2, 2022, at 6:58 AM, Eli Zaretskii = wrote: >>>>>>>>>>>=20 >>>>>>>>>>>> From: Yuan Fu >>>>>>>>>>>> Date: Thu, 1 Dec 2022 21:33:06 -0800 >>>>>>>>>>>>=20 >>>>>>>>>>>>=20 >>>>>>>>>>>> IMO For c-ts-mode to be usable we need to have at least a = basic filling >>>>>>>>>>>> function. Below is the function I have in my init.el, could = someone have >>>>>>>>>>>> a look and see if it=E2=80=99s good? Alternatively we could = copy out the comment >>>>>>>>>>>> and fill it in a temp buffer with c-mode, but I didn=E2=80=99= t have the time to try >>>>>>>>>>>> it out and see how well it works. >>>>>>>>>>>=20 >>>>>>>>>>> Thanks. >>>>>>>>>>>=20 >>>>>>>>>>> =46rom quick testing, I see a problem: >>>>>>>>>>>=20 >>>>>>>>>>> . Visit dispnew.c and go to the comment that starts on line = 324. Delete >>>>>>>>>>> the newline between the two lines of the comment, and = invoke the >>>>>>>>>>> function. Observe how the first non-blank character of = the comment's >>>>>>>>>>> second line is aligned with the "/*" on the previous line, = not with the >>>>>>>>>>> text after "/*" as I'd expect. >>>>>>>>>>=20 >>>>>>>>>> I see. I=E2=80=99ll need to look at how cc-mode fill = comments. >>>>>>>>>>=20 >>>>>>>>>>>=20 >>>>>>>>>>> Btw, this command should be bound to M-q in ts-c-mode. >>>>>>>>>>=20 >>>>>>>>>> Will do, once our fill function works well. BTW, Theo, if you = have any >>>>>>>>>> idea, don=E2=80=99t hesitate to go ahead :-) No obligations, = of course. >>>>>>>>>>=20 >>>>>>>>>> Yuan >>>>>>>>>=20 >>>>>>>>> Sure! Added to my list :) I had a function at some point = that used >>>>>>>>> c-mode to do this. I'll see if I can polish it a little. >>>>>>>>=20 >>>>>>>> I did some work in filling, it should work like cc-mode in like = 90% of >>>>>>>> the cases now, yay! >>>>>>>>=20 >>>>>>>> Yuan >>>>>>>=20 >>>>>>> Nice! For all cc-ts-modes? >>>>>>=20 >>>>>> I only added for c and c++, but support for other modes should be >>>>>> identical. And I think we should have something equivalent to = cc-mode=E2=80=99s >>>>>> init which sets up things that are the same in all C-like = languages, >>>>>> basically comments and filling. >>>>=20 >>>> I added indent and filling for other C-like modes. >>>>=20 >>>>>> But I wonder where should we put it, I guess it=E2=80=99s fine to = leave it in >>>>>> c-ts-mode, since there really isn=E2=80=99t much code. Having = other modes to >>>>>> require c-ts-mode shouldn=E2=80=99t be a big problem, I think? >>>>>>=20 >>>>>> Yuan >>>>>=20 >>>>> How about just having treesit-utils.el, or something like that? = There >>>>> are probably many things in the future that will be common among >>>>> modes, yet won't really warrant inheritance. I think we have such = an >>>>> example in js/typescript too, iirc. >>>>=20 >>>> If it=E2=80=99s shared across all tree-sitter modes, it should be = in treesit.el, >>>> of course. We are talking about things shared by tree-sitter C-like >>>> modes, so the scope is smaller. >>>>=20 >>>> Since right now it=E2=80=99s only a handful functions, I made other = modes >>>> require c-ts-mode.el. In the future if things accumulate, we can = put >>>> things into a separate file (c-ts-mode-common.el or something). >>>>=20 >>>=20 >>> Sure. I just don't like it when these namespaces blend too much. = But >>> your call :-) >> >> It can be treesit-c-common.el or something. We=E2=80=99ll figure it = out when the time comes ;-) >> > > Yep :) > Theo I=E2=80=99ve added this to other modes, closing this report. Yuan