unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] user/group completion for dired
Date: Wed, 21 Sep 2011 04:49:57 -0400	[thread overview]
Message-ID: <E1R6IVB-0003dR-LS@fencepost.gnu.org> (raw)
In-Reply-To: <4E7993C8.6010609@yandex.ru> (message from Dmitry Antipov on Wed,  21 Sep 2011 11:35:36 +0400)

> Date: Wed, 21 Sep 2011 11:35:36 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> 
> there is a simple user/group completion for dired.

Thanks.  Allow me a few comments.

> +DEFUN ("system-users", Fsystem_users, Ssystem_users, 0, 0, 0,
> +       doc: /* Return a list of user names currently registered in the system.
> +On UNIX systems, those are user names listed in /etc/passwd file.
> +On other systems, this function always returns nil.  */)

IMO, the last two sentences are too categorical and too OS-specific.
E.g., in the MS-DOS build of Emacs, getpwent and getgrent are
available and usable, although MS-DOS is certainly not a Unix system.
It should also be possible to write an emulation of these functions
for MS-Windows.  And even on Unix systems, I'm not sure the
information is always on /etc/passwd.  And the same goes for groups
and /etc/groups.

So please make the doc strings more vague; it should be enough to say
that if this functionality is not supported, the value is nil, or
something like that.

> +  Lisp_Object users = Qnil;

We should at least return the single user that is the current user,
instead of nil.  Emacs always knows who is the current user, on all
supported systems, so there's no need to be so restrictive when
getpwent is unavailable.

> +  while ((pw = getpwent ()))
> +    users = Fcons (build_string (pw->pw_name), users);

What happens if the user name includes non-ASCII characters?  If that
can happen, we should decode the pw_name string, not just call
build_string on the unibyte string we get.  Same issue with the group
name.



  reply	other threads:[~2011-09-21  8:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21  7:35 [PATCH] user/group completion for dired Dmitry Antipov
2011-09-21  8:49 ` Eli Zaretskii [this message]
2011-09-21  9:25   ` Andreas Schwab
2011-09-21 13:59   ` Dmitry Antipov
2011-09-21 15:04     ` Eli Zaretskii
2011-09-21 15:54       ` Dmitry Antipov
2011-09-21 17:40         ` Glenn Morris
2011-09-21 20:22           ` Juri Linkov
2011-09-21 15:27     ` Juanma Barranquero
2011-09-21 20:21       ` Juri Linkov

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=E1R6IVB-0003dR-LS@fencepost.gnu.org \
    --to=eliz@gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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).