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: Qeustion about Ftreesit_pattern_expand Date: Tue, 25 Jun 2024 22:13:04 -0700 Message-ID: <061A0C36-1316-4F81-A7A4-AAE1EF78789C@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) 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="9610"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel To: =?utf-8?Q?Gerd_M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 26 07:13:41 2024 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 1sMKyT-0002Nt-C2 for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jun 2024 07:13:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMKy8-0007YP-T0; Wed, 26 Jun 2024 01:13:20 -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 1sMKy7-0007YH-DY for emacs-devel@gnu.org; Wed, 26 Jun 2024 01:13:19 -0400 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMKy5-0005tq-ST for emacs-devel@gnu.org; Wed, 26 Jun 2024 01:13:19 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1f9d9b57b90so42329525ad.0 for ; Tue, 25 Jun 2024 22:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719378796; x=1719983596; darn=gnu.org; 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=iic0PI1RDPxo9T5+F2zsuTGuu49gUb6EQ+KRORSRy1M=; b=mrPHl4UU2YPsQE+kf3fJc6n0dNM41XVU8Atr+dA0kZsto+QgT8vYD9cD4CrMGmgqmK 4ppUR9NaQQ0YHA4xEMasqwuqQkwNWOtDeaMmph0AQLVWa8iLU9dzqqRCodMxQVtIA2BG X1jQvcNw3P2uVSQknnu3m08M8pwWkUvPWAgyz/GIswhTF97fV5qngvozHNYWuAGVgNYV I0UXL27rqfM2o8C9jhXLJsJ0P5R7Lxc4cEpcTryQsqbpdjvNvQTYLxGZlGZi5lhnL0KD nJM/UE/bLPN61gPP/tfRlvyYopi5coOxlyAq8JnCPFKxG3HwVtZ2mQ1MLmAmeqx0Z53H /Ubg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719378796; x=1719983596; 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=iic0PI1RDPxo9T5+F2zsuTGuu49gUb6EQ+KRORSRy1M=; b=l+NxcAjnf+mBcIuhDVmzmjAuwLPrpl86CQgNLOOrTFauYMnSTz1J63yo/JzdaPmhL1 hU7ggHvtOnkTKqUskDSxOuTwqLe1Q8tEIVZAS0b6HN77iAZKEZTfQQWbGimJ/VM1wnIT DJpbiCUI185f1+ud5+o/raax9S7ABHIKtIzfHKwVHUtwOxnZ1ecGjgNkyPj48SRCfxKh zZH13hrCPOWLQXq69dLrOwRjJmFwXrw6WwbA9hV4eLsRqGpHcAm6f7EZvOmZRnnLCea/ J4qLfONkgh4m0fOM8QT39km8ST+uCUTTGQ+nxuauobNG/EFcykbUMxz57M5kOSnQXXhP KhyA== X-Gm-Message-State: AOJu0Yzb1PAts4eaqhIv5jLbw8v2qCkMjPyEhyozS1jYhvsLBl98c9oN hAC9es26tcroz0AFJGKV7bWqjVKwwp4U+KwtoMy88Z+rdY4A9L28c3L4/g== X-Google-Smtp-Source: AGHT+IH5aVC3rz33UfnGe0f0D69g3TNvJvm3foKNPajrl36YbUS+fbG9/eYJyXoQUSrY9Bzm9ukCgQ== X-Received: by 2002:a17:902:c404:b0:1f7:195d:8e7d with SMTP id d9443c01a7336-1fa23f15666mr136891255ad.54.1719378796355; Tue, 25 Jun 2024 22:13:16 -0700 (PDT) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:3c6b:9027:64f0:9805]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3c591bsm90501705ad.165.2024.06.25.22.13.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2024 22:13:15 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3774.600.62) Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=casouri@gmail.com; helo=mail-pl1-x62a.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:320657 Archived-At: > On Jun 25, 2024, at 10:05=E2=80=AFPM, Gerd M=C3=B6llmann = wrote: >=20 > Yuan Fu writes: >=20 >>> On Jun 24, 2024, at 2:26=E2=80=AFPM, Gerd M=C3=B6llmann = wrote: >>>=20 >>> Not important, just as context: I wanted to see if igc works with >>> treesit Lisp objects, built with treesitter, and finally even got >>> grammars for C and C++ installed :-/. Font-locking didn't work in my >>> fork (CL packages), which I fixed. >>>=20 >>> My question: >>>=20 >>> Function Ftreesit_pattern_expand uses this to print Lisp objects: >>>=20 >>> return Fprin1_to_string (pattern, Qnil, Qt); >>>=20 >>> where prin1 prints readably, and second arg nil means add escapes as >>> needed to that the result can be read back, by function read. >>>=20 >>> Why is it printing readably with escapes? >>>=20 >>> I know tree-sitter doesn't understand Lisp escaping because that was = my >>> problem with the font-locking. Or, in other words, should the second = arg >>> be Qt for don't escape? >>>=20 >>=20 >> Thanks for checking this Gerd. IIUC, readably is controlled by the >> second argument, so it=E2=80=99s not redundant: if the second arg is = Qnil, >> print readably (prin1), if it=E2=80=99s Qt, print without quotes and = escapes >> (princ). I guess the function should=E2=80=99ve been called = print-to-string to >> avoid confusion. >=20 > Erm, there's a misunderstanding it seems. I'm not talking about = function > names or anything, I'm basically saying that the function call to > Fprin1_to_string is wrong, and its second argument should be Qt > not Qnil :-) Ah, then I can explain. Basically I want to convert the sexp query ((function_definition) @defun "return" @keyword) to a string that=E2=80=99s like this "((function_definition) @defun "return" @keyword)" If the second arg is Qt, the result would be "((function_definition) @defun return @keyword)" which is not what I want. Basically, strings need to be still quoted. Yuan=