From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.bugs Subject: bug#41002: Undo breaks inhibit-read-only text property Date: Sat, 09 May 2020 19:55:24 +0300 Message-ID: References: <76e70d06-5dd7-700e-2d05-e3f1ec282a7c@gmail.com> <83blmxh833.fsf@gnu.org> <838si1fcbb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="56827"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: 41002@debbugs.gnu.org, egnartsms@gmail.com, larsi@gnus.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 09 18:57:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXSmk-000Eeh-CI for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 May 2020 18:57:10 +0200 Original-Received: from localhost ([::1]:46206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXSmi-0000uI-92 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 May 2020 12:57:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXSmc-0000u9-JL for bug-gnu-emacs@gnu.org; Sat, 09 May 2020 12:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXSmc-0000qY-Ab for bug-gnu-emacs@gnu.org; Sat, 09 May 2020 12:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jXSmc-0001RP-9B for bug-gnu-emacs@gnu.org; Sat, 09 May 2020 12:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Filipp Gunbin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 May 2020 16:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41002 X-GNU-PR-Package: emacs Original-Received: via spool by 41002-submit@debbugs.gnu.org id=B41002.15890433665447 (code B ref 41002); Sat, 09 May 2020 16:57:02 +0000 Original-Received: (at 41002) by debbugs.gnu.org; 9 May 2020 16:56:06 +0000 Original-Received: from localhost ([127.0.0.1]:48305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXSlh-0001Pl-PJ for submit@debbugs.gnu.org; Sat, 09 May 2020 12:56:06 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:39517) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXSlf-0001PF-RK for 41002@debbugs.gnu.org; Sat, 09 May 2020 12:56:04 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id C659F6D4; Sat, 9 May 2020 12:55:57 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 09 May 2020 12:55:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=pUzw2dBYIER1ydjR2YGQkuXonp QZvE577lVlPy+ll1g=; b=bztuyal7hE7hjA1GOUZcIhMnAt/Wvofg7zDeTLv3gg f91U3ULsVFRLhLSyM10Pu2M3dryznNILCGfz/oG7XmyOIAPv/a62x/1YGVUNCjAU q1wKKaZWm7nDi/MukU6xZklQ3VB3TDXSIeDR9mrBy1dwFTUv/qd/gNuv9LCkug3R jYyeA8/pKAA/mzmT/3mMdA1qoSSID22D7ium1ABPJPPwY4QY8czzae7UHXjWQJMU sBsykgwxZPFaqV4ySnXd2hFkY1NttZCwRDmBL6YlS+y5erZ8UOe+/ScFhUiYnNuJ nRDwRvSNYWO200dKVW815hACZGEmvCpShXnm49iXyt9g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=pUzw2d BYIER1ydjR2YGQkuXonpQZvE577lVlPy+ll1g=; b=goNmx9oKeyE2bONPyoCi32 KBB3tVw3M5TLO0xTdLK/qS5bxRsHQclxLTaeamj40CxcRiLHKHfQ/dYdQ6KzoD/G m3PX173rD5ag4HuQPp5lOCsbPfkb+LdrXYa+kIHs+OonjYfwNHl4Ex3Ld4mFh+pz fRraSC7iVcoBT/ZhP3PRqxXGx9O+LICWUcLcsPUK2fgdz87BBfIEKgj5mlWAIYYY qFU+vmiEDVYpDPYRM/MipM7zVPJRQd4a2KK771OBRlCG8OYwP1VfgHQJlG6NCORB NclDOY4zEkotC2k8S2B0GKxN6IUV3fLM964BUW0CxJaTW8vnXG/MgGG3iAJTuU2Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrkeehgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhgffffkgggtsehttdertddtredtnecuhfhrohhmpefhihhlihhp phcuifhunhgsihhnuceofhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmheqnecuggftrf grthhtvghrnhepvdevkeffvdeuvefhuddtjeehkedvueefveettddtveduudfgieffieev ieevhfdtnecukfhppeekfedruddtvddrvddtfedruddvnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepfhhguhhnsghinhesfhgrshhtmhgrihhl rdhfmh X-ME-Proxy: Original-Received: from fgunbin.local (unknown [83.102.203.12]) by mail.messagingengine.com (Postfix) with ESMTPA id 4B93C3280060; Sat, 9 May 2020 12:55:56 -0400 (EDT) In-Reply-To: <838si1fcbb.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 09 May 2020 16:49:28 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179976 Archived-At: On 09/05/2020 16:49 +0300, Eli Zaretskii wrote: >> From: Filipp Gunbin >> Cc: egnartsms@gmail.com, 41002@debbugs.gnu.org, larsi@gnus.org >> Date: Sat, 09 May 2020 16:34:43 +0300 >> >> > I think you are right: we need to augment this with something that >> > pays attention to the inhibit-read-only property. Would you like to >> > suggest a patch? >> >> That property is checked in INTERVAL_WRITABLE_P just above, it looks >> fine. > > That tests if the interval is _not_ writable. But the problem is not > triggered by the interval, it is triggered by characters after the > interval, is it not? The buffer is read-only, and all characters have inhibit-read-only property set (it's in the recipe). Undo properly restores characters as well as their properties. But now, after undo, we don't have one single interval any more, we have 3 intervals instead: before killed region, killed (and restored) region, and the rest. And this is where our problematic (?) "if" triggers. So I wouldn't talk about characters after the interval, no. >> > Btw, how is this related to undo? >> >> Before undo, we seem to have one interval spanning all the text. After >> undo, there appears a short interval on which "i->position + LENGTH (i) >> < end" triggers. > > Right, thanks. So this situation could be recreated without any undo > in the recipe, right? Yes, just put-text-property on separate (and adjacent) intervals instead of the full buffer at once, and try to kill a region which crosses any interval boundary: (with-temp-buffer (insert "ab") (put-text-property 1 2 'inhibit-read-only t) (put-text-property 2 3 'inhibit-read-only t) (setq buffer-read-only t) (kill-region 1 3)) ;(kill-region 1 2) works Thanks, Filipp