From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs 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) Message-ID: <3f9ce496-3dc3-4ca8-adbb-0e47fa998aaa@default> References: <3126891c-8c4d-4d6f-aa97-7c2e5b4ed2d0@default> <87619oiw5f.fsf@mail.linkov.net> <87h9t0oqj1.fsf@mail.linkov.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1427837010 3215 80.91.229.3 (31 Mar 2015 21:23:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 31 Mar 2015 21:23:30 +0000 (UTC) Cc: 20195@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 31 23:23:15 2015 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 1Yd3cw-0001Og-FS for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Mar 2015 23:23:14 +0200 Original-Received: from localhost ([::1]:40657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yd3cv-0007A6-KS for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Mar 2015 17:23:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yd3co-00078z-Nz for bug-gnu-emacs@gnu.org; Tue, 31 Mar 2015 17:23:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yd3ck-00056B-Fi for bug-gnu-emacs@gnu.org; Tue, 31 Mar 2015 17:23:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yd3ck-000567-BN for bug-gnu-emacs@gnu.org; Tue, 31 Mar 2015 17:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Yd3ck-0008K5-2t for bug-gnu-emacs@gnu.org; Tue, 31 Mar 2015 17:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Mar 2015 21:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20195 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20195-submit@debbugs.gnu.org id=B20195.142783693331927 (code B ref 20195); Tue, 31 Mar 2015 21:23:02 +0000 Original-Received: (at 20195) by debbugs.gnu.org; 31 Mar 2015 21:22:13 +0000 Original-Received: from localhost ([127.0.0.1]:41483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yd3bw-0008Ir-Oe for submit@debbugs.gnu.org; Tue, 31 Mar 2015 17:22:13 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:39490) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yd3bu-0008Ie-Mz for 20195@debbugs.gnu.org; Tue, 31 Mar 2015 17:22:11 -0400 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t2VLM4Z4019656 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 31 Mar 2015 21:22:04 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t2VLM3oq024237 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 31 Mar 2015 21:22:04 GMT Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t2VLM2fv016474; Tue, 31 Mar 2015 21:22:03 GMT In-Reply-To: <87h9t0oqj1.fsf@mail.linkov.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:101091 Archived-At: > >> 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. >=20 > 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).