branch: elpa/casual
commit a762521e06c618ca5cd3915b56919977d0bfd017
Merge: 1002306e9d f009c13b35
Author: Charles Choi <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #480 from
kickingvegas/454-add-project-query-replace-regexp-to-dired-search-replace-menu
Add project-query-replace-regexp
---
docs/casual.texi | 6 +++++-
docs/dired.org | 19 ++++++++++---------
docs/images/casual-dired-search-replace.png | Bin 49279 -> 51886 bytes
lisp/casual-dired-utils.el | 4 +++-
tests/test-casual-dired-utils.el | 4 +++-
5 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/docs/casual.texi b/docs/casual.texi
index 6b27556e9d..31bedafe93 100644
--- a/docs/casual.texi
+++ b/docs/casual.texi
@@ -2405,7 +2405,7 @@ Search and replace in multiple marked files using the
“@kbd{/} Search & Replac
While most Dired commands use Emacs-style regular expression syntax
(@ref{Regular Expressions,,,elisp,})@comma{} there are commands that use
@strong{grep}-style regex syntax instead as it makes direct calls to
@code{grep}. This syntax is dependent on the @code{grep} implementation that is
installed and used by Emacs.
-@multitable {aaa} {aaaaaaaaaaaaaaaaaaaaaaaaaa}
{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaa}
+@multitable {aaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaa}
@headitem Key
@tab Label
@tab Command
@@ -2426,6 +2426,10 @@ While most Dired commands use Emacs-style regular
expression syntax (@ref{Regula
@tab Query regexp and replace…
@tab dired-do-query-replace-regexp
@tab
+@item p
+@tab Project query regexp and replace…
+@tab project-query-replace-regexp
+@tab
@item g
@tab Find regex…
@tab dired-do-find-regexp
diff --git a/docs/dired.org b/docs/dired.org
index 10797e3bd6..819a1717ef 100644
--- a/docs/dired.org
+++ b/docs/dired.org
@@ -343,15 +343,16 @@ Search and replace in multiple marked files using the
“{{{kbd(/)}}} Search & R
While most Dired commands use Emacs-style regular expression syntax
([[info:elisp#Regular Expressions]]), there are commands that use *grep*-style
regex syntax instead as it makes direct calls to ~grep~. This syntax is
dependent on the ~grep~ implementation that is installed and used by Emacs.
-| Key | Label | Command | Notes
|
-|-----+----------------------------+----------------------------------+------------|
-| C-s | I-search… | dired-do-isearch |
|
-| M-s | I-search regexp… | dired-do-isearch-regexp |
|
-| s | Search first regexp match… | dired-do-search |
|
-| r | Query regexp and replace… | dired-do-query-replace-regexp |
|
-| g | Find regex… | dired-do-find-regexp | grep
regex |
-| G | Find regex and replace… | dired-do-find-regexp-and-replace | grep
regex |
-| f | Find in files (rgrep)… | rgrep | grep
regex |
+| Key | Label | Command |
Notes |
+|-----+-----------------------------------+----------------------------------+------------|
+| C-s | I-search… | dired-do-isearch |
|
+| M-s | I-search regexp… | dired-do-isearch-regexp |
|
+| s | Search first regexp match… | dired-do-search |
|
+| r | Query regexp and replace… | dired-do-query-replace-regexp |
|
+| p | Project query regexp and replace… | project-query-replace-regexp |
|
+| g | Find regex… | dired-do-find-regexp |
grep regex |
+| G | Find regex and replace… | dired-do-find-regexp-and-replace |
grep regex |
+| f | Find in files (rgrep)… | rgrep |
grep regex |
*** Dired Utilities (Utils›)
diff --git a/docs/images/casual-dired-search-replace.png
b/docs/images/casual-dired-search-replace.png
index 3f108ea286..9b33e18449 100644
Binary files a/docs/images/casual-dired-search-replace.png and
b/docs/images/casual-dired-search-replace.png differ
diff --git a/lisp/casual-dired-utils.el b/lisp/casual-dired-utils.el
index af900e59db..11de78dec6 100644
--- a/lisp/casual-dired-utils.el
+++ b/lisp/casual-dired-utils.el
@@ -27,6 +27,7 @@
(require 'dired-x)
(require 'checkdoc)
(require 'casual-lib)
+(require 'project)
(require 'casual-dired-variables)
(defconst casual-dired-unicode-db
@@ -102,7 +103,8 @@ ASCII-range string."
("M-s" "I-search regexp…" dired-do-isearch-regexp)
("s" "Search first regexp match…" dired-do-search)]
["Replace in Files"
- ("r" "Query regexp and replace…" dired-do-query-replace-regexp)]]
+ ("r" "Query regexp and replace…" dired-do-query-replace-regexp)
+ ("p" "Project query regexp and replace…" project-query-replace-regexp)]]
["grep-style regex"
[("g" "Find regex…" dired-do-find-regexp)
diff --git a/tests/test-casual-dired-utils.el b/tests/test-casual-dired-utils.el
index e0fbffda5b..03490c477c 100644
--- a/tests/test-casual-dired-utils.el
+++ b/tests/test-casual-dired-utils.el
@@ -1,6 +1,6 @@
;;; test-casual-dired-utils.el --- Casual Dired Utils Tests -*-
lexical-binding: t; -*-
-;; Copyright (C) 2024-2025 Charles Y. Choi
+;; Copyright (C) 2024-2026 Charles Y. Choi
;; Author: Charles Choi <[email protected]>
;; Keywords: tools
@@ -53,6 +53,7 @@
(casualt-mock #'dired-do-isearch-regexp)
(casualt-mock #'dired-do-search)
(casualt-mock #'dired-do-query-replace-regexp)
+ (casualt-mock #'project-query-replace-regexp)
(casualt-mock #'dired-do-find-regexp-and-replace)
(casualt-mock #'rgrep))
@@ -61,6 +62,7 @@
(:binding "M-s" :command dired-do-isearch-regexp)
(:binding "s" :command dired-do-search)
(:binding "r" :command dired-do-query-replace-regexp)
+ (:binding "p" :command project-query-replace-regexp)
(:binding "g" :command dired-do-find-regexp)
(:binding "G" :command dired-do-find-regexp-and-replace)
(:binding "f" :command rgrep))))