bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10624: 24.0.92; default value of `dired-do-ch*'


From: Juri Linkov
Subject: bug#10624: 24.0.92; default value of `dired-do-ch*'
Date: Sat, 15 Sep 2012 02:47:41 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu)

This request for enhancement is implemented with the following patch
where the user will be able to mark the target file with the mark.
Otherwise, the marked file is used as target only when it is a single file
in the list of marked files:

=== modified file 'lisp/dired-aux.el'
--- lisp/dired-aux.el   2012-09-13 23:42:39 +0000
+++ lisp/dired-aux.el   2012-09-14 23:45:05 +0000
@@ -223,10 +237,16 @@ (defun dired-do-chxxx (attribute-name pr
   ;; OP-SYMBOL is the type of operation (for use in `dired-mark-pop-up').
   ;; ARG describes which files to use, as in `dired-get-marked-files'.
   (let* ((files (dired-get-marked-files t arg))
+        (default-file (or (if (and transient-mark-mode mark-active)
+                              (save-excursion (goto-char (mark t))
+                                              (dired-get-filename t t)))
+                          (if (and (= (length files) 1)
+                                   (stringp (car files)))
+                              (car files))))
         (default (and (eq op-symbol 'touch)
-                      (stringp (car files))
+                      default-file
                       (format-time-string "%Y%m%d%H%M.%S"
-                                          (nth 5 (file-attributes (car 
files))))))
+                                          (nth 5 (file-attributes 
default-file)))))
         (prompt (concat "Change " attribute-name " of %s to"
                         (if (eq op-symbol 'touch)
                             " (default now): "





reply via email to

[Prev in Thread] Current Thread [Next in Thread]