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: Sun, 18 Aug 2019 17:03:28 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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

> emacs -Q
> (put-text-property (point-min) (point) 'oh-no! t)
> M-<
> M-% buffer RET fluffer RET y
>
> Whoops, the property's gone in the replaced text.
>
> The replacement commands should honour text properties just as
> `self-insert-command' does.

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.

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.

I don't know...  all solutions here seem kinda ad hoc, so perhaps the
current behaviour is the least surprising.  Any opinions?

-- 
(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]