summaryrefslogtreecommitdiff
path: root/lisp/dired-aux.el
diff options
context:
space:
mode:
authorMichaël Cadilhac <michael.cadilhac@lrde.org>2007-09-10 09:58:29 +0000
committerMichaël Cadilhac <michael.cadilhac@lrde.org>2007-09-10 09:58:29 +0000
commit822b17d34c7a87a6d77edab18a9b7a3793c7a6d6 (patch)
tree655e9d95b5d3c11f66b353baa79d2a7a1d829d3c /lisp/dired-aux.el
parentf664fee97dddd371f2e541ac21491ce77a28219b (diff)
downloademacs-822b17d34c7a87a6d77edab18a9b7a3793c7a6d6.tar.gz
(dired-do-chmod): Change to use the built-in `set-file-modes' and the
symbolic mode parsing functions.
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r--lisp/dired-aux.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 124c53b44c5..f904238c8fa 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -253,9 +253,20 @@ List has a form of (file-name full-file-name (attribute-list))"
;;;###autoload
(defun dired-do-chmod (&optional arg)
"Change the mode of the marked (or next ARG) files.
-This calls chmod, thus symbolic modes like `g+w' are allowed."
+Symbolic modes like `g+w' are allowed."
(interactive "P")
- (dired-do-chxxx "Mode" dired-chmod-program 'chmod arg))
+ (let* ((files (dired-get-marked-files t arg))
+ (modes (dired-mark-read-string
+ "Change mode of %s to: " nil
+ 'chmod arg files))
+ (num-modes (if (string-match "^[0-7]+" modes)
+ (string-to-number modes 8))))
+ (dolist (file files)
+ (set-file-modes
+ file
+ (if num-modes num-modes
+ (file-modes-symbolic-to-number modes (file-modes file)))))
+ (dired-do-redisplay arg)))
;;;###autoload
(defun dired-do-chgrp (&optional arg)