all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: matt@mundell.ukfsn.org, emacs-devel@gnu.org
Subject: Re: dired-do-touch
Date: Sat, 27 Mar 2004 12:59:21 +0200	[thread overview]
Message-ID: <87k7165zee.fsf@mail.jurta.org> (raw)
In-Reply-To: <E1B76jq-0005I7-5b@fencepost.gnu.org> (Richard Stallman's message of "Sat, 27 Mar 2004 00:52:10 -0500")

Richard Stallman <rms@gnu.org> 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)))
  \f
  (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)))
  \f
  (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/

  reply	other threads:[~2004-03-27 10:59 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-20 19:05 dired-do-touch Matthew Mundell
2004-03-21 13:31 ` dired-do-touch Ehud Karni
2004-03-21 18:27   ` dired-do-touch Eli Zaretskii
2004-03-21 16:50 ` dired-do-touch Eli Zaretskii
2004-03-21 19:21 ` dired-do-touch Richard Stallman
2004-03-25 14:54 ` dired-do-touch Juri Linkov
2004-03-25 21:07   ` dired-do-touch Juri Linkov
2004-03-27  5:52   ` dired-do-touch Richard Stallman
2004-03-27 10:59     ` Juri Linkov [this message]
2004-03-27 12:17       ` dired-do-touch Eli Zaretskii
2004-03-27 13:06         ` dired-do-touch Juri Linkov
2004-03-27 16:13           ` dired-do-touch Matthew Mundell
2004-03-27 17:52             ` dired-do-touch Juri Linkov
2004-03-28 19:59               ` dired-do-touch Matthew Mundell
2004-03-29  6:59                 ` dired-do-touch Eli Zaretskii
2004-03-29 19:15                   ` dired-do-touch Juri Linkov
2004-03-29 22:24                     ` dired-do-touch Andreas Schwab
2004-03-30  6:50                     ` dired-do-touch Eli Zaretskii
2004-03-30  9:59                       ` dired-do-touch Juri Linkov
2004-03-30 12:35                         ` dired-do-touch Matthew Mundell
2004-03-30 19:43                           ` dired-do-touch Stefan Monnier
2004-03-31  3:14                           ` dired-do-touch Juri Linkov
2004-03-31 15:53                             ` dired-do-touch Matthew Mundell
2004-03-31 15:04                           ` dired-do-touch Richard Stallman
2004-03-31 19:42                             ` dired-do-touch Stefan Monnier
2004-04-02  6:01                               ` dired-do-touch Richard Stallman
2004-04-23 20:57                                 ` dired-do-touch Stefan Monnier
2004-03-30 16:18                     ` dired-do-touch Matthew Mundell
2004-03-29 19:27                 ` dired-do-touch Juri Linkov
2004-03-27 16:09         ` dired-do-touch Matthew Mundell
2004-03-28  4:25       ` dired-do-touch Richard Stallman
     [not found] <20040321165848.0DB3C662F8@imf.math.ku.dk>
2004-03-21 18:12 ` dired-do-touch Lars Hansen
2004-03-22 23:45   ` dired-do-touch Matthew Mundell
2004-03-23  6:31     ` dired-do-touch Eli Zaretskii
2004-03-23 21:48       ` dired-do-touch Matthew Mundell
2004-03-24  7:11         ` dired-do-touch Eli Zaretskii
2004-03-24 10:57           ` dired-do-touch Kim F. Storm
2004-03-24 11:10             ` dired-do-touch Eli Zaretskii
2004-03-24 12:22               ` dired-do-touch Kim F. Storm
2004-03-24 21:59                 ` dired-do-touch Matthew Mundell
2004-03-25  7:10                   ` dired-do-touch Eli Zaretskii
2004-03-24 20:57           ` dired-do-touch Matthew Mundell
2004-03-25  2:00         ` dired-do-touch Richard Stallman
2004-03-26 18:31           ` dired-do-touch Matthew Mundell
2004-03-28  1:36             ` dired-do-touch Richard Stallman
2004-03-28  1:36             ` dired-do-touch Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2004-04-24 15:28 dired-do-touch Lars Hansen
2004-04-24 17:01 ` dired-do-touch Eli Zaretskii
2004-04-24 17:04   ` dired-do-touch Lars Hansen
2007-08-23 15:07 dired-do-touch Sean Sieger
2007-08-23 15:36 ` dired-do-touch Peter Dyballa
     [not found]   ` <4135e3e50708231035pbc95223m8988de9677ec3c4c@mail.gmail.com>
2007-08-23 18:06     ` dired-do-touch Peter Dyballa
     [not found]     ` <mailman.5210.1187892398.32220.help-gnu-emacs@gnu.org>
2007-08-24  6:32       ` dired-do-touch Fabian Braennstroem
2007-08-24 16:44         ` dired-do-touch Sean Sieger
     [not found]         ` <mailman.5260.1187973928.32220.help-gnu-emacs@gnu.org>
2007-08-24 21:15           ` dired-do-touch Fabian Braennstroem
2007-08-23 17:39 ` dired-do-touch Sean Sieger
     [not found] <mailman.5195.1187881677.32220.help-gnu-emacs@gnu.org>
2007-08-23 15:23 ` dired-do-touch Sven Joachim
2007-08-23 17:43   ` dired-do-touch Sean Sieger
2007-08-23 20:06 dired-do-touch martin rudalics
2007-08-23 22:35 ` dired-do-touch Sean Sieger
2011-07-28 12:57 [PATCH] fix goto-line Jose E. Marchesi
2011-07-28 14:07 ` Juanma Barranquero
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           ` dired-do-touch (was: [PATCH] fix goto-line) Juri Linkov
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k7165zee.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=matt@mundell.ukfsn.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.