changeset 84446:20b4ed0e2a05

(dired-do-chmod): Change to use the built-in `set-file-modes' and the symbolic mode parsing functions.
author Michaël Cadilhac <michael.cadilhac@lrde.org>
date Mon, 10 Sep 2007 09:58:16 +0000
parents 4a28dfc9900f
children aad6a1602fc4
files lisp/dired-aux.el
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Mon Sep 10 09:56:11 2007 +0000
+++ b/lisp/dired-aux.el	Mon Sep 10 09:58:16 2007 +0000
@@ -253,9 +253,20 @@
 ;;;###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)