* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg @ 2015-03-25 3:56 Drew Adams 2015-03-25 21:50 ` Juri Linkov 0 siblings, 1 reply; 10+ messages in thread From: Drew Adams @ 2015-03-25 3:56 UTC (permalink / raw) To: 20195 Enhancement request: Typically in Dired commands that act on the marked files will act on the next PREFIX-ARG files instead, if a prefix arg is provided. This is not true of commands such as `dired-do-search', but it would be good if it were. All that is needed is to (a) add an optional argument ARG to each such command and (b) include ARG in the call to `dired-get-marked-files'. For example: (defun dired-do-search (regexp &optional arg) ; <=== Add ARG "..." (interactive "sSearch marked files (regexp): \nP") (tags-search regexp (dired-get-marked-files nil arg 'dired-nondirectory-p))) ^ | use ARG In GNU Emacs 25.0.50.1 (i686-pc-mingw32) of 2014-10-20 on LEG570 Bzr revision: 118168 rgm@gnu.org-20141020195941-icp42t8ttcnud09g Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1' ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 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 0 siblings, 1 reply; 10+ messages in thread From: Juri Linkov @ 2015-03-25 21:50 UTC (permalink / raw) To: Drew Adams; +Cc: 20195 > Enhancement request: > > Typically in Dired commands that act on the marked files will act on the > next PREFIX-ARG files instead, if a prefix arg is provided. This is not > true of commands such as `dired-do-search', but it would be good if it > were. > > All that is needed is to (a) add an optional argument ARG to each such > command and (b) include ARG in the call to `dired-get-marked-files'. > For example: > > (defun dired-do-search (regexp &optional arg) ; <=== Add ARG > "..." > (interactive "sSearch marked files (regexp): \nP") > (tags-search > regexp (dired-get-marked-files nil arg 'dired-nondirectory-p))) > ^ > | > use ARG There is a problem with `dired-do-query-replace-regexp' where a prefix arg means replace word-delimited matches. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 2015-03-25 21:50 ` Juri Linkov @ 2015-03-25 23:08 ` Drew Adams 2015-03-31 20:33 ` Juri Linkov 0 siblings, 1 reply; 10+ messages in thread From: Drew Adams @ 2015-03-25 23:08 UTC (permalink / raw) To: Juri Linkov; +Cc: 20195 > 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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 2015-03-25 23:08 ` Drew Adams @ 2015-03-31 20:33 ` Juri Linkov 2015-03-31 21:22 ` Drew Adams 2022-02-03 21:19 ` Lars Ingebrigtsen 0 siblings, 2 replies; 10+ messages in thread From: Juri Linkov @ 2015-03-31 20:33 UTC (permalink / raw) To: Drew Adams; +Cc: 20195 >> 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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 2015-03-31 20:33 ` Juri Linkov @ 2015-03-31 21:22 ` Drew Adams 2015-03-31 21:54 ` Filipp Gunbin 2022-02-03 21:19 ` Lars Ingebrigtsen 1 sibling, 1 reply; 10+ messages in thread From: Drew Adams @ 2015-03-31 21:22 UTC (permalink / raw) To: Juri Linkov; +Cc: 20195 > >> 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). ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 2015-03-31 21:22 ` Drew Adams @ 2015-03-31 21:54 ` Filipp Gunbin 2015-04-01 0:36 ` Drew Adams 0 siblings, 1 reply; 10+ messages in thread From: Filipp Gunbin @ 2015-03-31 21:54 UTC (permalink / raw) To: Drew Adams; +Cc: 20195, Juri Linkov On 31/03/2015 14:22 -0700, Drew Adams wrote: > 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 `..') Isn't it simpler to mark all files in a subdir (`* s') or just toggle everything with `t' and then invoke the command? A movement command is ok to take argument specifying a number of files, because that number is related to that command's main purpose. But here files are collected according to marks set in the buffer, so it's kind of duplication to provide the same functionality via prefix argument. Filipp ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 2015-03-31 21:54 ` Filipp Gunbin @ 2015-04-01 0:36 ` Drew Adams 2015-04-02 13:32 ` Filipp Gunbin 0 siblings, 1 reply; 10+ messages in thread From: Drew Adams @ 2015-04-01 0:36 UTC (permalink / raw) To: Filipp Gunbin; +Cc: 20195, Juri Linkov > > 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 `..') > > Isn't it simpler to mark all files in a subdir (`* s') or just toggle > everything with `t' and then invoke the command? That's already available. Nothing new about that. Useful, of course. The point is that you might currently have markings that you want to keep for a while, and you want to perform an on-the-fly operation on all files, without fiddling with any existing markings. IOW, this is an additional possibility. It takes nothing away from what you can already do. In particular, it does not change the behavior of a single `C-u' (that still acts on the next 4 files, just like `C-4'). > A movement command I don't think there has been any mention of any movement commands. What did you have in mind? > is ok to take argument specifying a number of files, > because that number is related to that command's main purpose. But here > files are collected according to marks set in the buffer, so it's kind > of duplication to provide the same functionality via prefix argument. See above. There are *many* ways to do the same thing in Dired (and elsewhere in Emacs). In and of itself, eliminating such "duplication" is a silly goal (IMHO). And it is already the case that a numeric prefix arg acts on the next (or previous) N files, ignoring any existing marks. To be clear: 1. I don't really care whether Emacs adds that feature (multiple `C-u' acts on all, ignoring markings). And that feature is not what this enhancement request is about. 2. As one user, I use that feature quite often (with Dired+). If you don't find it useful, and you prefer to always mark and unmark, that's fine by me. ;-) ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 2015-04-01 0:36 ` Drew Adams @ 2015-04-02 13:32 ` Filipp Gunbin 2015-04-02 14:01 ` Drew Adams 0 siblings, 1 reply; 10+ messages in thread From: Filipp Gunbin @ 2015-04-02 13:32 UTC (permalink / raw) To: Drew Adams; +Cc: 20195, Juri Linkov On 31/03/2015 17:36 -0700, Drew Adams wrote: >> A movement command > > I don't think there has been any mention of any movement commands. > What did you have in mind? I meant other commands like `dired-next-line', just for comparison. >> is ok to take argument specifying a number of files, >> because that number is related to that command's main purpose. But here >> files are collected according to marks set in the buffer, so it's kind >> of duplication to provide the same functionality via prefix argument. > > See above. There are *many* ways to do the same thing in Dired (and > elsewhere in Emacs). In and of itself, eliminating such "duplication" > is a silly goal (IMHO). But it's rather convenient to keep in memory that: 1) First mark files you want to process. To augment mark behaviour (e.g. mark all files in a subdir) specify prefix arg to the mark command or use a corresponding specific command. 2) Perform search/replace. To augment search/replace behavior (like toggle word searching) you have to specify prefix argument to the search/replace command. > To be clear: > > 1. I don't really care whether Emacs adds that feature (multiple `C-u' > acts on all, ignoring markings). And that feature is not what this > enhancement request is about. > > 2. As one user, I use that feature quite often (with Dired+). If > you don't find it useful, and you prefer to always mark and unmark, > that's fine by me. ;-) Yes, my comment was just a note. Filipp ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 2015-04-02 13:32 ` Filipp Gunbin @ 2015-04-02 14:01 ` Drew Adams 0 siblings, 0 replies; 10+ messages in thread From: Drew Adams @ 2015-04-02 14:01 UTC (permalink / raw) To: Filipp Gunbin; +Cc: 20195, Juri Linkov > > See above. There are *many* ways to do the same thing in Dired (and > > elsewhere in Emacs). In and of itself, eliminating such "duplication" > > is a silly goal (IMHO). > > But it's rather convenient to keep in memory that: > 1) First mark files you want to process. To augment mark behaviour > (e.g. mark all files in a subdir) specify prefix arg to the mark > command or use a corresponding specific command. > 2) Perform search/replace. To augment search/replace behavior (like > toggle word searching) you have to specify prefix argument to the > search/replace command. Yes, there are multiple ways to do the same thing in Dired. Nothing in this enhancement will prevent you from always doing things the way you prefer. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#20195: 25.0.50; Let Dired commands such as `dired-do-search' (`A') use prefix arg 2015-03-31 20:33 ` Juri Linkov 2015-03-31 21:22 ` Drew Adams @ 2022-02-03 21:19 ` Lars Ingebrigtsen 1 sibling, 0 replies; 10+ messages in thread From: Lars Ingebrigtsen @ 2022-02-03 21:19 UTC (permalink / raw) To: Juri Linkov; +Cc: 20195 Juri Linkov <juri@linkov.net> writes: >>> 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. So I think the conclusion here was that we can't really do the suggested change (which sounds pretty confusing to me, anyway), so I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-02-03 21:19 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
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.