[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9871: `query-replace' and friends break text properties
From: |
Štěpán Němec |
Subject: |
bug#9871: `query-replace' and friends break text properties |
Date: |
Mon, 19 Aug 2019 10:43:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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