From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#9871: `query-replace' and friends break text properties Date: Sun, 18 Aug 2019 17:03:28 -0700 Message-ID: <878srq3ttb.fsf@mouse.gnus.org> References: <87fwig4sss.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="3654"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 9871@debbugs.gnu.org To: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 19 02:04:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hzV9e-0000q2-C0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Aug 2019 02:04:10 +0200 Original-Received: from localhost ([::1]:43814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzV9c-0001Fj-JS for geb-bug-gnu-emacs@m.gmane.org; Sun, 18 Aug 2019 20:04:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56146) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzV9X-0001EO-7f for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 20:04:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzV9W-0004A3-5M for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 20:04:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzV9W-00049r-1y for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 20:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hzV9V-00088p-Si for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 20:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Aug 2019 00:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9871 X-GNU-PR-Package: emacs Original-Received: via spool by 9871-submit@debbugs.gnu.org id=B9871.156617301831266 (code B ref 9871); Mon, 19 Aug 2019 00:04:01 +0000 Original-Received: (at 9871) by debbugs.gnu.org; 19 Aug 2019 00:03:38 +0000 Original-Received: from localhost ([127.0.0.1]:58960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzV96-00088C-CI for submit@debbugs.gnu.org; Sun, 18 Aug 2019 20:03:38 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:47374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzV95-000885-1c for 9871@debbugs.gnu.org; Sun, 18 Aug 2019 20:03:35 -0400 Original-Received: from [12.144.191.101] (helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hzV90-0003gb-Mc; Mon, 19 Aug 2019 02:03:33 +0200 In-Reply-To: <87fwig4sss.fsf@gmail.com> ("=?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?="'s message of "Wed, 26 Oct 2011 00:20:35 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165365 Archived-At: =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec 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? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no