all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Dani Moncayo <dmoncayo@gmail.com>
Cc: Kevin Rodgers <kevin.d.rodgers@gmail.com>, 10885@debbugs.gnu.org
Subject: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs
Date: Tue, 28 Feb 2012 12:42:16 +0200	[thread overview]
Message-ID: <87d38z1bp3.fsf@mail.jurta.org> (raw)
In-Reply-To: <CAH8Pv0hgNbUyn4=A=tneU_BKUAJyMNxJxJEcX1BCG8gh5QPbjw@mail.gmail.com> (Dani Moncayo's message of "Tue, 28 Feb 2012 11:04:55 +0100")

>> 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))





  parent reply	other threads:[~2012-02-28 10:42 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-26  1:02 bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs linuxfever
2012-02-26  1:57 ` Glenn Morris
2012-02-26  7:16   ` Kevin Rodgers
2012-02-28 10:04     ` Dani Moncayo
2012-02-28 10:09       ` Dani Moncayo
2012-02-28 10:42       ` Juri Linkov [this message]
2012-02-29  0:12         ` Glenn Morris
2012-02-29  0:41           ` Juri Linkov
2012-03-11  8:59             ` Dani Moncayo
2012-03-11 10:48               ` Juri Linkov
2012-09-02  9:45                 ` Juri Linkov
2012-09-02 11:32                   ` Juri Linkov
2012-09-05  8:38                     ` Juri Linkov
2012-09-05 14:38                       ` Stefan Monnier
2012-09-06  8:54                         ` Juri Linkov
2012-09-06 15:54                           ` Dani Moncayo
2012-09-06 16:50                             ` Juri Linkov
2012-09-06 17:39                               ` Dani Moncayo
2012-09-06 19:11                                 ` Juri Linkov
2012-09-06 19:15                                   ` Juri Linkov
2012-09-06 19:45                                   ` Dani Moncayo
2012-09-06 20:21                                     ` Dani Moncayo
2012-09-06 21:25                               ` Stefan Monnier
2012-09-07  8:33                                 ` Dani Moncayo
2012-09-07  9:28                                   ` Juri Linkov
2012-09-09 22:15                                     ` Juri Linkov
2012-09-05 14:39                       ` Stefan Monnier
2012-02-26 10:10   ` linuxfever
2012-02-26 21:22     ` Stefan Monnier
2012-02-26 10:17 ` Dani Moncayo
2012-02-27 10:58   ` Juri Linkov
2012-02-27 13:27     ` Dani Moncayo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d38z1bp3.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=10885@debbugs.gnu.org \
    --cc=dmoncayo@gmail.com \
    --cc=kevin.d.rodgers@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.