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: Mon, 19 Aug 2019 13:37:08 -0700 Message-ID: <87k1b828p7.fsf@mouse.gnus.org> References: <87fwig4sss.fsf@gmail.com> <87fwig4sss.fsf@gmail.com> <878srq3ttb.fsf@mouse.gnus.org> <878srq3ttb.fsf@mouse.gnus.org> <8736hx35q2.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="18646"; 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 22:39:51 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 1hzoRT-0004hO-4X for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Aug 2019 22:39:51 +0200 Original-Received: from localhost ([::1]:57606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzoQq-0003Kj-Qj for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Aug 2019 16:39:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48767) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzoPj-0001hn-NL for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2019 16:38:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzoPi-0004TR-Ik for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2019 16:38:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51712) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzoPi-0004TF-FM for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2019 16:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hzoPi-0001Zu-8H for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2019 16:38:02 -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 20:38:02 +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.15662470416003 (code B ref 9871); Mon, 19 Aug 2019 20:38:02 +0000 Original-Received: (at 9871) by debbugs.gnu.org; 19 Aug 2019 20:37:21 +0000 Original-Received: from localhost ([127.0.0.1]:60530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzoP2-0001Yl-MS for submit@debbugs.gnu.org; Mon, 19 Aug 2019 16:37:20 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:35434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzoOz-0001Ya-SX for 9871@debbugs.gnu.org; Mon, 19 Aug 2019 16:37:19 -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 1hzoOu-0006HZ-3q; Mon, 19 Aug 2019 22:37:14 +0200 In-Reply-To: <8736hx35q2.fsf_-_@gmail.com> ("=?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?="'s message of "Mon, 19 Aug 2019 10:43:49 +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:165389 Archived-At: =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec 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. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no