changeset 54664:2f1445ac3356

(dired-do-touch): New fun. (dired-do-chxxx): Add argument -t for touch operation.
author Juri Linkov <juri@jurta.org>
date Wed, 31 Mar 2004 16:30:33 +0000
parents 9b0161392fe1
children 0f0ed51ddd15
files lisp/dired-aux.el
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Wed Mar 31 16:29:46 2004 +0000
+++ b/lisp/dired-aux.el	Wed Mar 31 16:30:33 2004 +0000
@@ -186,7 +186,7 @@
    (directory-files dir)))
 
 (defun dired-do-chxxx (attribute-name program op-symbol arg)
-  ;; Change file attributes (mode, group, owner) of marked files and
+  ;; Change file attributes (mode, group, owner, timestamp) of marked files and
   ;; refresh their file lines.
   ;; ATTRIBUTE-NAME is a string describing the attribute to the user.
   ;; PROGRAM is the program used to change the attribute.
@@ -203,7 +203,10 @@
 	  (dired-bunch-files 10000
 			     (function dired-check-process)
 			     (append
-			      (list operation program new-attribute)
+			      (list operation program)
+			      (if (eq op-symbol 'touch)
+				  '("-t") nil)
+			      (list new-attribute)
 			      (if (string-match "gnu" system-configuration)
 				  '("--") nil))
 			     files))
@@ -236,6 +239,12 @@
       (error "chown not supported on this system"))
   (dired-do-chxxx "Owner" dired-chown-program 'chown arg))
 
+(defun dired-do-touch (&optional arg)
+  "Change the timestamp of the marked (or next ARG) files.
+This calls touch."
+  (interactive "P")
+  (dired-do-chxxx "Timestamp" dired-touch-program 'touch arg))
+
 ;; Process all the files in FILES in batches of a convenient size,
 ;; by means of (FUNCALL FUNCTION ARGS... SOME-FILES...).
 ;; Batches are chosen to need less than MAX chars for the file names,