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.devel Subject: Re: c-ts-mode style customization Date: Thu, 23 Mar 2023 12:20:34 -0700 Message-ID: <79B5F13D-6718-4B47-9CDA-485A07AF36BC@gmail.com> References: <87355wu4hn.fsf@dancol.org> <45CB19FB-4D80-4C71-8083-D836F51DFB49@gmail.com> <1870bc95688.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <1870cd213f8.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.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="15492"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 23 20:21:35 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 1pfQVD-0003lR-De for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Mar 2023 20:21:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfQUY-0003nl-RG; Thu, 23 Mar 2023 15:20:54 -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 1pfQUX-0003nH-My for emacs-devel@gnu.org; Thu, 23 Mar 2023 15:20:53 -0400 Original-Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pfQUW-0006bL-4y for emacs-devel@gnu.org; Thu, 23 Mar 2023 15:20:53 -0400 Original-Received: by mail-pj1-x1035.google.com with SMTP id j13so22371290pjd.1 for ; Thu, 23 Mar 2023 12:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679599247; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eHeSeF5H6ZaQQHVH49FADKWwReAMiMZdcQp5AYB5J1k=; b=TUV87vt8D7L3MOi0GgUm3FmPwea2RvSpS3WQmjVPBvhXnmBM4+fHQChiI9urf73PTH XOXwILcRgtWJfz9h6zEy7v+sD9upYDF9DTOaQBNxWS2Q3Vz4zBxEa6sxOqq/moX2GdR1 xkgcwlMUum7odxFK019N39YVM2AHaCSU8PJCPu/H01BPE4PNDo38gK1EysmJFv3q/4di AF183jkwdbSQgpdfWSJ4PDa2p1K/rFSXfsKAdKMiUeFQvaD1t+C2x1Gaq9UdMTdJJSRs xTW79AYuqOz7O2QzzERiNRBHFifKN+Mr1Nzx6uVWn3hj7Nsz09ywYux+k2NvB0GU+I9C xBfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679599247; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eHeSeF5H6ZaQQHVH49FADKWwReAMiMZdcQp5AYB5J1k=; b=1xs6NhpXB005+3sigrEY8TOAGc1hmNAFuuZS7R8roqpnWd4Jq6Y87a/auM9eCWAfa/ ivHFDT4jvaQBM48/gEsndBCsudQnoqSpqDxzavQ2YSBoXQnrrsWY4Qm3cvm3Mpsf5/A8 wxfP65cHCEPjcuyv0c9RpqBtHxCSOn6MhNUeyi4Mm9KZ7xEXpsyyB5q+zeSDK7SZlRWt SfrFFCk/nASa8SnJLNLLn0tC2HsRvrBP1oHsKKJYboJY6iugVakmzn9md0zdSg6nZnqs oPPJHvhLS+N40WlP6Ze1xIPJeHfaxDhsjAzTmOldsRvNgJ+VNBYy1595YDsx5/CfndI6 tmhw== X-Gm-Message-State: AO0yUKWKzi9zujs4OZUraf3OYVQ2EyvDlmHIqsPKjQA+NSCFKyBn3rxy 9cdUYDAFzG20eOnPCxB6Ovk= X-Google-Smtp-Source: AK7set+/EJilTiuVlh69Oola9LlDn/w/rmf3QBn70LtNcg2+Gafrbe7KwaBfTXNZZnwsQ8+74yyEow== X-Received: by 2002:a17:90b:4a11:b0:23d:3c7b:8684 with SMTP id kk17-20020a17090b4a1100b0023d3c7b8684mr8731001pjb.41.1679599246516; Thu, 23 Mar 2023 12:20:46 -0700 (PDT) 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 u3-20020a17090a6a8300b00233ebab3770sm1615173pjj.23.2023.03.23.12.20.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Mar 2023 12:20:46 -0700 (PDT) In-Reply-To: <1870cd213f8.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=casouri@gmail.com; helo=mail-pj1-x1035.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:304737 Archived-At: > On Mar 22, 2023, at 9:55 PM, Daniel Colascione = wrote: >=20 >=20 >=20 > On March 22, 2023 20:21:22 Yuan Fu wrote: >=20 >>> On Mar 22, 2023, at 5:05 PM, Daniel Colascione = wrote: >>>=20 >>>=20 >>>=20 >>> On March 22, 2023 19:58:22 Yuan Fu wrote: >>>=20 >>>>> On Mar 22, 2023, at 8:53 AM, Daniel Colascione = wrote: >>>>>=20 >>>>> 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. >>>>>=20 >>>>=20 >>>> 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. >>>>=20 >>>> Yuan >>>=20 >>>=20 >>> 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. >>=20 >> You can set c-ts-mode-indent-style in dir-locals, no? >=20 >=20 > 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. I see, then an alist should solve this. >=20 >> 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. >=20 > Why this emphasis on functions? Why would we want the alist values to = be functions instead of just lists of rules? Nothing except that that=E2=80=99s how it is right now. It certainly = wouldn=E2=80=99t harm to allow functions, no? Anyway, I agree with the general idea. I=E2=80=99ll add the option to = set a rule alist. Yuan=