unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Qeustion about Ftreesit_pattern_expand
Date: Tue, 25 Jun 2024 21:54:58 -0700	[thread overview]
Message-ID: <D2F27672-2A41-4A40-B925-529B10A6FB09@gmail.com> (raw)
In-Reply-To: <m234p2owvk.fsf@pro2.fritz.box>



> On Jun 24, 2024, at 2:26 PM, Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
> 
> 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.
> 
> My question:
> 
> Function Ftreesit_pattern_expand uses this to print Lisp objects:
> 
>  return Fprin1_to_string (pattern, Qnil, Qt);
> 
> where prin1 prints readably, and second arg nil means add escapes as
> needed to that the result can be read back, by function read.
> 
> Why is it printing readably with escapes?
> 
> 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?
> 

Thanks for checking this Gerd. IIUC, readably is controlled by the second argument, so it’s not redundant: if the second arg is Qnil, print readably (prin1), if it’s Qt, print without quotes and escapes (princ). I guess the function should’ve been called print-to-string to avoid confusion.

Yuan





  reply	other threads:[~2024-06-26  4:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 21:26 Qeustion about Ftreesit_pattern_expand Gerd Möllmann
2024-06-26  4:54 ` Yuan Fu [this message]
2024-06-26  5:05   ` Gerd Möllmann
2024-06-26  5:13     ` Yuan Fu
2024-06-26  5:34       ` Gerd Möllmann
2024-06-26  6:04         ` Yuan Fu
2024-06-26  6:16           ` Gerd Möllmann

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=D2F27672-2A41-4A40-B925-529B10A6FB09@gmail.com \
    --to=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    /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).