From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: dired-do-touch (was: [PATCH] fix goto-line) Date: Sat, 30 Jul 2011 12:17:17 +0300 Organization: JURTA Message-ID: <87aabw16ls.fsf_-_@mail.jurta.org> References: <874o26muk2.fsf@gnu.org> <8762ml5odm.fsf@mail.jurta.org> <8762mlglnt.fsf@mail.jurta.org> <4E32E399.8000402@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1312017465 12378 80.91.229.12 (30 Jul 2011 09:17:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Jul 2011 09:17:45 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 30 11:17:41 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qn5fx-00024V-2r for ged-emacs-devel@m.gmane.org; Sat, 30 Jul 2011 11:17:41 +0200 Original-Received: from localhost ([::1]:55999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qn5fw-0002ki-4n for ged-emacs-devel@m.gmane.org; Sat, 30 Jul 2011 05:17:40 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qn5ft-0002kb-Al for emacs-devel@gnu.org; Sat, 30 Jul 2011 05:17:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qn5fs-0002TJ-5V for emacs-devel@gnu.org; Sat, 30 Jul 2011 05:17:37 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]:44591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qn5fs-0002TF-1C for emacs-devel@gnu.org; Sat, 30 Jul 2011 05:17:36 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id 5CC056E805C; Sat, 30 Jul 2011 02:17:35 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 92445451C34B; Sat, 30 Jul 2011 02:17:34 -0700 (PDT) In-Reply-To: <4E32E399.8000402@cs.ucla.edu> (Paul Eggert's message of "Fri, 29 Jul 2011 09:45:13 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.113.175.8 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:142512 Archived-At: > 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 ' 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.