bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9871: `query-replace' and friends break text properties


From: Lars Ingebrigtsen
Subject: bug#9871: `query-replace' and friends break text properties
Date: Mon, 19 Aug 2019 13:37:08 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Štěpán Němec <stepnem@gmail.com> writes:

> 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 just used a face because that's visible; the same applies to any text
property.

Thinking about it a bit more, I don't really feel that
delete-then-insert semantics will be very nice as a feature, either.

(with-temp-buffer
  (insert (propertize "hello" 'face 'bold))
  (goto-char (point-min))
  (replace-regexp "hello" "hey")
  (buffer-string))

If you replace a phrase that has one face with a different phrase, if
text properties are preserved, surely you'd expect that "hey" to also be
bold.  But it won't be, since the "hello" was deleted first and then
"hey" was inserted.

So I don't really think there's any way to DWIM here that is "what I
mean", and if you want to copy over text properties in one form of
another, you have to write some code to express what you want to have
happen.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]