aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-05-01 03:47:42 +0000
committerJuri Linkov2004-05-01 03:47:42 +0000
commit52f134eea75b45425febcb0f95d51f0a5e12ebb2 (patch)
treef413a3f904a239872b90d6e0f12daa9c661a1730
parentca858c641956fc46532613a876ce2f7b70d85bde (diff)
downloademacs-52f134eea75b45425febcb0f95d51f0a5e12ebb2.tar.gz
emacs-52f134eea75b45425febcb0f95d51f0a5e12ebb2.zip
(dired-touch-initial): New fun.
(dired-do-chxxx): Call it for op-symbol `touch'.
-rw-r--r--lisp/dired-aux.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 0709e0cfe1c..dbc3d763040 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -185,6 +185,18 @@ List has a form of (file-name full-file-name (attribute-list))"
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.
@@ -196,7 +208,8 @@ List has a form of (file-name full-file-name (attribute-list))"
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