bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Juri Linkov
Subject: bug#13480: 24.3.50; `C-w' from Isearch should translate newlines to spaces
Date: Thu, 17 Jan 2013 23:27:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

> So I propose that the command `isearch-yank-word-or-char' (C-w in
> Isearch) DTRT in this case, i.e., when `search-whitespace-regexp' is
> non-nil, translate the <newline> into a simple space when pulling text
> from the buffer into the search string.

It makes sense to translate the <newline> into a simple space
only when `search-whitespace-regexp' contains <newline>
such as e.g. (setq search-whitespace-regexp "\\(\\s-\\|\n\\)+")
Otherwise, the translated space won't match <newline>.
It is possible to do this with the patch below.

But then you might also want to translate the <newline> into a space
in `isearch-yank-line' as well?  And maybe also in `isearch-yank-kill'?

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el     2013-01-16 21:45:20 +0000
+++ lisp/isearch.el     2013-01-17 21:27:35 +0000
@@ -1837,7 +1837,14 @@ (defun isearch-yank-internal (jumpform)
    (save-excursion
      (and (not isearch-forward) isearch-other-end
          (goto-char isearch-other-end))
-     (buffer-substring-no-properties (point) (funcall jumpform)))))
+     (if (if isearch-regexp
+            isearch-regexp-lax-whitespace
+          isearch-lax-whitespace)
+        (replace-regexp-in-string
+         search-whitespace-regexp
+         " "
+         (buffer-substring-no-properties (point) (funcall jumpform)) nil t)
+       (buffer-substring-no-properties (point) (funcall jumpform))))))
 
 (defun isearch-yank-char-in-minibuffer (&optional arg)
   "Pull next character from buffer into end of search string in minibuffer."





reply via email to

[Prev in Thread] Current Thread [Next in Thread]