From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mohammed Sadiq Newsgroups: gmane.emacs.bugs Subject: bug#60484: 29.0.60; c-ts-mode: short tokens are not identified as type_identifier Date: Mon, 02 Jan 2023 18:50:03 +0530 Message-ID: <2eab99216a1a17389944bda8e6d74eef@sadiqpk.org> References: <677a429cb107ff200396e0c59eefecda@sadiqpk.org> <83358t2kv1.fsf@gnu.org> <1d2f9bd1c64ed11124a0129b0ae8b672@sadiqpk.org> <83tu1914vt.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32904"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60484@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 02 14:21:33 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 1pCKku-0008Mf-OC for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Jan 2023 14:21:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCKkW-0002l7-5B; Mon, 02 Jan 2023 08:21:08 -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 1pCKkQ-0002jL-Tn for bug-gnu-emacs@gnu.org; Mon, 02 Jan 2023 08:21: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 1pCKkQ-0002jb-01 for bug-gnu-emacs@gnu.org; Mon, 02 Jan 2023 08:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pCKkP-000312-SK for bug-gnu-emacs@gnu.org; Mon, 02 Jan 2023 08:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mohammed Sadiq Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Jan 2023 13:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60484 X-GNU-PR-Package: emacs Original-Received: via spool by 60484-submit@debbugs.gnu.org id=B60484.167266561311480 (code B ref 60484); Mon, 02 Jan 2023 13:21:01 +0000 Original-Received: (at 60484) by debbugs.gnu.org; 2 Jan 2023 13:20:13 +0000 Original-Received: from localhost ([127.0.0.1]:42739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCKjc-0002z6-NO for submit@debbugs.gnu.org; Mon, 02 Jan 2023 08:20:13 -0500 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:54675) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCKja-0002yn-Ox for 60484@debbugs.gnu.org; Mon, 02 Jan 2023 08:20:11 -0500 Original-Received: (Authenticated sender: sadiq@sadiqpk.org) by mail.gandi.net (Postfix) with ESMTPA id 4D1A0FF806; Mon, 2 Jan 2023 13:20:03 +0000 (UTC) In-Reply-To: <83tu1914vt.fsf@gnu.org> X-Sender: sadiq@sadiqpk.org 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:252337 Archived-At: On 2023-01-02 18:15, Eli Zaretskii wrote: >> Date: Mon, 02 Jan 2023 18:13:34 +0530 >> From: Mohammed Sadiq >> Cc: 60484@debbugs.gnu.org >> >> On 2023-01-02 17:45, Eli Zaretskii wrote: >> >> Date: Mon, 02 Jan 2023 10:22:09 +0530 >> >> From: Mohammed Sadiq >> >> >> >> Short tokens are not identified as type_identifier in GNU Emacs >> >> c-ts-mode, but does work fine with tree-sitter playground[0]. >> >> >> >> Say for example, 'a_type' in an empty buffer is identified as a >> >> type_identifier in tree-sitter playground, but not in c-ts-mode, >> >> while say, some longer tokens like 'window_type' is identified as >> >> type_identifier. >> > >> > Where is it written that FOO_type is a type identifier? is this >> > something new in some recent C Standard? Or is it just a popular >> > convention? >> >> 'a_type' was just a made up example, it can be any valid token, say >> 'g_file', or whatever. I was pointing out a disparity in handling of >> some token in c-ts-mode and tree-sitter: tree-sitter identifiers a 6 >> byte length token as an identifier, but c-ts-mode requires it to be >> at least 11 byte sized for custom types. > > I'm not sure I see a problem here. It sounds like different > heuristics to me. Nothing says that g_file is a type, only its > parsing can tell. well, c-ts-mode uses tree-sitter-c under the hood, so it's not supposed to behave differently. Anyway, my use case is that I use ';' after a token to convert the preceding token (if type) to a camel case and insert a *. So: typing g_file; shall be converted to GFile * (but it works only if g_file is identified as a type identifier, which is not the case now). I already does '_' on SPC and S-SPC shall insert a real space. Sorry for that my use case could be a really weird one. ;) cheers, Mohammed Sadiq