Subject: bug#70725: 29.3; dired-do-touch completion

From: Thierry Volpiatto <[email-masked]>
Date: Fri, 03 May 2024 07:10:37 +0000

Eli Zaretskii <[email-masked]> writes:

>> Cc: [email-masked]
>> From: Thierry Volpiatto <[email-masked]>
>> Date: Fri, 03 May 2024 04:55:41 +0000
>> 
>> Christopher Howard <[email-masked]> writes:
>> 
>> > 1. install helm
>> > 2. emacs -q
>> > 3. M-x helm-mode
>> > 4. M-x dired (to some directory with files)
>> > 5. M-x dired-do-touch (T)
>> >
>> > My problem is that, when I try to use this command in helm mode, helm
>> > only gives me one completion option - the timestamp already on the
>> > file. Helm tells me it is responding to a completing-read call. But
>> > the dired-do-touch prompt says that the default action should be
>> > "now", i.e., the current date and time. Maybe this is a helm issue,
>> > but I was wondering if maybe something needs to be tweaked in
>> > dired-do-touch so that it passes a correct completion list off to
>> > completing-read.
>> 
>> "now" is not a valid answer for touch, it is just here in prompt to tell
>> you what DEFAULT is, so what you see in Helm completion is what you have
>> with vanilla Emacs if you press M-n. There is no issue here.
>> That said you have better time using helm-find-files instead of dired
>> for such operations on files.
>
> Thanks, Thierry.  I'm therefore closing this bug.

Hello Eli,
I didn't check carefully and I see now that the prompt says "now" for
DEFAULT but indeed the DEFAULT is the timestamp of the selected file and
not `current-time`, so to reflect what the prompt says (now) we have to
modify DEFAULT, maybe like this in `dired-do-chxxx`:

@@ -437,4 +437,7 @@
-			   (format-time-string
-			    "%Y%m%d%H%M.%S"
-			    (file-attribute-modification-time
-			     (file-attributes default-file))))
+			   (list
+                            (format-time-string
+			     "%Y%m%d%H%M.%S" (current-time))
+                            (format-time-string
+			     "%Y%m%d%H%M.%S"
+			     (file-attribute-modification-time
+			      (file-attributes default-file)))))

-- 
Thierry