all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Juri Linkov <juri@linkov.net>
Cc: 20195@debbugs.gnu.org
Subject: bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg
Date: Tue, 31 Mar 2015 14:22:00 -0700 (PDT)	[thread overview]
Message-ID: <3f9ce496-3dc3-4ca8-adbb-0e47fa998aaa@default> (raw)
In-Reply-To: <87h9t0oqj1.fsf@mail.linkov.net>

> >> There is a problem with `dired-do-query-replace-regexp' where a prefix
> >> arg means replace word-delimited matches.
> >
> > So make it so that only a negative prefix arg means delimited.
> 
> A negative prefix arg means backward replacement.

I didn't think so. `d-d-q-r-r' uses `tags-query-replace', and I don't see
where that allows for traversing backward.

I do agree that `d-d-q-r-r' presents a bit of an anomaly, where we will
likely need to make a judgment call (& compromise), to accommodate
whatever is deemed to be the most important subset of possibilities.

FWIW -

Im my own code (dired+.el), I long ago modified
`dired-map-over-marks' and `dired-get-marked-files' to let multiple
plain `C-u' act on all files, ignoring marks, as follows:

 Optional second argument ARG specifies files to use instead of marked.
  Usually ARG comes from the command's prefix arg.
  If ARG is an integer, use the next ARG files (previous -ARG, if < 0).
  If ARG is a cons with element 16, 64, or 256, corresponding to
   `C-u C-u', `C-u C-u C-u', or `C-u C-u C-u C-u', then use all files
   in the Dired buffer, where:
     16 includes NO directories (including `.' and `..')
     64 includes directories EXCEPT `.' and `..'
    256 includes ALL directories (including `.' and `..')
  If ARG is otherwise non-nil, use the current file.

So, for example, my version of `dired-do-isearch-regexp' and other
such commands uses a prefix arg this way:

 A prefix argument ARG specifies files to use instead of those marked.
  * An integer means use the next ARG files (previous -ARG, if < 0).
  * Two or more `C-u' (e.g. `C-u C-u') means ignore any marks and use
    all files in the Dired buffer.
  * Any other prefix arg means use the current file.

(For `dired-do-*' commands that do not act on directories, all
multiples of `C-u' act the same as `C-u C-u': `.' and `..' are
ignored.)

But yes, `dired-do-query-replace-regexp' required a compromise.
This is what I ended up with, but I'm not too pleased that it is
an exception to the rule, and I'm not sure it is the best
compromise:

---

 NOTE: A prefix arg for this command acts differently than for other
 commands, so that you can use it to request word-delimited matches.

 With a prefix argument:
  * An odd number of plain `C-u': act on the marked files, but replace
    only word-delimited matches.
  * More than one plain `C-u': act on all files, ignoring whether any
    are marked.
  * Any other prefix arg: Act on the next numeric-prefix files.

 So for example:
  * `C-u C-u C-u': act on all files, replacing word-delimited matches.
  * `C-u 4': act on the next 4 files.  `C-4' means the same thing.
  * `C-u': act on the marked files, replacing word-delimited matches.

---

Anyway, the point is that I think Emacs can do a bit better wrt the
prefix arg for such commands.  I'm open to better suggestions wrt
`dired-do-query-replace-regexp'.  And I'm OK, for this bug report,
with whatever you decide.

And should you happen to decide to add multiple `C-u' behavior to the
vanilla code, and if it lets you do whatever you can do with dired+.el,
then I'll be happy to drop that code from dired+.el (except for older
Emacs versions). ;-)

And thanks for taking a look at this, whatever you decide.  Personally,
I never use a prefix arg to act on the next (or previous) N files, but
I do often use multiple `C-u C-u' to act on all files (regardless of
any markings).





  reply	other threads:[~2015-03-31 21:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25  3:56 bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg Drew Adams
2015-03-25 21:50 ` Juri Linkov
2015-03-25 23:08   ` Drew Adams
2015-03-31 20:33     ` Juri Linkov
2015-03-31 21:22       ` Drew Adams [this message]
2015-03-31 21:54         ` Filipp Gunbin
2015-04-01  0:36           ` Drew Adams
2015-04-02 13:32             ` Filipp Gunbin
2015-04-02 14:01               ` Drew Adams
2022-02-03 21:19       ` Lars Ingebrigtsen

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=3f9ce496-3dc3-4ca8-adbb-0e47fa998aaa@default \
    --to=drew.adams@oracle.com \
    --cc=20195@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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.