]> git.eshelyaron.com Git - emacs.git/commitdiff
(dired-do-chmod): Change to use the built-in `set-file-modes' and the
authorMichaël Cadilhac <michael.cadilhac@lrde.org>
Mon, 10 Sep 2007 09:58:29 +0000 (09:58 +0000)
committerMichaël Cadilhac <michael.cadilhac@lrde.org>
Mon, 10 Sep 2007 09:58:29 +0000 (09:58 +0000)
symbolic mode parsing functions.

lisp/ChangeLog
lisp/dired-aux.el

index 7ba7f6fc71f5d4000b1956bc69ddd2382a49ee56..2fab7d98ad2164db15d1fdaaf2f5e1636e2b6b1b 100644 (file)
@@ -8,6 +8,9 @@
        (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.
index 124c53b44c5aa9f7bee1cce2f93ed9c39e010df1..f904238c8fa9833de38c196c2234d2697cfb6321 100644 (file)
@@ -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)