unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jules Tamagnan <jtamagnan@gmail.com>
Cc: 33195@debbugs.gnu.org
Subject: bug#33195: 27.0.50; user-login-name has no group-login-name
Date: Tue, 30 Oct 2018 12:34:49 +0200	[thread overview]
Message-ID: <837ehzlo3a.fsf@gnu.org> (raw)
In-Reply-To: <87d0rsegbi.fsf@gmail.com> (message from Jules Tamagnan on Mon, 29 Oct 2018 11:52:17 -0700)

> From: Jules Tamagnan <jtamagnan@gmail.com>
> 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	other threads:[~2018-10-30 10:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 18:52 bug#33195: 27.0.50; user-login-name has no group-login-name Jules Tamagnan
2018-10-30 10:34 ` Eli Zaretskii [this message]
2018-10-30 18:25   ` Jules Tamagnan
2018-11-10 18:36     ` Glenn Morris
2018-11-10 18:49       ` Glenn Morris
2018-11-10 19:00         ` Jules Tamagnan
2018-11-10 19:12           ` Glenn Morris
2018-11-10 19:15       ` Eli Zaretskii
2018-11-10 21:02       ` Andreas Schwab
2018-11-11  3:17         ` Glenn Morris
2018-10-30 18:28   ` Jules Tamagnan
2018-11-10  9:24     ` Eli Zaretskii

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=837ehzlo3a.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=33195@debbugs.gnu.org \
    --cc=jtamagnan@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).