unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Juri Linkov'" <juri@jurta.org>
Cc: 10624@debbugs.gnu.org
Subject: bug#10624: 24.0.92; default value of `dired-do-ch*'
Date: Fri, 14 Sep 2012 17:37:10 -0700	[thread overview]
Message-ID: <4200B2318C4140E68FA74B61375885B9@us.oracle.com> (raw)
In-Reply-To: <87392k2ml9.fsf@mail.jurta.org>

> This request for enhancement is implemented with the following patch
> where the user will be able to mark the target file with the mark.
> Otherwise, the marked file is used as target only when it is 
> a single file in the list of marked files:
> 
> +	 (default-file (or (if (and transient-mark-mode mark-active)
> +			       (save-excursion (goto-char (mark t))
> +					        (dired-get-filename t t)))
> +			   (if (and (= (length files) 1)
> +				    (stringp (car files)))
> +			       (car files))))
>  	 (default (and (eq op-symbol 'touch)
> -		       (stringp (car files))
> +		       default-file
>  		       (format-time-string "%Y%m%d%H%M.%S"
> -					   (nth 5 
> (file-attributes (car files))))))
> +					   (nth 5 

Thanks for working on this, but I'm not crazy about that approach at all, IIUC.
And it does not implement the enhancement requested.

The Emacs mark is not something that is very useful in this context, IMO.  It's
not obvious and visible.  And why use the mark only when transient-mark-mode is
enabled?  That obviates use of the region for something more useful in Dired
(e.g., Dired-marking all files in the region).

What's more, if I read your code correctly, when there is no active mark you are
still picking up the first of the marked files and using its data as the
default.

That is precisely the behavior that I filed this bug against.  It makes no sense
to use the 1st of the marked files, or the 13th, or any other file except the
current-line file.  That _is_ this bug.

I stand by my alternative suggestions:

1. Do not provide any default value at all.  (Easiest to do, but least
helpful improvement.)

2. Minimal, easy to do now: Use the attributes of the file on the current line,
providing them as the default for the marked files according to the particular
command (mod time, various permission fields, etc.).

3. More complex, but more useful: Let the user hit a key to "copy" the
attributes of a given file (on the current line - the "source" file), as if to a
clipboard.  Then use those attributes for subsequent "paste" operations,
transferring the appropriate attributes (mod time, various permission fields,
etc.) to the "target" (i.e., marked) files according to the particular command.

For example (for #3), for `dired-do-chmod', the file permissions copied from the
source file would be the default value.  For `dired-do-touch', the mod time of
the source file would be the default value for the operation.  And so on.

See the original bug report for more details.

The point is to (a) have a reasonable source-file choice from which attributes
are taken for the default and (b) push those attributes to the marked files as
defaults for an operation, in a operation-pertinent way.

If you cannot or do not want to do something like #3, please do #1 or something
like #2.  In the latter case (#1 or #2), or if you decide to do something
altogether different from what I suggested, please keep this enhancement request
open.

Thx.






  reply	other threads:[~2012-09-15  0:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 15:35 bug#10624: 24.0.92; default value of `dired-do-ch*' Drew Adams
2012-01-27 16:23 ` Drew Adams
2012-09-14 23:47   ` Juri Linkov
2012-09-15  0:37     ` Drew Adams [this message]
2012-09-15 22:50       ` Juri Linkov
2012-09-16  4:47         ` Drew Adams
2012-09-16 23:48           ` Juri Linkov
2012-09-17  0:39             ` Drew Adams
2012-09-18 23:22             ` Juri Linkov
2012-09-15 22:54       ` Juri Linkov
2012-09-16  4:47         ` Drew Adams
2012-09-16 23:45           ` bug#10624: Dired-marking all files in the region Juri Linkov
2012-11-22  9:49             ` Juri Linkov
2012-11-22 15:27               ` Drew Adams
2012-11-23  7:51                 ` Juri Linkov
2012-11-23 17:12                   ` Drew Adams
2012-11-25  9:16                     ` Juri Linkov
2012-11-25 15:49                       ` Drew Adams
2012-11-25 16:12                         ` Juri Linkov
2012-11-25 17:02                           ` Drew Adams
2012-11-22 15:40               ` Stefan Monnier
2012-11-23  7:59                 ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4200B2318C4140E68FA74B61375885B9@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=10624@debbugs.gnu.org \
    --cc=juri@jurta.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).