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

Yuan Fu <casouri@gmail.com> writes:

> 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;
>  }

Right, so if you add "tem = Vtreesit_load_name_override_list" above
"FOR_EACH_TAIL (tem)", does it work?

> 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.

But not in comments and documentation.  IME, a very important point in
writing documentation and comments is to avoid the use of pronouns
unless absolutely necessary: "I", "you", "we", et cetera.  Especially
"we", which is also so hard to avoid even I make the mistake of using it
occasionally.

Thanks.



  reply	other threads:[~2022-10-29  5:44 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
2022-10-29  5:44               ` Po Lu [this message]
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=87wn8j2nfs.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --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.