From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Ehud Karni" Newsgroups: gmane.emacs.devel Subject: Re: dired-do-touch Date: Sun, 21 Mar 2004 15:31:14 +0200 Organization: Mivtach-Simon Insurance agencies Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200403211331.i2LDVE6x002719@beta.mvs.co.il> References: <8765czqqyj.fsf@sno.mundell.ukfsn.org> Reply-To: ehud@unix.mvs.co.il NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-8-i Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1079876035 6018 80.91.224.253 (21 Mar 2004 13:33:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 21 Mar 2004 13:33:55 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Mar 21 14:33:46 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B535F-0005KG-00 for ; Sun, 21 Mar 2004 14:33:45 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B535A-0004gV-00 for ; Sun, 21 Mar 2004 14:33:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B534C-0005Bo-4Z for emacs-devel@quimby.gnus.org; Sun, 21 Mar 2004 08:32:40 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B533f-0005BT-GP for emacs-devel@gnu.org; Sun, 21 Mar 2004 08:32:07 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B5339-0004mm-76 for emacs-devel@gnu.org; Sun, 21 Mar 2004 08:32:06 -0500 Original-Received: from [192.114.178.12] (helo=unix.mvs.co.il) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B5338-0004eX-E3 for emacs-devel@gnu.org; Sun, 21 Mar 2004 08:31:34 -0500 Original-Received: from beta.mvs.co.il (beta [10.253.0.3]) by unix.mvs.co.il (8.12.10/8.12.10) with ESMTP id i2LDVFXn009180 for ; Sun, 21 Mar 2004 15:31:15 +0200 Original-Received: from beta.mvs.co.il (localhost [127.0.0.1]) by beta.mvs.co.il (8.12.10/8.12.10) with ESMTP id i2LDVFAu002723 for ; Sun, 21 Mar 2004 15:31:15 +0200 Original-Received: (from root@localhost) by beta.mvs.co.il (8.12.10/8.12.10/Submit) id i2LDVE6x002719; Sun, 21 Mar 2004 15:31:14 +0200 Original-To: matt@mundell.ukfsn.org In-reply-to: <8765czqqyj.fsf@sno.mundell.ukfsn.org> (message from Matthew Mundell on 20 Mar 2004 19:05:40 +0000) X-Mailer: Emacs 21.3.1 rmail (send-msg 1.108) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20679 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20679 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 20 Mar 2004 19:05:40 +0000, Matthew Mundell wrote: > > In Dired "T" could touch the current file with the touch shell > command. > > +(defun dired-do-touch (file) > + "Touch the current file with the `touch' program." > + (interactive (list (dired-get-filename t))) > + (with-temp-buffer > + (call-process "touch" nil t t "--" file) > + (unless (bobp) > + (when (bolp) > + (backward-delete-char 1)) > + (message "%s" (buffer-string))))) I think it is better to define `dired-do-touch' like the other file modifying functions in dired-aux (a'la `dired-do-chown/grp/mod').' Here is my version: (defun dired-do-touch (&optional arg) "touch the marked (or next ARG) files." (interactive "P") (dired-do-chxxx (concat "date & TIME (" (if (eq 'w32 window-system) "MMDDhhmm[[CC][YY][.ss])" ;; Windows NT/95 system (20.x) "[[CC][YY]MMDDhhmm.[ss])")) ;; UNIX dired-touch-program 'touch arg)) (defvar dired-touch-program (cond ((eq system-type 'ms-dos) nil) ; nil for dos! ((eq system-type 'windows-nt) "touch") ; use Cygwin32 touch (t "touch-t")) ; UNIX - script "Name of touch command (usually `touch').") The "touch-t" script is simply "touch -t" . Ehud. - -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ GnuPG: 98EA398D Better Safe Than Sorry -----BEGIN PGP SIGNATURE----- Comment: use http://www.keyserver.net/ to get my key (and others) iD8DBQFAXZkiLFvTvpjqOY0RAqTjAJ9ovu0d85vdMLF6cFvCJOI2LT4SLQCghrLr j6lYQyTTTxi1qS3t66aKTjM= =LOq+ -----END PGP SIGNATURE-----