From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Danny Freeman Newsgroups: gmane.emacs.devel Subject: Re: Treesitter query question, matching only substring of a node Date: Mon, 05 Dec 2022 10:25:46 -0500 Message-ID: <87o7sheure.fsf@dfreeman.email> References: <87sfhvdn6k.fsf@dfreeman.email> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12049"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 05 16:28:00 2022 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 1p2DNv-0002u7-Pp for ged-emacs-devel@m.gmane-mx.org; Mon, 05 Dec 2022 16:28:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2DNR-0006E8-6p; Mon, 05 Dec 2022 10:27:29 -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 1p2DN7-0006DY-6l for emacs-devel@gnu.org; Mon, 05 Dec 2022 10:27:09 -0500 Original-Received: from out2.migadu.com ([2001:41d0:2:aacc::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2DN5-0001Wp-3m for emacs-devel@gnu.org; Mon, 05 Dec 2022 10:27:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1670254024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=39hysKPJ64PrQ+u1R/uhTPReHE9Hrmg4UHzUISLhKl0=; b=gSV0/GsDUUy0z+TVYs21hU6Ju+b29obWs3Nex6Y8ypI6PhHQ/EZiFzacsSITq4ccAvK+Ed 0YPZM19lAF6i+MnWrJzAJFr89jFbSgRz8Pr5Vsjk8mt0a/y+zjCYoyfLBtYnRdQPzVJpLp Tmw1D6qlE9mpTwffalYXFSBdi8GskI4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=danny@dfreeman.email; helo=out2.migadu.com 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-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:300933 Archived-At: Yuan Fu writes: > I suggest capturing the whole node and using a function to fontify the symbol. With a function you > can do anything you want, including applying different faces to substrings. To do that, simply > define a function and use the function name as the capture name. > > You can have a look at c-ts-mode--fontify-variable for a simple example. This is exactly what I was looking for. I can't believe I didn't think of this when I was reading the documentation. Thank you for your help! -- Danny Freeman