bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33195: 27.0.50; user-login-name has no group-login-name


From: Eli Zaretskii
Subject: bug#33195: 27.0.50; user-login-name has no group-login-name
Date: Tue, 30 Oct 2018 12:34:49 +0200

> From: Jules Tamagnan <address@hidden>
> Date: Mon, 29 Oct 2018 11:52:17 -0700
> 
> I've found it difficult to go from an integer group id to the name of
> that group. I've looked at the source for `user-login-name` and
> `system-groups` and could not find a way to do what I needed.
> 
> As such I think it would be great to add a function to do that.

Thanks.  Please allow me a few comments:

Please always provide a ChangeLog-style commit log message describing
your changes.  The file CONTRIBUTE has more about that.

> I'm unsure how to make an argument not be optional.

You want the argument NOT to be optional?  If so, make this:

> +DEFUN ("group-name", Fgroup_name, Sgroup_name, 0, 1, 0,

say this instead:

> +DEFUN ("group-name", Fgroup_name, Sgroup_name, 1, 1, 0,

See the node "Writing Emacs Primitives" in the ELisp manual, which
describes how to use the DEFUN macro.

> +DEFUN ("group-name", Fgroup_name, Sgroup_name, 0, 1, 0,
> +       doc: /* If argument GID is an integer or a float, return the login 
> name
> +of the group with that GID, or nil if there is no such GID.  */)
> +  (Lisp_Object gid)
> +{
> +  struct group *gr;
> +  gid_t id;
> +
> +  if (NILP (gid))
> +    return Qnil;

Wouldn't it be more useful to return user's group name when the
argument is nil or omitted?

Also, would you please write a couple of simple tests for this new
function?

Finally, this function should be announced in NEWS and documented in
the ELisp manual.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]