comparison lisp/dired-aux.el @ 55274:33be1cf542ec

(dired-touch-initial): New fun. (dired-do-chxxx): Call it for op-symbol `touch'.
author Juri Linkov <juri@jurta.org>
date Sat, 01 May 2004 03:47:42 +0000
parents 2f1445ac3356
children 997b45b51728
comparison
equal deleted inserted replaced
55273:8362eef794e3 55274:33be1cf542ec
183 (list file-name 183 (list file-name
184 full-file-name 184 full-file-name
185 (file-attributes full-file-name)))) 185 (file-attributes full-file-name))))
186 (directory-files dir))) 186 (directory-files dir)))
187 187
188
189 (defun dired-touch-initial (files)
190 "Create initial input value for `touch' command."
191 (let (initial)
192 (while files
193 (let ((current (nth 5 (file-attributes (car files)))))
194 (if (and initial (not (equal initial current)))
195 (setq initial (current-time) files nil)
196 (setq initial current))
197 (setq files (cdr files))))
198 (format-time-string "%Y%m%d%H%M.%S" initial)))
199
188 (defun dired-do-chxxx (attribute-name program op-symbol arg) 200 (defun dired-do-chxxx (attribute-name program op-symbol arg)
189 ;; Change file attributes (mode, group, owner, timestamp) of marked files and 201 ;; Change file attributes (mode, group, owner, timestamp) of marked files and
190 ;; refresh their file lines. 202 ;; refresh their file lines.
191 ;; ATTRIBUTE-NAME is a string describing the attribute to the user. 203 ;; ATTRIBUTE-NAME is a string describing the attribute to the user.
192 ;; PROGRAM is the program used to change the attribute. 204 ;; PROGRAM is the program used to change the attribute.
194 ;; ARG describes which files to use, as in dired-get-marked-files. 206 ;; ARG describes which files to use, as in dired-get-marked-files.
195 (let* ((files (dired-get-marked-files t arg)) 207 (let* ((files (dired-get-marked-files t arg))
196 (new-attribute 208 (new-attribute
197 (dired-mark-read-string 209 (dired-mark-read-string
198 (concat "Change " attribute-name " of %s to: ") 210 (concat "Change " attribute-name " of %s to: ")
199 nil op-symbol arg files)) 211 (if (eq op-symbol 'touch) (dired-touch-initial files))
212 op-symbol arg files))
200 (operation (concat program " " new-attribute)) 213 (operation (concat program " " new-attribute))
201 failures) 214 failures)
202 (setq failures 215 (setq failures
203 (dired-bunch-files 10000 216 (dired-bunch-files 10000
204 (function dired-check-process) 217 (function dired-check-process)