From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#10624: 24.0.92; default value of `dired-do-ch*' Date: Mon, 17 Sep 2012 02:48:09 +0300 Organization: JURTA Message-ID: <871ui1h6e2.fsf@mail.jurta.org> References: <0F10A2A4C6E541469381BA91CB8AEEB3@us.oracle.com> <60BBA8177B8C4157BBB5426B2F6A8204@us.oracle.com> <87392k2ml9.fsf@mail.jurta.org> <4200B2318C4140E68FA74B61375885B9@us.oracle.com> <87vcfex5bx.fsf@mail.jurta.org> <567949A5085246DD87365C10B6DF80FA@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1347840119 23204 80.91.229.3 (17 Sep 2012 00:01:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Sep 2012 00:01:59 +0000 (UTC) Cc: 10624@debbugs.gnu.org To: "Drew Adams" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 17 02:02:01 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TDOmn-00033l-0q for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Sep 2012 02:02:01 +0200 Original-Received: from localhost ([::1]:35730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDOmj-00017m-1V for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Sep 2012 20:01:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDOmg-00016o-GH for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 20:01:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDOmd-0001ON-LJ for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 20:01:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDOmd-0001OJ-Ha for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 20:01:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TDOnm-0006EE-Eh for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 20:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Sep 2012 00:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10624 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10624-submit@debbugs.gnu.org id=B10624.134784014023877 (code B ref 10624); Mon, 17 Sep 2012 00:03:02 +0000 Original-Received: (at 10624) by debbugs.gnu.org; 17 Sep 2012 00:02:20 +0000 Original-Received: from localhost ([127.0.0.1]:37840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDOn5-0006D3-Sk for submit@debbugs.gnu.org; Sun, 16 Sep 2012 20:02:20 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:36503 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDOn0-0006Ck-TN for 10624@debbugs.gnu.org; Sun, 16 Sep 2012 20:02:16 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 7EFE5451CCB0; Sun, 16 Sep 2012 17:01:02 -0700 (PDT) In-Reply-To: <567949A5085246DD87365C10B6DF80FA@us.oracle.com> (Drew Adams's message of "Sat, 15 Sep 2012 21:47:00 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64475 Archived-At: > `T c' or `T M-w' copies the tags from the current-line file. > > `T p' or `T C-y' pastes those tags to another current-line file, > adding them to any existing tags for that file. > > `T q' pastes similarly, but replaces any existing tags for the target file. > > `T > p' (`T > C-y') and `T > q' do the same pasting thing, but for the marked > files. Oh no, a whole prefix map for such an auxiliary feature. But I like the simplicity of your suggestion #2 - use the attributes of the file on the current line. It's implemented in a small patch below: === modified file 'lisp/dired-aux.el' --- lisp/dired-aux.el 2012-09-13 23:42:39 +0000 +++ lisp/dired-aux.el 2012-09-16 23:47:32 +0000 @@ -223,10 +247,17 @@ (defun dired-do-chxxx (attribute-name pr ;; OP-SYMBOL is the type of operation (for use in `dired-mark-pop-up'). ;; ARG describes which files to use, as in `dired-get-marked-files'. (let* ((files (dired-get-marked-files t arg)) - (default (and (eq op-symbol 'touch) - (stringp (car files)) - (format-time-string "%Y%m%d%H%M.%S" - (nth 5 (file-attributes (car files)))))) + ;; The source of default file attributes is the file at point. + (default-file (dired-get-filename t)) + (default (when default-file + (cond ((eq op-symbol 'touch) + (format-time-string + "%Y%m%d%H%M.%S" + (nth 5 (file-attributes default-file)))) + ((eq op-symbol 'chown) + (nth 2 (file-attributes default-file 'string))) + ((eq op-symbol 'chgrp) + (nth 3 (file-attributes default-file 'string)))))) (prompt (concat "Change " attribute-name " of %s to" (if (eq op-symbol 'touch) " (default now): " @@ -263,11 +294,15 @@ (defun dired-do-chxxx (attribute-name pr ;;;###autoload (defun dired-do-chmod (&optional arg) "Change the mode of the marked (or next ARG) files. -Symbolic modes like `g+w' are allowed." +Symbolic modes like `g+w' are allowed. +Type M-n to pull the file attributes of the file at point +into the minibuffer." (interactive "P") (let* ((files (dired-get-marked-files t arg)) - (modestr (and (stringp (car files)) - (nth 8 (file-attributes (car files))))) + ;; The source of default file attributes is the file at point. + (default-file (dired-get-filename t)) + (modestr (when default-file + (nth 8 (file-attributes default-file)))) (default (and (stringp modestr) (string-match "^.\\(...\\)\\(...\\)\\(...\\)$" modestr) @@ -297,7 +335,9 @@ (defun dired-do-chmod (&optional arg) ;;;###autoload (defun dired-do-chgrp (&optional arg) - "Change the group of the marked (or next ARG) files." + "Change the group of the marked (or next ARG) files. +Type M-n to pull the file attributes of the file at point +into the minibuffer." (interactive "P") (if (memq system-type '(ms-dos windows-nt)) (error "chgrp not supported on this system")) @@ -305,7 +345,9 @@ (defun dired-do-chgrp (&optional arg) ;;;###autoload (defun dired-do-chown (&optional arg) - "Change the owner of the marked (or next ARG) files." + "Change the owner of the marked (or next ARG) files. +Type M-n to pull the file attributes of the file at point +into the minibuffer." (interactive "P") (if (memq system-type '(ms-dos windows-nt)) (error "chown not supported on this system")) @@ -314,7 +356,9 @@ (defun dired-do-chown (&optional arg) ;;;###autoload (defun dired-do-touch (&optional arg) "Change the timestamp of the marked (or next ARG) files. -This calls touch." +This calls touch. +Type M-n to pull the file attributes of the file at point +into the minibuffer." (interactive "P") (dired-do-chxxx "Timestamp" dired-touch-program 'touch arg))