unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill <theo@thornhill.no>
To: Yuan Fu <casouri@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Tree sitter support for C-like languages
Date: Mon, 21 Nov 2022 12:15:23 +0100	[thread overview]
Message-ID: <87cz9g8sok.fsf@thornhill.no> (raw)
In-Reply-To: <0D2879BC-E8B4-40DA-9D6B-990D408D2409@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]


>> On Nov 16, 2022, at 12:58 PM, Yuan Fu <casouri@gmail.com> wrote:
>> 
>>>> 
>>>>  :language mode
>>>>  :override t
>>>>  :feature 'statement
>>>>  '((expression_statement (identifier) @font-lock-variable-name-face)
>>>>    (labeled_statement
>>>>     label: (statement_identifier) @font-lock-type-face))
>>>> 
>>> 
>>> stuff like:
>>> ```
>>> add_edge:  // <- this thing
>>> gx += WINDOW_LEFT_EDGE_X (w);
>>> gy += WINDOW_TOP_EDGE_Y (w);
>>> 
>>> store_rect: // <- and this thing
>>> STORE_NATIVE_RECT (*rect, gx, gy, width, height);
>>> 
>>> ```
>> 
>> What’s the intention of this query?
>> 
>> (expression_statement (identifier) @font-lock-variable-name-face)
>> 
>> It seems to match statements like
>> 
>> var;
>> 
>> ?
>> 
>> Yuan
>
> You probably missed this message, ping :-)
>

Yeah, sorry!  I think it can be removed.  I really don't remember why I
made that...

I added the fix in a patch, and also fixed a typo (I think that messed
up some fontlocking in c-ts-mode) as an apology :-)

Theo




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-some-font-lock-settings.patch --]
[-- Type: text/x-diff, Size: 1909 bytes --]

From 4a81b73bc97b01ea9619e517809997397213f0dc Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
Date: Mon, 21 Nov 2022 12:14:07 +0100
Subject: [PATCH] Fix some font-lock-settings

* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Remove
expression_statement and fix typo for the
c-ts-mode--fontify-declarator font lock helper function.
---
 lisp/progmodes/c-ts-mode.el | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 6ba209c0fb..17f27611a5 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -263,19 +263,19 @@ c-ts-mode--font-lock-settings
       declarator: (_) @font-lock-variable-name-face)
 
      (field_declaration
-      declarator: (_) @c-ts-mode--fontify-struct-declarator)
+      declarator: (_) @c-ts-mode--fontify-declarator)
 
      (function_definition
-      declarator: (_) @c-ts-mode--fontify-struct-declarator))
+      declarator: (_) @c-ts-mode--fontify-declarator))
 
    ;; Should we highlight identifiers in the parameter list?
    ;; (parameter_declaration
-   ;;  declarator: (_) @c-ts-mode--fontify-struct-declarator))
+   ;;  declarator: (_) @c-ts-mode--fontify-declarator))
 
    :language mode
    :feature 'assignment
    ;; TODO: Recursively highlight identifiers in parenthesized
-   ;; expressions, see `c-ts-mode--fontify-struct-declarator' for
+   ;; expressions, see `c-ts-mode--fontify-declarator' for
    ;; inspiration.
    '((assignment_expression
       left: (identifier) @font-lock-variable-name-face)
@@ -299,8 +299,7 @@ c-ts-mode--font-lock-settings
 
    :language mode
    :feature 'label
-   '((expression_statement (identifier) @font-lock-variable-name-face)
-     (labeled_statement
+   '((labeled_statement
       label: (statement_identifier) @font-lock-constant-face))
 
    :language mode
-- 
2.34.1


  reply	other threads:[~2022-11-21 11:15 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 17:45 Tree sitter support for C-like languages Theodor Thornhill via Emacs development discussions.
2022-11-10 18:03 ` Stefan Monnier
2022-11-10 18:18   ` Eli Zaretskii
2022-11-10 18:19   ` Theodor Thornhill
2022-11-10 22:58 ` Yuan Fu
2022-11-11  5:48   ` Theodor Thornhill
2022-11-11  6:01   ` Theodor Thornhill via Emacs development discussions.
2022-11-12  5:43     ` Yuan Fu
2022-11-12  6:13       ` Po Lu
2022-11-12  6:17         ` Yuan Fu
2022-11-12  6:43           ` Po Lu
2022-11-12  6:16       ` Theodor Thornhill
2022-11-12  6:25         ` Yuan Fu
2022-11-12  6:37           ` Theodor Thornhill
2022-11-12  8:08         ` Eli Zaretskii
2022-11-12  8:42           ` Theodor Thornhill
2022-11-12  7:22       ` Theodor Thornhill via Emacs development discussions.
2022-11-12  8:05       ` Eli Zaretskii
2022-11-12  8:43         ` Theodor Thornhill
2022-11-12 12:21     ` Eli Zaretskii
2022-11-12 19:38       ` Theodor Thornhill via Emacs development discussions.
2022-11-12 19:46         ` Stefan Kangas
2022-11-12 20:03           ` Theodor Thornhill
2022-11-12 19:51         ` Eli Zaretskii
2022-11-12 20:05           ` Theodor Thornhill via Emacs development discussions.
2022-11-12 20:08             ` Yuan Fu
2022-11-12 20:14               ` Theodor Thornhill
2022-11-13  9:13                 ` Eli Zaretskii
2022-11-13  9:40                   ` Theodor Thornhill
2022-11-13  9:56                     ` Eli Zaretskii
2022-11-13 10:13                       ` Theodor Thornhill
2022-11-13 12:55                         ` Eli Zaretskii
2022-11-13 13:02                           ` Theodor Thornhill
2022-11-13 13:08                             ` Eli Zaretskii
2022-11-13 13:37                               ` Theodor Thornhill
2022-11-14  1:23                             ` Dmitry Gutov
2022-11-14  0:22                       ` Yuan Fu
2022-11-14  1:26                         ` Dmitry Gutov
2022-11-14  8:35                           ` Yuan Fu
2022-11-14 13:24                             ` Eli Zaretskii
2022-11-14 18:31                               ` Yuan Fu
2022-11-14 19:54                             ` Dmitry Gutov
2022-11-15 10:56                               ` Yuan Fu
2022-11-15 12:30                                 ` Dmitry Gutov
2022-11-14  3:48                         ` Stefan Monnier
2022-11-14  8:23                           ` Yuan Fu
2022-11-14 12:46                             ` Stefan Monnier
2022-11-14 13:20                             ` Eli Zaretskii
2022-11-14 18:29                               ` Yuan Fu
2022-11-14 18:45                                 ` Eli Zaretskii
2022-11-14 19:51                                   ` Yuan Fu
2022-11-14 20:10                                     ` Eli Zaretskii
2022-11-14 21:57                                       ` Yuan Fu
2022-11-15  3:27                                         ` Eli Zaretskii
2022-11-15 10:51                                           ` Yuan Fu
2022-11-15 11:37                                             ` Theodor Thornhill
2022-11-15 15:03                                             ` Eli Zaretskii
2022-11-15 16:01                                               ` Stefan Monnier
2022-11-15 16:59                                                 ` Eli Zaretskii
2022-11-15 18:18                                                   ` Yuan Fu
2022-11-15 18:38                                                     ` Eli Zaretskii
2022-11-16  7:58                                                       ` Yuan Fu
2022-11-16 13:16                                                         ` Eli Zaretskii
2022-11-16 13:29                                                           ` Po Lu
2022-11-16 17:29                                                             ` Yuan Fu
2022-11-15 18:27                                                   ` Visuwesh
2022-11-15 18:36                                                     ` Yuan Fu
2022-11-14 12:55                         ` Eli Zaretskii
2022-11-11  0:43 ` Randy Taylor
2022-11-11  5:50   ` Theodor Thornhill
2022-11-11 13:37     ` Stefan Monnier
2022-11-11 15:09       ` Theodor Thornhill
2022-11-11 15:54     ` Randy Taylor
2022-11-13  8:37       ` Theodor Thornhill
2022-11-13 13:03         ` Randy Taylor
2022-11-16 17:51 ` Yuan Fu
2022-11-16 20:02   ` Theodor Thornhill
2022-11-16 20:10     ` Yuan Fu
2022-11-16 20:25       ` Theodor Thornhill
2022-11-16 20:58     ` Yuan Fu
2022-11-21  9:28       ` Yuan Fu
2022-11-21 11:15         ` Theodor Thornhill [this message]
2022-11-23  1:55           ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz9g8sok.fsf@thornhill.no \
    --to=theo@thornhill.no \
    --cc=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).