Subject: Re: bug#13480: 24.3.50; `C-w' from Isearch should translate newlines to spaces

From: Juri Linkov <[email-masked]>
Date: Fri, 18 Jan 2013 23:59:31 +0200

> Wait a moment.  On second thought, I think that no translation should
> be necessary at all when adding text from somewhere to the search string.

Why not?  If you save "foo<newline>bar" to the kill-ring and
yank it to the search string with `C-y' (`isearch-yank-kill')
wouldn't you want it to translate the <newline> into a space?

Anyway if you want to try this possibility (maybe it should be optional?),
here is the patch:

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-01-18 21:36:55 +0000
+++ lisp/isearch.el	2013-01-18 21:57:06 +0000
@@ -1780,6 +1780,13 @@ (defun isearch-yank-string (string)
   (if (and isearch-case-fold-search
 	   (eq 'not-yanks search-upper-case))
       (setq string (downcase string)))
+  (if (if isearch-regexp
+	  isearch-regexp-lax-whitespace
+	isearch-lax-whitespace)
+      (setq string (replace-regexp-in-string
+		    search-whitespace-regexp
+		    " "
+		    string nil t)))
   (if isearch-regexp (setq string (regexp-quote string)))
   ;; Don't move cursor in reverse search.
   (setq isearch-yank-flag t)