]> git.eshelyaron.com Git - emacs.git/commitdiff
Add user, group name completion to dired
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 17 Apr 2012 01:49:40 +0000 (21:49 -0400)
committerGlenn Morris <rgm@gnu.org>
Tue, 17 Apr 2012 01:49:40 +0000 (21:49 -0400)
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
lisp/dired-aux.el

index 599a69bb9c2d59b393e241ee68000c358f0b4ac9..31caf9b6a347fa6b4f640239bc9b16e39f28bc12 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-17  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * 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  <rgm@gnu.org>
 
        * mouse.el (mouse-drag-track):
index 0795b0175a2a788898d95d62006742ba2bfa6cdb..97ff0cbd07e185f8b7b086b290a8376c00e72548 100644 (file)
@@ -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))
 \f
 ;;; Cleaning a directory: flagging some backups for deletion.