From 30009afd5b72606149d13eba52cf1a3ab96e3cc5 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 16 Apr 2012 21:49:40 -0400 Subject: [PATCH] Add user, group name completion to dired Note from committer: I modified the original patch, by adding the new collection argument at the end of the argument list rather than in the middle. * dired-aux.el (dired-mark-read-string): Offer optional completion. (dired-do-chxxx): Complete chown, chgrp over users, groups. Fixes: debbugs:7900 --- lisp/ChangeLog | 5 +++++ lisp/dired-aux.el | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 599a69bb9c2..31caf9b6a34 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-04-17 Dmitry Antipov + + * dired-aux.el (dired-mark-read-string): Offer optional completion. + (dired-do-chxxx): Complete chown, chgrp over users, groups. (Bug#7900) + 2012-04-17 Glenn Morris * mouse.el (mouse-drag-track): diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 0795b0175a2..97ff0cbd07e 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -245,7 +245,11 @@ List has a form of (file-name full-file-name (attribute-list))." " (default now): " ": "))) (new-attribute (dired-mark-read-string prompt nil op-symbol - arg files default)) + arg files default + (cond ((eq op-symbol 'chown) + (system-users)) + ((eq op-symbol 'chgrp) + (system-groups))))) (operation (concat program " " new-attribute)) failures) (setq failures @@ -385,7 +389,7 @@ Uses the shell command coming from variables `lpr-command' and (dired-run-shell-command (dired-shell-stuff-it command file-list nil)))) (defun dired-mark-read-string (prompt initial op-symbol arg files - &optional default-value) + &optional default-value collection) "Read args for a Dired marked-files command, prompting with PROMPT. Return the user input (a string). @@ -399,9 +403,9 @@ of such values, available via history commands. Note that if the user enters empty input, this function returns the empty string, not DEFAULT-VALUE." (dired-mark-pop-up nil op-symbol files - 'read-from-minibuffer + 'completing-read (format prompt (dired-mark-prompt arg files)) - initial nil nil nil default-value)) + collection nil nil initial nil default-value nil)) ;;; Cleaning a directory: flagging some backups for deletion. -- 2.39.2