unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1224: [PATCH] user/group name completion
@ 2009-07-12 19:17 Chong Yidong
  2009-07-12 19:54 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chong Yidong @ 2009-07-12 19:17 UTC (permalink / raw)
  To: Antipov Dmitry; +Cc: 1224

> Hello,
>
> this patch introduces a user/group name completion for
> 'call-interactively'. This feature may be used, for example, within
> 'dired-do-chown' and 'dired-do-chgrp' (although it should be extended
> to MS and MacOS systems first, BTW).

Hi Antipov, and sorry for the late response.

Thanks for writing this patch, but I'm afraid I have to turn it down.  I
don't think user/group names are important enough for `interactive' code
letters, which are a scarce resource.  You can handle them in Elisp,
instead, with an S-expression argument to interactive.

The other part of your patch, adding functions to the C code that call
getpwent and getgrent, may be useful.  But I don't see the advantage
over parsing /etc/passwd or /etc/group manually (or calling a shell
command that does it).





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#1224: [PATCH] user/group name completion
  2009-07-12 19:17 bug#1224: [PATCH] user/group name completion Chong Yidong
@ 2009-07-12 19:54 ` Eli Zaretskii
  2009-07-12 20:29   ` Sven Joachim
  2009-07-12 20:35 ` Juri Linkov
  2009-07-14 20:08 ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2009-07-12 19:54 UTC (permalink / raw)
  To: Chong Yidong, 1224; +Cc: dmantipov

> From: Chong Yidong <cyd@stupidchicken.com>
> Date: Sun, 12 Jul 2009 15:17:25 -0400
> Cc: 1224@emacsbugs.donarmstrong.com
> 
> The other part of your patch, adding functions to the C code that call
> getpwent and getgrent, may be useful.  But I don't see the advantage
> over parsing /etc/passwd or /etc/group manually (or calling a shell
> command that does it).

The advantage is that getpwent and getgrent are more portable, of
course.

Only Posix systems can be trusted to actually have /etc/passwd and
/etc/groups.  On systems where these files are absent, we can still
have the C APIs (or craft our owns inside Emacs, as w32.c does).

That is not to say we should necessarily add these APIs, if they
currently don't have any callers within Emacs.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#1224: [PATCH] user/group name completion
  2009-07-12 19:54 ` Eli Zaretskii
@ 2009-07-12 20:29   ` Sven Joachim
  0 siblings, 0 replies; 6+ messages in thread
From: Sven Joachim @ 2009-07-12 20:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Chong Yidong, 1224, dmantipov

On 2009-07-12 21:54 +0200, Eli Zaretskii wrote:

>> From: Chong Yidong <cyd@stupidchicken.com>
>> Date: Sun, 12 Jul 2009 15:17:25 -0400
>> Cc: 1224@emacsbugs.donarmstrong.com
>> 
>> The other part of your patch, adding functions to the C code that call
>> getpwent and getgrent, may be useful.  But I don't see the advantage
>> over parsing /etc/passwd or /etc/group manually (or calling a shell
>> command that does it).
>
> The advantage is that getpwent and getgrent are more portable, of
> course.
>
> Only Posix systems can be trusted to actually have /etc/passwd and
> /etc/groups.

And even on those systems these files do not necessarily hold the user
database, there is NIS, LDAP,...

> On systems where these files are absent, we can still
> have the C APIs (or craft our owns inside Emacs, as w32.c does).

Please use them everywhere, manually parsing /etc/passwd and /etc/group
is broken behavior.

Sven





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#1224: [PATCH] user/group name completion
  2009-07-12 19:17 bug#1224: [PATCH] user/group name completion Chong Yidong
  2009-07-12 19:54 ` Eli Zaretskii
@ 2009-07-12 20:35 ` Juri Linkov
  2009-07-14 20:08 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2009-07-12 20:35 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 1224, Antipov Dmitry

> The other part of your patch, adding functions to the C code that call
> getpwent and getgrent, may be useful.  But I don't see the advantage
> over parsing /etc/passwd or /etc/group manually (or calling a shell
> command that does it).

The other part of the patch is useful for completions of "O" and "G"
in Dired.  If you decide to install the other part of the patch
please use better function names.  Since most user-related functions
in Emacs begin with the "user-" prefix (e.g. `user-real-login-name',
`user-original-login-name'), I think a better name would be `user-list'
for users, and `group-list' for groups.  These names are also consistent
with `buffer-list', `process-list', etc.

-- 
Juri Linkov
http://www.jurta.org/emacs/





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#1224: [PATCH] user/group name completion
  2009-07-12 19:17 bug#1224: [PATCH] user/group name completion Chong Yidong
  2009-07-12 19:54 ` Eli Zaretskii
  2009-07-12 20:35 ` Juri Linkov
@ 2009-07-14 20:08 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2009-07-14 20:08 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 1224, Antipov Dmitry

> But I don't see the advantage over parsing /etc/passwd or /etc/group
> manually (or calling a shell command that does it).

It's always good practice to use an API rather than reimplement it.
It also will make it work right with NIS, ...


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#1224: [PATCH] user/group name completion
       [not found] <a0abcxdss4.fsf@fencepost.gnu.org>
@ 2012-04-17  1:53 ` Glenn Morris
  0 siblings, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2012-04-17  1:53 UTC (permalink / raw)
  To: 1224-done

Version: 24.2

I am sorry for the big delay. This is now installed in the Emacs trunk.
Thank you!





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-04-17  1:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-12 19:17 bug#1224: [PATCH] user/group name completion Chong Yidong
2009-07-12 19:54 ` Eli Zaretskii
2009-07-12 20:29   ` Sven Joachim
2009-07-12 20:35 ` Juri Linkov
2009-07-14 20:08 ` Stefan Monnier
     [not found] <a0abcxdss4.fsf@fencepost.gnu.org>
2012-04-17  1:53 ` Glenn Morris

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