all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Štěpán Němec" <stepnem@gmail.com>
Cc: 9871@debbugs.gnu.org
Subject: bug#9871: `query-replace' and friends break text properties
Date: Sun, 18 Aug 2019 17:03:28 -0700	[thread overview]
Message-ID: <878srq3ttb.fsf@mouse.gnus.org> (raw)
In-Reply-To: <87fwig4sss.fsf@gmail.com> ("Štěpán Němec"'s message of "Wed, 26 Oct 2011 00:20:35 +0200")

Š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	other threads:[~2019-08-19  0:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25 22:20 bug#9871: `query-replace' and friends break text properties Štěpán Němec
2019-08-19  0:03 ` Lars Ingebrigtsen [this message]
2019-08-19  0:57   ` Drew Adams
2019-08-19  8:43   ` Štěpán Němec
2019-08-19 20:37     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878srq3ttb.fsf@mouse.gnus.org \
    --to=larsi@gnus.org \
    --cc=9871@debbugs.gnu.org \
    --cc=stepnem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.