emacs-devel
[Top][All Lists]
Advanced

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

Re: dired-do-touch


From: Ehud Karni
Subject: Re: dired-do-touch
Date: Sun, 21 Mar 2004 15:31:14 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 20 Mar 2004 19:05:40 +0000, Matthew Mundell <address@hidden> 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 <http://www.keyserver.net/>    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-----




reply via email to

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