Subject: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs

From: Juri Linkov <[email-masked]>
Date: Mon, 27 Feb 2012 12:58:22 +0200

>> In a nutshell, I believe enhancing the functionality of the replacement
>> functions to accommodate for expressions split in two lines, would make
>> their usability so much easier.
>
> Adding a "word-type mode" to query-replace (analogous of the word-type
> mode of Isearch) would do what you want, and would be a good feature,
> IMO.
>
> That is: add an option to query-replace whereby the matches are found
> using a word-type search, instead of the (default) normal search.

There exists already a "word query-replace mode" with `C-u M-%',
but currently it is very limited.

To bring it in sync with the "word search" is possible
with this patch (for 24.2):

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2012-02-24 22:46:57 +0000
+++ lisp/replace.el	2012-02-27 10:55:04 +0000
@@ -1813,10 +1813,7 @@ (defun perform-replace (from-string repl
 
     (if delimited-flag
 	(setq search-function 're-search-forward
-	      search-string (concat "\\b"
-				    (if regexp-flag from-string
-				      (regexp-quote from-string))
-				    "\\b")))
+	      search-string (word-search-regexp from-string)))
     (when query-replace-lazy-highlight
       (setq isearch-lazy-highlight-last-string nil))