GNU bug report logs - #12399
24.2.50; dired-do-touch doesn't recognize empty input in minibuffer

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Sun, 9 Sep 2012 22:50:01 UTC

Severity: normal

Found in version 24.2.50

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 12399 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> altern.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12399 <at> debbugs.gnu.org
Subject: Re: bug#12399: 24.2.50;
	dired-do-touch doesn't recognize empty input in minibuffer
Date: Tue, 11 Sep 2012 16:41:13 +0200
[Message part 1 (text/plain, inline)]
Hi Juri,

Juri Linkov <juri <at> 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.

[dired-aux.el.patch (text/x-patch, inline)]
=== 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): "

[Message part 3 (text/plain, inline)]
-- 
 Bastien

This bug report was last modified 12 years and 330 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.