From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: c-ts-mode style customization Date: Thu, 23 Mar 2023 00:55:07 -0400 Message-ID: <1870cd213f8.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> References: <87355wu4hn.fsf@dancol.org> <45CB19FB-4D80-4C71-8083-D836F51DFB49@gmail.com> <1870bc95688.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="1870cd215923b3e2829841c666" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13459"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: AquaMail/1.43.0 (build: 104300275) Cc: To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 23 05:55:46 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pfCzJ-0003Eb-Ks for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Mar 2023 05:55:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfCyo-0001nw-88; Thu, 23 Mar 2023 00:55:14 -0400 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 1pfCym-0001nd-Hf for emacs-devel@gnu.org; Thu, 23 Mar 2023 00:55:12 -0400 Original-Received: from dancol.org ([2600:3c01:e000:3d8::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfCyk-00063k-Np for emacs-devel@gnu.org; Thu, 23 Mar 2023 00:55:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID: Date:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=usKllc1KtSiEPCOV/8NtYaITBUoj1UBqYYiF8VKJCcA=; b=eprRQTLV3NWfLmeHMNSm6ht+UF S9iJFOTgsCjfJ4MQI18QBsjkficiX94FZJF8pCL39DSoNjJ25Jc/NXEFWPF7ZYXsTEwVWhX9uvurR NL5ee5BC28D1OR+VcF3rqAUyJtRDCc3L/VmhTuTOj1LVtNsjhwXcfAT0d2azd98FsboYirdm/sSlM WODAywLEwMD3JDvdT4K9T4ik9J950iMTTUh7+ER3fz1QAhWJiaUirzqgZPLgeI1GUF5ySs/xY+Fzp OSdpY9jgmgMRuDj+hnX/urfOlGrocUN7J0IPQ6h3/KsDZK3c+eSO+jwK5Ykfr2/kzZoMyhBeXAoQT 7+6g5Hew==; Original-Received: from 097-104-088-154.res.spectrum.com ([97.104.88.154]:40180 helo=[192.168.86.235]) by dancol.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1pfCyi-0001Ak-BB; Wed, 22 Mar 2023 21:55:09 -0700 In-Reply-To: Received-SPF: pass client-ip=2600:3c01:e000:3d8::1; envelope-from=dancol@dancol.org; helo=dancol.org 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, HTML_MESSAGE=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304731 Archived-At: This is a multi-part message in MIME format. --1870cd215923b3e2829841c666 Content-Type: text/plain; format=flowed; charset="us-ascii" Content-Transfer-Encoding: 8bit On March 22, 2023 20:21:22 Yuan Fu wrote: >> On Mar 22, 2023, at 5:05 PM, Daniel Colascione wrote: >> >> >> >> On March 22, 2023 19:58:22 Yuan Fu wrote: >> >>>> On Mar 22, 2023, at 8:53 AM, Daniel Colascione wrote: >>>> >>>> Shouldn't customization of styles in c-ts-mode look more like cc-mode's >>>> style machinery? Right now, the closest thing we have to defining a new >>>> style is add-advice on c-ts-mode--indent-styles, which isn't >>>> particularly convenient or future-proof. You can't drop a new style in, >>>> say, .dir-locals. >>> >>> Actually, you can define a custom function, say, c-ts-mode-my-style, and >>> set c-ts-mode-indent-style to the name of it. >>> >>> Yuan >> >> >> But that doesn't add the new style to the UI selection menu and doesn't let >> you define a style in dir-locals. IMHO, cc-mode got this right. > > You can set c-ts-mode-indent-style in dir-locals, no? No, because I can set that variable only to one of the predefined styles or to a function, and a function isn't a safe value of a directory local variable. > You have a point for UI selection, we can add a > c-ts-mode-indent-style-alist that maps style names to rules/functions that > returns rules, like c-style-alist. Why this emphasis on functions? Why would we want the alist values to be functions instead of just lists of rules? --1870cd215923b3e2829841c666 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable


On March 22, 2023 20:21:22 Yuan Fu <casouri@gmail.com&= gt; wrote:

On Mar 22, 2023, at 5:05 PM, Daniel Colascione <dancol= @dancol.org> wrote:



On March 22, 2023 19:58:22 Yuan Fu <casouri@gmail.com&= gt; wrote:

On Mar 22, 2023, at 8:53 AM, Daniel Colascione <dancol= @dancol.org> wrote:

Shouldn't customization of styles in c-ts-mode look more = like cc-mode's
style machinery? Right now, the closest thing we have to = defining a new
style is add-advice on c-ts-mode--indent-styles, which is= n't
particularly convenient or future-proof. You can't drop a= new style in,
say, .dir-locals.


Actually, you can define a custom function, say, c-ts-mod= e-my-style, and set c-ts-mode-indent-style to the name of it.

Yuan


But that doesn't add the new style to the UI selection me= nu and doesn't let you define a style in dir-locals. IMHO, cc-mode got this= right.

You can set c-ts-mode-indent-style in dir-locals, no?

No, beca= use I can set that variable only to one of the predefined styles or to a fu= nction, and a function isn't a safe value of a directory local variable.

You have a point for UI selection, we can add a c-ts-m= ode-indent-style-alist that maps style names to rules/functions that return= s rules, like c-style-alist.

Why this emphasis on fu= nctions? Why would we want the alist values to be functions instead of just= lists of rules?

--1870cd215923b3e2829841c666--