unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Juri Linkov <juri@jurta.org>
Cc: 12399@debbugs.gnu.org
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	[thread overview]
Message-ID: <87k3w01v1y.fsf@altern.org> (raw)
In-Reply-To: <878vciakcd.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 10 Sep 2012 01:43:14 +0300")

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dired-aux.el.patch --]
[-- Type: text/x-patch, Size: 535 bytes --]

=== 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): "


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  reply	other threads:[~2012-09-11 14:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-09 22:43 bug#12399: 24.2.50; dired-do-touch doesn't recognize empty input in minibuffer Juri Linkov
2012-09-11 14:41 ` Bastien [this message]
2012-09-11 19:05   ` Juri Linkov
2012-09-11 20:46     ` Stefan Monnier
2012-09-11 22:50       ` Juri Linkov
2012-09-13 23:42         ` Juri Linkov
2012-09-14 22:59           ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3w01v1y.fsf@altern.org \
    --to=bzg@altern.org \
    --cc=12399@debbugs.gnu.org \
    --cc=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).