GNU bug report logs - #72223
31.0.50; c-ts-mode-indent-style custom function should accept a `mode`(c/c++) parameter

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Meow King <mr.meowking@HIDDEN>; dated Sun, 21 Jul 2024 08:41:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 72223 <at> debbugs.gnu.org:


Received: (at 72223) by debbugs.gnu.org; 21 Jul 2024 08:46:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 21 04:46:48 2024
Received: from localhost ([127.0.0.1]:54714 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sVSDQ-0000su-85
	for submit <at> debbugs.gnu.org; Sun, 21 Jul 2024 04:46:48 -0400
Received: from eggs.gnu.org ([209.51.188.92]:40588)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sVSDO-0000sg-5n
 for 72223 <at> debbugs.gnu.org; Sun, 21 Jul 2024 04:46:47 -0400
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 <eliz@HIDDEN>)
 id 1sVSDH-00077M-AS; Sun, 21 Jul 2024 04:46:39 -0400
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=vwscR0+2k7a70cYaXAU1QZVEI2c0sMUHwFZqE/rvUMI=; b=l48t7MdD0Ll5
 0tRVUpmn6JCb3Tyj0Wwt7FjGTtHmKulH4gHqZ0FRdTZBdtXPvAGexcGqwybFNjkj49WVv0RXYv7nR
 iPdLkuk9RUmTzibArT0w0sqneIJOgoL86BS7kMkhZ3z1dX+jV09//IBuMVaP2blcsyGuLERNSU4j3
 x7nxaPDeD8x2UE2Lwn1bQCURo+7WNHsAlwfMo4ltrQAWOpcMkkZh9npOHNDVX7md3nPbW2mQV4ZjL
 5qOojekhpnqwXgDR3xLN7IkM6x4m8IPicwsR9tiq7LpPvlJca69JM33Y/pjtebgBCdHuoUqTSUYqr
 9DtI+CnoXcsaiA6wjQilZQ==;
Date: Sun, 21 Jul 2024 11:46:36 +0300
Message-Id: <86a5ibcetv.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Meow King <mr.meowking@HIDDEN>
In-Reply-To: <87ed7otatf.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#72223: 31.0.50;
 c-ts-mode-indent-style custom function should accept a `mode`(c/c++)
 parameter
References: <87ed7otatf.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72223
Cc: 72223 <at> debbugs.gnu.org
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: -3.3 (---)

> Date: Sat, 20 Jul 2024 22:10:06 +0800
> From:  Meow King via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> 
> Currently, the `c-ts-mode--get-indent-style` function: 
> ```
> (defun c-ts-mode--get-indent-style (mode)
>   "Helper function to set indentation style.
> MODE is either `c' or `cpp'."
>   (let ((style
>          (if (functionp c-ts-mode-indent-style)
>              (funcall c-ts-mode-indent-style)
>            (alist-get c-ts-mode-indent-style (c-ts-mode--indent-styles mode)))))
>     `((,mode ,@style))))
> ```
> We can use `c-ts-mode-indent-style` to customize our indentation.
> However, the function doesn't accept a `mode` parameter, without which
> we cannot determine the current customizing indentation style of what
> language (c/c++).

Isn't the mode available as the value of major-mode?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72223; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Jul 2024 08:40:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 21 04:40:12 2024
Received: from localhost ([127.0.0.1]:54704 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sVS71-0000i6-Hs
	for submit <at> debbugs.gnu.org; Sun, 21 Jul 2024 04:40:12 -0400
Received: from lists.gnu.org ([209.51.188.17]:33350)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mr.meowking@HIDDEN>) id 1sVAn4-0004k5-5m
 for submit <at> debbugs.gnu.org; Sat, 20 Jul 2024 10:10:26 -0400
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 <mr.meowking@HIDDEN>)
 id 1sVAn3-0006QQ-B6
 for bug-gnu-emacs@HIDDEN; Sat, 20 Jul 2024 10:10:25 -0400
Received: from latitanza.investici.org ([2001:888:2000:56::19])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mr.meowking@HIDDEN>)
 id 1sVAn0-0002Jt-Qq
 for bug-gnu-emacs@HIDDEN; Sat, 20 Jul 2024 10:10:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anche.no;
 s=stigmate; t=1721484610;
 bh=Ba7QLV1l61dzg7NsZUwj9MYLzThKD8/R0W+SY+fI+xI=;
 h=From:To:Cc:Subject:Date:From;
 b=na3CnsOhJwAQUV7gDVZTkPG+6UH5AK0nb/GnUGyagMXSXufpevn+fIztO95PgfNhT
 PNmTmacgBx1o+ur0+X7NIlTieH7hwhkbgF+BH6IMWOUJySDihW+pCzcNfOigCcAuYX
 Nlnn2U++XXX3HKc+GQ3PwUt3CDfjn1NMK18akdLI=
Received: from mx3.investici.org (unknown [127.0.0.1])
 by latitanza.investici.org (Postfix) with ESMTP id 4WR7jG6QnhzGp4N
 for <bug-gnu-emacs@HIDDEN>; Sat, 20 Jul 2024 14:10:10 +0000 (UTC)
Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234])
 (Authenticated sender: mr.meowking@HIDDEN) by localhost (Postfix) with
 ESMTPSA id 4WR7jG3FvZzGp4L
 for <bug-gnu-emacs@HIDDEN>; Sat, 20 Jul 2024 14:10:10 +0000 (UTC)
From: Meow King <mr.meowking@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; c-ts-mode-indent-style custom function should accept a
 `mode`(c/c++) parameter 
Message-ID: <87ed7otatf.fsf@HIDDEN>
X-Debbugs-Cc: 
Date: Sat, 20 Jul 2024 22:10:06 +0800
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2001:888:2000:56::19;
 envelope-from=mr.meowking@HIDDEN; helo=latitanza.investici.org
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 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_LOW=-0.7, 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-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 21 Jul 2024 04:40:10 -0400
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 (--)


Currently, the `c-ts-mode--get-indent-style` function: 
```
(defun c-ts-mode--get-indent-style (mode)
  "Helper function to set indentation style.
MODE is either `c' or `cpp'."
  (let ((style
         (if (functionp c-ts-mode-indent-style)
             (funcall c-ts-mode-indent-style)
           (alist-get c-ts-mode-indent-style (c-ts-mode--indent-styles mode)))))
    `((,mode ,@style))))
```
We can use `c-ts-mode-indent-style` to customize our indentation.
However, the function doesn't accept a `mode` parameter, without which
we cannot determine the current customizing indentation style of what
language (c/c++).



---


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.42, cairo version 1.18.0)
Repository revision: 3a790abd869ddadc343710deb0c4368227ba6611
Repository branch: master
System Description: NixOS 24.11 (Vicuna)




Acknowledgement sent to Meow King <mr.meowking@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#72223; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 21 Jul 2024 09:00:02 UTC

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