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

From: Thierry Volpiatto <[email-masked]>
Date: Mon, 06 May 2024 10:18:18 +0000

Juri Linkov <[email-masked]> writes:

>> What I see and is wrong IMO is:
>>
>> - DEFAULT is the timestamp of the current file at point and prompt says
>> that DEFAULT is "now".
>>
>> - Pressing RET should use DEFAULT, but IIUC what you say, it returns
>> current-time timestamp, is it correct?
>> If so this is another inconsistency, RET should always return DEFAULT with an
>> empty prompt.
>
> The prompt of dired-do-touch with the default value "now" is a special case.
> This exception is required to solve the time paradox.  If the default value
> was a fixed value of some moment of time such as you proposed
>
>   (format-time-string "%Y%m%d%H%M.%S" (current-time))
>
> then after you press RET the timestamp of the file will be set
> to some moment of time in the past, because it takes time
> between you press 'T' (dired-do-touch) and then press 'RET'
> (exit-minibuffer).
>
> So the timestamp of the file will be wrong, not the time
> when you press 'RET'.  For example, I often use the moment
> of pressing 'RET' to ensure that the time of pressing 'RET'
> is the time that the file timestamp will be set to.

The timestamp will be set to a few milliseconds in the past, yes, but is
this really a problem? If it is you should fix this in a different way
because having a DEFAULT argument which is different of what you have
when you press RET is a real issue:

As a third party completion package maintainer, how do I know when a
completing-read use "foo" as default that when the user press RET he
will endup with "bar" ?

-- 
Thierry