Emacs: dired-do-query-replace-regex Replace ALL (fixed)
[Note: The following is a suggestion sent to FSF official emacs bug channel, on 2008-05-17, as bug#267. This suggestion is implemented in emacs 23.1, released on 2009-07. See Emacs 23.1 Features (released 2009-07).]
When in dired mode in the processing of doing dired-do-query-replace- regexp (shortcut Q), it offers the ability to do replacement without asking on the current file, by pressing the ! key, but it would be nice to have:
- ① the ability to do ALL replacements on ALL files without further asking.
- ② the ability to not do any replacement on the current file.
I use dired-do-query-replace-regexp few times a week, typically on tens of files, but maybe once in a month i do it over hundreds or thousands of files on a website.
Often, after some replacement, it becomes obvious that it is safe to do ALL replacement for ALL files. When this is needed, typically i can just hold down the ! key. But when the number of files is hundreds or more, typically there will be several 5 second delays where i assume emacs is doing garbage collection. The bottom line is that, holding down ! is not a good solution because i end up having to wait a total of maybe 20 or 30 seconds during the whole operation.
For this reason, i often abort the operation, then switch to a Perl or Python script i've written that does blind find replace on all files. This will finish the job on thousands of files within 5 seconds. But I couldn't reply on this since often i need interactively see and confirm the replacements, which emacs provides. (emacs also lets me view the change file afterward or decide to save them… etc, which i won't be able to do with perl…)
So, it would be nice, if emacs's dired-do-query-replace-regexp offer the option to do all replacement on all files.
Perhaps this can be introduced as pressing the @ key.
For suggestion item (2), the scenario is that sometimes i have a big file and it is apparent that i don't want any replacement to happen on that file. As things are, i have to repeatedly pressing n while paying attention not to go over to the next file. This is a tiring process.
dired-do-query-replace-regexp is very nice and i've been using it for 2 years. For just tens of files the above isn't a problem. But when doing few hundred files, and on tens of replacement pairs (i.e. using dired-do-query-replace-regexp tens of times, each time on hundreds of files), the above features seems a very good one to have. It seems also a logical feature complementing the various recursive edit and edit-replacement-text currently provided by emacs.
PS some background… I'm doing on static websites, which has few hundred or thousand files, such as systematically changing a style markup, etc. In the past 2 days, i spent entire 2 days using dired-do- query-replace-regexp (in combination with Perl and Python script).
- Emacs Modernization: Simple Changes Emacs Should Adopt
- Why Emacs Keys are Painful
- Emacs: Problems of the Scratch Buffer
- Emacs M-key Notation vs Alt+key Notation
- Emacs Menu Usability Problem
- Emacs Mode Line Problem
- Emacs cua-mode Problems
- Emacs: Inconsistency of Search Features
- Problems of grep in Emacs
- Emacs: Usability Problems of Mode Documentation
- Problems of Emacs Manual
- Emacs Manual Sucks by Examples
- Emacs: kill-buffer Induces Buffer Accumulation
- Emacs Spell Checker Problems
- Emacs Form Feed ^L
- Emacs: Single Key to Delete Whole Line
- Emacs HTML Mode Sucks
- Emacs Does Not Support Viewing Images Files In Windows
- Emacs Should Adopt HTML as Texinfo Replacement
- Emacs Should Support HTML Mail
- Problems of Emacs's “man” Command
- Emacs Lisp Mode Syntax Coloring Problem
- Emacs AutoHotkey Mode Problems
- Emacs Lisp: Ban Syntax Table
- Emacs: Make elisp-index-search use Current Symbol
- Emacs GNU Texinfo Problems; Invalid HTML
- A Record of Frustration in IT Industry; Disappearing FSF URLs, 2006
- Emacs Manual Node Persistency Issues
- Emacs: dired-do-query-replace-regex Replace ALL (fixed)
- Problems of Emacs Supporting Obsolete Systems
- Emacs Lisp: Function to Copy/Delete a Dir Recursively (fixed)
- Thoughts on Common Lisp Scheme Lisp Based Emacs
- Text Editors Popularity and Market Research
- Text Editor's Cursor Movement Behavior (emacs, vi, Notepad++)
- Emacs: Toggle Letter Case 🚀
- Emacs: Select Line, between Quotes, Extend Selection 🚀
- Emacs: isearch Current Word 🚀
- Emacs: Reformat Lines (Hard-Wrap lines, fill) 🚀