From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: dired-do-touch Date: Sat, 27 Mar 2004 12:59:21 +0200 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87k7165zee.fsf@mail.jurta.org> References: <8765czqqyj.fsf@sno.mundell.ukfsn.org> <8765ctkmdo.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1080385588 18968 80.91.224.253 (27 Mar 2004 11:06:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 27 Mar 2004 11:06:28 +0000 (UTC) Cc: matt@mundell.ukfsn.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Mar 27 12:06:19 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 1B7Bdr-0000QP-00 for ; Sat, 27 Mar 2004 12:06:19 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B7Bdq-0005k1-00 for ; Sat, 27 Mar 2004 12:06:19 +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 1B7BdP-0001nm-3K for emacs-devel@quimby.gnus.org; Sat, 27 Mar 2004 06:05:51 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B7BcW-0001lt-47 for emacs-devel@gnu.org; Sat, 27 Mar 2004 06:04:56 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B7Bbu-0001WU-SU for emacs-devel@gnu.org; Sat, 27 Mar 2004 06:04:50 -0500 Original-Received: from [66.33.219.4] (helo=spork.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B7Bbu-0001WH-3d; Sat, 27 Mar 2004 06:04:18 -0500 Original-Received: from mail.jurta.org (80-235-34-145-dsl.mus.estpak.ee [80.235.34.145]) by spork.dreamhost.com (Postfix) with ESMTP id D823811DC57; Sat, 27 Mar 2004 03:04:09 -0800 (PST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Sat, 27 Mar 2004 00:52:10 -0500") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) 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:20991 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20991 Richard Stallman writes: > When we are discussing one new feature, please do not add a second > feature into the same patch. That is an obstacle to considering it. > > Would you please send *only* the new T command, with nothing else? > Then maybe we can install it. Please include the ChangeLog entries > and an entry for etc/NEWS. > > After that we could consider the other change. Below is the patch for the new T command. It uses the external touch program and behaves like other dired commands `chmod', `chgrp' and `chown'. I suggest to install this patch first. Then I suggest to consider and install the patch that allows the initial default values for dired-do-touch, dired-do-chmod, dired-do-chgrp, dired-do-chown and some other dired commands. And after this I suggest to install the patch posted by Matthew Mundell that uses the new function `set-file-times', with small modifications which will allow to use it instead of the external program in cases when there is no touch program installed or depending on a new user option. lisp/ChangeLog: * dired.el (dired-touch-program): New var. (dired-mode-map): Bind `dired-do-touch' to `T' and add menu-item. (dired-no-confirm): Add `touch' to docstring. (dired-do-touch): Add autoload for `dired-do-touch'. * dired-aux.el (dired-do-touch): New fun. (dired-do-chxxx): Add argument `-t' for touch operation. An entry for etc/NEWS could be written later to describe all the related changes. Index: emacs/lisp/dired.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/dired.el,v retrieving revision 1.278 diff -c -r1.278 dired.el *** emacs/lisp/dired.el 27 Mar 2004 01:16:58 -0000 1.278 --- emacs/lisp/dired.el 27 Mar 2004 10:10:01 -0000 *************** *** 79,84 **** --- 79,87 ---- (defvar dired-chmod-program "chmod" "Name of chmod command (usually `chmod').") + (defvar dired-touch-program "touch" + "Name of touch command (usually `touch').") + ;;;###autoload (defcustom dired-ls-F-marks-symlinks nil "*Informs dired about how `ls -lF' marks symbolic links. *************** *** 919,924 **** --- 922,928 ---- (define-key map "Q" 'dired-do-query-replace-regexp) (define-key map "R" 'dired-do-rename) (define-key map "S" 'dired-do-symlink) + (define-key map "T" 'dired-do-touch) (define-key map "X" 'dired-do-shell-command) (define-key map "Z" 'dired-do-compress) (define-key map "!" 'dired-do-shell-command) *************** *** 1189,1194 **** --- 1193,1201 ---- (define-key map [menu-bar operate chmod] '(menu-item "Change Mode..." dired-do-chmod :help "Change mode (attributes) of marked files")) + (define-key map [menu-bar operate touch] + '(menu-item "Change Timestamp..." dired-do-touch + :help "Change timestamp of marked files")) (define-key map [menu-bar operate load] '(menu-item "Load" dired-do-load :help "Load marked Emacs Lisp files")) *************** *** 2333,2340 **** (defvar dired-no-confirm nil "A list of symbols for commands dired should not confirm. Command symbols are `byte-compile', `chgrp', `chmod', `chown', `compress', ! `copy', `delete', `hardlink', `load', `move', `print', `shell', `symlink' and ! `uncompress'.") (defun dired-mark-pop-up (bufname op-symbol files function &rest args) "Return FUNCTION's result on ARGS after showing which files are marked. --- 2340,2347 ---- (defvar dired-no-confirm nil "A list of symbols for commands dired should not confirm. Command symbols are `byte-compile', `chgrp', `chmod', `chown', `compress', ! `copy', `delete', `hardlink', `load', `move', `print', `shell', `symlink', ! `touch' and `uncompress'.") (defun dired-mark-pop-up (bufname op-symbol files function &rest args) "Return FUNCTION's result on ARGS after showing which files are marked. *************** *** 2975,2980 **** --- 2982,2991 ---- (autoload 'dired-do-chown "dired-aux" "Change the owner of the marked (or next ARG) files." + t) + + (autoload 'dired-do-touch "dired-aux" + "Change the timestamp of the marked (or next ARG) files." t) (autoload 'dired-do-print "dired-aux" Index: emacs/lisp/dired-aux.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/dired-aux.el,v retrieving revision 1.115 diff -c -r1.115 dired-aux.el *** emacs/lisp/dired-aux.el 23 Mar 2004 07:39:35 -0000 1.115 --- emacs/lisp/dired-aux.el 27 Mar 2004 10:10:02 -0000 *************** *** 186,192 **** (directory-files dir))) (defun dired-do-chxxx (attribute-name program op-symbol arg) ! ;; Change file attributes (mode, group, owner) of marked files and ;; refresh their file lines. ;; ATTRIBUTE-NAME is a string describing the attribute to the user. ;; PROGRAM is the program used to change the attribute. --- 186,192 ---- (directory-files dir))) (defun dired-do-chxxx (attribute-name program op-symbol arg) ! ;; Change file attributes (mode, group, owner, timestamp) of marked files and ;; refresh their file lines. ;; ATTRIBUTE-NAME is a string describing the attribute to the user. ;; PROGRAM is the program used to change the attribute. *************** *** 203,209 **** (dired-bunch-files 10000 (function dired-check-process) (append ! (list operation program new-attribute) (if (string-match "gnu" system-configuration) '("--") nil)) files)) --- 203,212 ---- (dired-bunch-files 10000 (function dired-check-process) (append ! (list operation program) ! (if (eq op-symbol 'touch) ! '("-t") nil) ! (list new-attribute) (if (string-match "gnu" system-configuration) '("--") nil)) files)) *************** *** 235,240 **** --- 238,249 ---- (if (memq system-type '(ms-dos windows-nt)) (error "chown not supported on this system")) (dired-do-chxxx "Owner" dired-chown-program 'chown arg)) + + (defun dired-do-touch (&optional arg) + "Change the timestamp of the marked (or next ARG) files. + This calls touch." + (interactive "P") + (dired-do-chxxx "Timestamp" dired-touch-program 'touch arg)) ;; Process all the files in FILES in batches of a convenient size, ;; by means of (FUNCALL FUNCTION ARGS... SOME-FILES...). -- Juri Linkov http://www.jurta.org/emacs/