From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: Qeustion about Ftreesit_pattern_expand Date: Wed, 26 Jun 2024 07:05:45 +0200 Message-ID: References: Mime-Version: 1.0 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="11698"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Emacs Devel To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 26 07:06:27 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 1sMKrS-0002uu-Rd for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jun 2024 07:06:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMKqu-0004ab-IJ; Wed, 26 Jun 2024 01:05:52 -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 1sMKqt-0004aH-3n for emacs-devel@gnu.org; Wed, 26 Jun 2024 01:05:51 -0400 Original-Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMKqr-0003kB-Ii for emacs-devel@gnu.org; Wed, 26 Jun 2024 01:05:50 -0400 Original-Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-52cdcd26d61so4423124e87.2 for ; Tue, 25 Jun 2024 22:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719378347; x=1719983147; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nlrgBdtrenX0b4OLuFjkQ2VwGuti537rI5dtMlLOf5k=; b=jr8HcDKTWw3nJ/xCTaWVDPOx52N/sogLF6PDjMaVHLa8m6uPg1ERk53hRc7qG0yPbE mEL68cJrIRLAlMejpBcv8qRwgU28b0C6rFvmkJtsaPxWoKU5/lkzaAVhJaAe+vj3WPIH W11Gl3e6E06LkiPCI1pLNTZtEmMRJNIYzOoH4wpn1xQy56+mC17wlGhzTVRPeuRgmp3Y mNtQe3LBgaPwx9GR9EthSVDvk4TEgTAj3CF9Wlqjx8KkcxDpiwMkIofprl/qqWUbArK9 xQ2PDAJXNGneLe5yX9rKcz6MR0e1N4+9OeB+Rsn4+DDqXZDuU+Of6NGwKPxyGVeNmxVa qf0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719378347; x=1719983147; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=nlrgBdtrenX0b4OLuFjkQ2VwGuti537rI5dtMlLOf5k=; b=QkF5s7vvTi8lu0I58XFum8sO7tAnE6Opoi47ZUhwSb20lPgmPWSr8J9h4Tp//zCR3s DShq9XwU7tzyUhNnaXeRhOiklTYj8u827AW2w7WQ8a3GWPKim1C3wFtWjtUH1jrVZYdJ xmiAleZWn/JwkArs8yykcEngwxGooRf7/ZCEERWX1dddpK2XpQnTsBbHNhQvBHR6k6YB r7qhHgiOR0vjq69D7FW39exkRfONHEnc51YfIw5eJPVF+xc2tOEL6FkfchpoA5amj574 0e7kPpj27ZWb+hJ7zfM5k8dNm/n1FztRhOuxtEdS67j/IROvZ70u7Tewqb/8oxs0gEFa rImQ== X-Gm-Message-State: AOJu0YxCTCw1OD3chLoxI0NFUAufabO2hTgnmBgixB12k57lGvi7sZj4 KBi1OSXkkHYDogwkOxB+BHYhVZjA8eY0o3sd2j70jA5T7J6ZNu4+pnXtIQ== X-Google-Smtp-Source: AGHT+IGvIUdEXW4OvpJYlfsviAJ1yeVXo3fAyNr93XKkMY/7cX2npbX4Vde3RJTYxy0s7cp+uT2JEw== X-Received: by 2002:a19:6454:0:b0:52c:dae5:6511 with SMTP id 2adb3069b0e04-52ce18345a6mr5465942e87.23.1719378347159; Tue, 25 Jun 2024 22:05:47 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e360b7.dip0.t-ipconnect.de. [217.227.96.183]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-366389b869esm14588807f8f.37.2024.06.25.22.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 22:05:46 -0700 (PDT) In-Reply-To: (Yuan Fu's message of "Tue, 25 Jun 2024 21:54:58 -0700") Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=gerd.moellmann@gmail.com; helo=mail-lf1-x136.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:320655 Archived-At: Yuan Fu writes: >> 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 > > 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 esca= pes > (princ). I guess the function should=E2=80=99ve been called print-to-stri= ng to > avoid confusion. 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 :-)