(read-file-modes): New. Read either an octal value of a file mode or a
symbolic value, and return its numeric value.
+ * dired-aux.el (dired-do-chmod): Change to use the built-in
+ `set-file-modes' and the previous symbolic mode parsing functions.
+
2007-09-10 Stefan Monnier <monnier@iro.umontreal.ca>
* textmodes/texinfo.el: Remove spurious * in docstrings.
;;;###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)