--- Begin Message ---
Subject: |
Replace expressions: enhance functionality when searching in filled paragraphs |
Date: |
Sat, 25 Feb 2012 17:02:45 -0800 (PST) |
Hello,
This is more of a suggestion/wish, rather than an actual bug, which could
enhance significantly replacement functionality in a filled text (region,
paragraph, buffer, etc).
Currently it seems that when trying to replace an expression comprising two
words, say for example 'replace this', then the functions 'replace-string'
or 'replace-regexp' fail to locate the expression when that is split along
two lines in the text, i.e., in the above example when the word 'replace' is
at the end of one line, and the word 'this' is at the beginning of the next
one.
I learned today
(http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-td33390451.html#a33392628)
that there are ways around this by specifying a newline between words, for
example, searching for 'replace C-q C-j this' would actually do the work but
there are two problems with this. First, it is inefficient as it takes
longer to type, and second it would replace only the expressions that are
actually split in two lines and leave out the ones separated by a normal
SPC.
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. Thanks for your time and for such a great
and versatile editor!
--
View this message in context:
http://old.nabble.com/Replace-expressions%3A-enhance-functionality-when-searching-in-filled-paragraphs-tp33392837p33392837.html
Sent from the Emacs - Bugs mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#10885: Replace expressions: enhance functionality when searching in filled paragraphs |
Date: |
Thu, 06 Sep 2012 11:54:12 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) |
>> Since query-replace is going in the direction of closer integration with
>> isearch, the right thing would be to get its search function from isearch.
>
> Agreed.
Installed. Since this enhancement request is completely implemented,
and all mentioned problems are fixed, I'm closing it.
>> (defun replace-highlight (match-beg match-end range-beg range-end
>> - string regexp case-fold)
>> + string regexp word case-fold)
>
> Maybe we should use an isearch-state argument?
Actually these arguments correspond to the variables of `perform-replace',
not isearch state. So I renamed them to the names used in `perform-replace',
causing isearch-related let-bindings in `replace-highlight' to be
the exact copy of let-bindings in `perform-replace'.
--- End Message ---