emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] user/group completion for dired


From: Eli Zaretskii
Subject: Re: [PATCH] user/group completion for dired
Date: Wed, 21 Sep 2011 04:49:57 -0400

> Date: Wed, 21 Sep 2011 11:35:36 +0400
> From: Dmitry Antipov <address@hidden>
> 
> 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 via email to

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