From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#9871: `query-replace' and friends break text properties Date: Sun, 18 Aug 2019 17:57:18 -0700 (PDT) Message-ID: References: <87fwig4sss.fsf@gmail.com> <878srq3ttb.fsf@mouse.gnus.org> 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="208644"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 9871@debbugs.gnu.org To: Lars Ingebrigtsen , =?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:58:18 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 1hzW00-000sB7-I8 for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Aug 2019 02:58:16 +0200 Original-Received: from localhost ([::1]:43928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzVzz-0000EY-Du for geb-bug-gnu-emacs@m.gmane.org; Sun, 18 Aug 2019 20:58:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33416) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzVzn-0000DB-Gb for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 20:58:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzVzm-0003nM-EH for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 20:58:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50157) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzVzm-0003nC-AT for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 20:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hzVzm-0000v1-6D for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 20:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Aug 2019 00:58: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.15661762493489 (code B ref 9871); Mon, 19 Aug 2019 00:58:02 +0000 Original-Received: (at 9871) by debbugs.gnu.org; 19 Aug 2019 00:57:29 +0000 Original-Received: from localhost ([127.0.0.1]:58978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzVzE-0000uD-QI for submit@debbugs.gnu.org; Sun, 18 Aug 2019 20:57:29 -0400 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:55054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzVzC-0000tz-ER for 9871@debbugs.gnu.org; Sun, 18 Aug 2019 20:57:27 -0400 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7J0sXuJ095843; Mon, 19 Aug 2019 00:57:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=y6ynorFL9Z3QjG9m6DwoUbKTkrBhnO8Zadg67Apvw/0=; b=Gh/xH5dEes86ArUBffW+aoS5Li9m8/uZaWNT42M8zfdAf4mRlrSgriCj8n+ekrwB3PoN +BJzmwp9q4QTaclb0mjJDFoK6WoJxm2dhmp5OCpUTl5HJujHIrGl9+S5jyabORdk8XQw cdU0O1nEZBOD69U2YgALdHhkKeJkWQyTLXfP/abFJPorHmm2Q77ajeIbUEJOAw6zUYwR ADSqzIIp63CTggAdVHZCdHg4F9o5hs5p/TmEPxY/GlEO+q1jpna/63I9YFXTn5xmbJPa ppy+Hm0OFVeLJj83mXyOkk8DMuYT1VkwhVubNM4QJMdkEnCSKOYyGQmXXixlhxpBeGI2 vw== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2ue9hp4cg5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2019 00:57:20 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7J0rWX4017574; Mon, 19 Aug 2019 00:57:20 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2uejxdjnjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2019 00:57:19 +0000 Original-Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7J0vJWG027859; Mon, 19 Aug 2019 00:57:19 GMT In-Reply-To: <878srq3ttb.fsf@mouse.gnus.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4873.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9353 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908190006 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9353 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908190007 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:165367 Archived-At: > I guess the question becomes -- what text properties should be in the > result? >=20 > If you have >=20 > (with-temp-buffer > (insert (propertize "hel" 'face 'bold)) > (insert (propertize "lo" 'face 'underline)) > (goto-char (point-min)) > (replace-regexp "ell" "yes, well") > (buffer-string)) >=20 > 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. >=20 > 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. >=20 > I don't know... all solutions here seem kinda ad hoc, so perhaps the > current behaviour is the least surprising. Any opinions? I take a slightly different position from both of you, I guess. I'd say that the replacement text should replace the text to replace as if `delete-selection-mode' were turned on and you (1) selected the text to replace and then ` yanked the replacement text from the kill ring to replace it. The text props are copied to the kill-ring as part of the text. And yanking the text gives you copies that also have those text properties. Why shouldn't the same behavior be available for query-replace? If a user specifies replacement text that has text properties then it should be used as is: its properties should remain when it takes the place of text in the buffer. E.g. Copy some buffer text that has properties into the kill ring. Then use `M-%' and yank that copied, propertized text as the replacement text. The places where it now appears as replacement should all have the same text properties. But they don't seem to.