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

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

bug#12399: 24.2.50; dired-do-touch doesn't recognize empty input in mini


From: Bastien
Subject: bug#12399: 24.2.50; dired-do-touch doesn't recognize empty input in minibuffer
Date: Tue, 11 Sep 2012 16:41:13 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux)

Hi Juri,

Juri Linkov <juri@jurta.org> writes:

> `dired-do-touch' used to get the current time for empty input.
> Its prompt says that the default value is "now".
>
> But currently its default value is the file modification time,
> not the current time.  Thus `T RET' has no effect in dired.
>
> The problem is that `dired-mark-read-string' now uses `completing-read'
> (to be able to provide completion) instead of `read-from-minibuffer'.
>
> These functions differ in how they handle defaults:
> `read-from-minibuffer' returns the empty string for empty input, but
> `completing-read' returns the default value and can't recognize
> empty input.
>
> This requires a new function that provides completion like
> `completing-read-default' but without these two lines:
>
>     (when (and (equal result "") def)
>       (setq result (if (consp def) (car def) def)))

I'm not sure why the simple patch below should not be enough,
taking the current time instead of the one from the first file 
in the set of marked file.

If it's good for you, I'll apply this within this week.

=== modified file 'lisp/dired-aux.el'
--- lisp/dired-aux.el   2012-09-08 14:48:26 +0000
+++ lisp/dired-aux.el   2012-09-11 14:38:39 +0000
@@ -225,8 +225,7 @@
   (let* ((files (dired-get-marked-files t arg))
         (default (and (eq op-symbol 'touch)
                       (stringp (car files))
-                      (format-time-string "%Y%m%d%H%M.%S"
-                                          (nth 5 (file-attributes (car 
files))))))
+                      (format-time-string "%Y%m%d%H%M.%S")))
         (prompt (concat "Change " attribute-name " of %s to"
                         (if (eq op-symbol 'touch)
                             " (default now): "

-- 
 Bastien

reply via email to

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