GNU bug report logs - #10885
Replace expressions: enhance functionality when searching in filled paragraphs

Previous Next

Package: emacs;

Reported by: linuxfever <linuxfever <at> yahoo.gr>

Date: Sun, 26 Feb 2012 01:31:01 UTC

Severity: wishlist

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


Message #35 received at 10885 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 10885 <at> debbugs.gnu.org, Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Subject: Re: bug#10885: Replace expressions: enhance functionality when
	searching in filled paragraphs
Date: Tue, 28 Feb 2012 12:42:16 +0200
>> Would it make sense for replace-regexp/query-replace-regexp (and
>> other commands that read regexps from the user) to respect
>> search-whitespace-regexp, just like isearch?
>
> Good question.
>
> Quote from the docstring of `isearch-forward-regexp':
>
>  In regexp incremental searches, a space or spaces normally matches
>  any whitespace (the variable `search-whitespace-regexp' controls
>  precisely what that means).  If you want to search for a literal space
>  and nothing else, enter C-q SPC.
>
> Does anyone know why `query-replace-regexp' doesn't behave that way too?
>
> I think it should, i.e., `query-replace-regexp' should find the same
> matches that `isearch-forward-regexp' would find with the same search
> regexp.

Full agreement.  This patch for 24.2 brings query-replace closer to isearch:

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2012-02-24 22:46:57 +0000
+++ lisp/replace.el	2012-02-28 10:38:58 +0000
@@ -1752,6 +1752,7 @@ (defun perform-replace (from-string repl
 	  (if (and case-fold-search search-upper-case)
 	      (isearch-no-upper-case-p from-string regexp-flag)
 	    case-fold-search))
+	 (search-spaces-regexp (if regexp-flag search-whitespace-regexp))
          (nocasify (not (and case-replace case-fold-search)))
          (literal (or (not regexp-flag) (eq regexp-flag 'literal)))
          (search-function
@@ -2117,9 +2115,8 @@ (defun replace-highlight (match-beg matc
   (if query-replace-lazy-highlight
       (let ((isearch-string string)
 	    (isearch-regexp regexp)
-	    (search-whitespace-regexp nil)
 	    (isearch-case-fold-search case-fold)
 	    (isearch-forward t)
 	    (isearch-error nil))




This bug report was last modified 12 years and 259 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.