all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Po Lu <luangruo@yahoo.com>
Cc: Robert Pluim <rpluim@gmail.com>, emacs-devel@gnu.org
Subject: Re: Stylistic changes to tree-sitter code
Date: Fri, 28 Oct 2022 21:19:19 -0700	[thread overview]
Message-ID: <0E4C5439-B28D-420A-9E4A-BA059269AD57@gmail.com> (raw)
In-Reply-To: <875yg34aas.fsf@yahoo.com>

Ah, yes, the patch compiles fine, though there is a segfault: I believe you forgot to initialized the tem variable.

@@ -449,21 +453,28 @@ treesit_symbol_to_c_name (char *symbol_name)
 treesit_find_override_name (Lisp_Object language_symbol, Lisp_Object *name,
 			    Lisp_Object *c_symbol)
 {
+  Lisp_Object tem;
+
   CHECK_LIST (Vtreesit_load_name_override_list);
-  for (Lisp_Object list = Vtreesit_load_name_override_list;
-       !NILP (list); list = XCDR (list))
+
+  FOR_EACH_TAIL (tem)
     {
-      Lisp_Object lang = XCAR (XCAR (list));
+      Lisp_Object lang = XCAR (XCAR (tem));
       CHECK_SYMBOL (lang);
+
       if (EQ (lang, language_symbol))
 	{
-	  *name = Fnth (make_fixnum (1), XCAR (list));
+	  *name = Fnth (make_fixnum (1), XCAR (tem));
 	  CHECK_STRING (*name);
-	  *c_symbol = Fnth (make_fixnum (2), XCAR (list));
+	  *c_symbol = Fnth (make_fixnum (2), XCAR (tem));
 	  CHECK_STRING (*c_symbol);
+
 	  return true;
 	}
     }
+
+  CHECK_LIST_END (tem, Vtreesit_load_name_override_list);
+
   return false;
 }
 
Also, out of curiosity, I thought active voice is good and passive voice is bad? Though the subject here doesn’t add any useful information, I recon.

-   - It doesn't expose a syntax tree.  We put the syntax tree in the
-     parser object, and updating the tree is handled on the C level.
+   - It doesn't expose a syntax tree.  The syntax tree is placed in
+     the parser object, and updating the tree is handled at the C
+     level.
 
-   - We don't expose tree cursor either.  I think Lisp is slow enough
-     to nullify any performance advantage of using a cursor, though I
-     don't have evidence.  Also I want to minimize the number of new
-     types we introduce.  Currently we only add parser and node type.
+   - The tree cursor is not exposed either.  I think Lisp is slow
+     enough to nullify any performance advantage of using a cursor,
+     though I don't have evidence.  Also I want to minimize the number
+     of new types we introduce.  Currently we only add parser and node
+     type.


Yuan


  reply	other threads:[~2022-10-29  4:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87h6zp75nt.fsf.ref@yahoo.com>
2022-10-27 13:33 ` Stylistic changes to tree-sitter code Po Lu via Emacs development discussions.
2022-10-27 13:56   ` Robert Pluim
2022-10-28  0:41     ` Po Lu via Emacs development discussions.
2022-10-28  4:14       ` Yuan Fu
2022-10-28  7:03       ` Robert Pluim
2022-10-28  7:08         ` Po Lu
2022-10-29  2:45           ` Po Lu via Emacs development discussions.
2022-10-29  4:19             ` Yuan Fu [this message]
2022-10-29  5:44               ` Po Lu
2022-10-29  7:01                 ` Eli Zaretskii
2022-10-29  7:25                   ` Po Lu
2022-10-29  8:16                     ` Eli Zaretskii
2022-10-29  8:34                       ` Po Lu
2022-10-29  6:54               ` Eli Zaretskii
2022-10-29  7:29               ` Stefan Kangas

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

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

  git send-email \
    --in-reply-to=0E4C5439-B28D-420A-9E4A-BA059269AD57@gmail.com \
    --to=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=rpluim@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.