unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org
Subject: Re: dired-do-touch (was: [PATCH] fix goto-line)
Date: Sat, 30 Jul 2011 12:17:17 +0300	[thread overview]
Message-ID: <87aabw16ls.fsf_-_@mail.jurta.org> (raw)
In-Reply-To: <4E32E399.8000402@cs.ucla.edu> (Paul Eggert's message of "Fri, 29 Jul 2011 09:45:13 -0700")

> 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	other threads:[~2011-07-30  9:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28 12:57 [PATCH] fix goto-line Jose E. Marchesi
2011-07-28 14:07 ` Juanma Barranquero
2011-07-28 17:38   ` Eduard Wiebe
2011-07-29 11:15   ` Juri Linkov
2011-07-29 11:22     ` Juanma Barranquero
2011-07-29 15:28       ` Juri Linkov
2011-07-29 16:45         ` Paul Eggert
2011-07-30  9:17           ` Juri Linkov [this message]
2011-07-30  9:50             ` dired-do-touch Juri Linkov
2011-07-30  9:54             ` dired-do-touch (was: [PATCH] fix goto-line) Andreas Schwab
2011-07-30 11:01               ` dired-do-touch 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=87aabw16ls.fsf_-_@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.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).