bug#81583: 32.0.50; Optional preview of the replacement text while typing it

Juri Linkov <[email protected]>
Newsgroups gmane.emacs.bugs
Organization LINKOV.NET
Message-ID <[email protected]>
>>  (defface query-replace-preview
>> -  '((t (:inherit query-replace)))
>> +  '((t (:inherit diff-added)))
>>    "Face for the preview of the replacement text.
>>  Used while reading the replacement string of `query-replace' and
>>  friends when `query-replace-show-preview' is non-nil."
>>    :group 'matching
>>    :version "32.1")
>>  
>> +(defface query-replace-preview-match
>> +  '((t (:inherit diff-removed)))
>> +  "Face for the matched text in the preview.
>> +Used for the left half of the preview when `query-replace-show-preview'
>> +is `both'."
>> +  :group 'matching
>> +  :version "32.1")
>
> The default value of these two faces sounds strange to me.  In
> particular, why shouldn't query-replace-preview-match inherit from
> query-replace? it shows the same string, no?

Using diff faces to show the change looks nicer when
'query-replace-show-preview' is customized to 'both'.

>> +(defun replace-preview--propertize (text face)
>> +  "Return a copy of TEXT with all its text properties replaced by FACE.
>
> Removing all text properties is a bit too radical, no?  There could be
> properties which have no effect on display whatsoever.  How about
> removing only the properties that can get in the way?

While testing the patch, I noticed that it preserved the text properties
that is the right thing to do, so for example, text in comments used
the comment face with the comment foreground color merged with diff-mode
background colors.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.