GNU bug report logs -
#9871
`query-replace' and friends break text properties
Previous Next
Reported by: Štěpán Němec <stepnem <at> gmail.com>
Date: Tue, 25 Oct 2011 22:29:01 UTC
Severity: normal
Tags: wontfix
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Sun, 18 Aug 2019 17:03:28 -0700
Lars Ingebrigtsen wrote:
> I guess the question becomes -- what text properties should be in the
> result?
>
> If you have
>
> (with-temp-buffer
> (insert (propertize "hel" 'face 'bold))
> (insert (propertize "lo" 'face 'underline))
> (goto-char (point-min))
> (replace-regexp "ell" "yes, well")
> (buffer-string))
>
> should "yes, well" be in bold or underline? Or a mix? I don't really
> think there's any solution here that will satisfy anybody.
^^^^^^^
I assume you meant "everybody".
> But I guess it would make some sense to view this as "delete the text,
> and then pretend we're inserting text as if by `self-insert-command'",
> which would make the new text bold here.
Yes it would. I also think that the straightforward case where all the
text has the same value for a property will be much more frequent than
your contrived example (note my property wasn't even visible at all; in
case of font-locking for example I'd expect the result to get
refontified as usual anyway).
> I don't know... all solutions here seem kinda ad hoc, so perhaps the
> current behaviour is the least surprising. Any opinions?
I definitely don't consider it the least surprising, but I guess you're
rather asking for the opinion of other people.
On Sun, 18 Aug 2019 17:57:18 -0700 (PDT)
Drew Adams wrote:
[...]
> If a user specifies replacement text that has
> text properties then it should be used as is:
> its properties should remain when it takes the
> place of text in the buffer.
[...]
Sure. For the yanking (i.e., interactive) case there's also
`yank-handled-properties' and `yank-excluded-properties'.
--
Štěpán
This bug report was last modified 5 years and 279 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.