emacs-devel
[Top][All Lists]
Advanced

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

Re: dired-do-touch (was: [PATCH] fix goto-line)


From: Juri Linkov
Subject: Re: dired-do-touch (was: [PATCH] fix goto-line)
Date: Sat, 30 Jul 2011 12:17:17 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> Thanks, could you please open up a bug report for this
> on debbugs.gnu.org?  That'd be a better place to discuss
> this anyway.

I've unarchived that bug report and referred to this thread from it.

>> +      (if (eq op-symbol 'touch)
>> +          (format-time-string "%Y%m%d%H%M.%S" (current-time))))
>
> I don't know what the overall problem is here, but I can
> see two issues with this proposed patch.  First, presumably it
> invokes (current-time) at one point, and then, later,
> uses that saved current-time to do the 'touch'.  But that's
> not quite right; it's the equivalent of the shell command
>
>   touch --date="$(date)" file

In theory you are right.  But in practice a 1-2 sec delay
is not a problem.

> whereas surely what is wanted is the equivalent of
>
>   touch file

When `touch file' is really wanted then it's easy to type `! touch'.
`dired-do-touch' was created for the convenience of changing
the file's timestamp providing useful default values for editing.

> The latter command avoids some race conditions, because it
> uses the time at the point of the 'touch', not at the point of
> the invocation of 'date' (or of 'current-time').

`T' is intended to allow editing the file attribute of the last
modification time, like `M' is used for editing the file's mode,
`O' - owner's UID, `G' - GID.  The docstring of `dired-do-touch' says:
"Change the timestamp of the marked (or next ARG) files."
And Dired is "Directory Editor" after all, so it should allow
editing file attributes including timestamps.

> The second issue is minor, and perhaps fixing the first issue
> will make it irrelevant, but here it is anyway: the
> "(current-time)" can be omitted in the above code, as it's the default
> for that argument of format-time-string.

Thanks, I removed "(current-time)" from the call to `format-time-string'.

BTW, I noticed that the docstring of `format-time-string' refers
to the argument `TIME' whereas the real argument name is `TIMEVAL'.
Adding something like "\n\(fn FORMAT-STRING &optional TIME UNIVERSAL)"
to the last line of the docstring would help.

Another documentation mismatch is that (info "(emacs) Operating on Files")
says:

  `M MODESPEC <RET>'
       Change the mode (also called "permission bits") of the specified
       files (`dired-do-chmod').  This uses the `chmod' program, so
       MODESPEC can be any argument that `chmod' can handle.

But actually `dired-do-chmod' doesn't use the `chmod' program anymore.



reply via email to

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