From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "J.P." Newsgroups: gmane.emacs.bugs Subject: bug#75313: 31.0.50; ERC 5.6.1-git: M-w cannot copy multiline text when kill-ring-deindent-mode is on Date: Fri, 03 Jan 2025 12:10:16 -0800 Message-ID: <878qrrzmjb.fsf__30595.1627482258$1735935093$gmane$org@neverwas.me> References: <871pxkuqiz.fsf@zaichuan.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11126"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Po Lu , emacs-erc@gnu.org, 75313@debbugs.gnu.org To: DU Zaichuan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 03 21:11:23 2025 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 1tTo0w-0002em-Rx for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Jan 2025 21:11:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTo0f-0005Vx-Em; Fri, 03 Jan 2025 15:11:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTo0c-0005VV-Fb for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 15:11:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTo0c-0003Uk-4t for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 15:11:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=C/FxqB3wXs7g83Dxc1F21AAqg7RqxMeEmwVR+yjoQoQ=; b=Xmh2AVbd0ahheJ7X3PkVedwIg33ObzAnopjJneF5PLJ2+ZRd4b2pY9TPw53reGMB7zb+l5aoe3KlRY1EIZ2CoubkwTE4tJ0ILRSjPxDKoM5z+ATA9jq5fcYwN3ZFkX+2Biyl4SXRjOIfCZnsf7MKJoVjeTpUZT41EzeGox1Ke36nTKSEaY1hMBxmeAIx/DjalXhzszidTy328lb6cBQ5xYFR/ah8+FfCU4Wkaas2osLK/hA7RnWybQLk37FtGjNVhHOB0PiXxm5PPVxPBUCQNUwhgLsqy2tQZ/sowAx99Y+qwHyGET1WlVEHwTsowxnHt52mi1TpphRzWWjLTDKQ5Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTo0b-0006ZK-V3 for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 15:11:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Jan 2025 20:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75313 X-GNU-PR-Package: emacs Original-Received: via spool by 75313-submit@debbugs.gnu.org id=B75313.173593502625197 (code B ref 75313); Fri, 03 Jan 2025 20:11:01 +0000 Original-Received: (at 75313) by debbugs.gnu.org; 3 Jan 2025 20:10:26 +0000 Original-Received: from localhost ([127.0.0.1]:52282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTo01-0006YL-H1 for submit@debbugs.gnu.org; Fri, 03 Jan 2025 15:10:25 -0500 Original-Received: from mail-108-mta0.mxroute.com ([136.175.108.0]:43185) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tTnzz-0006Y8-1j for 75313@debbugs.gnu.org; Fri, 03 Jan 2025 15:10:23 -0500 Original-Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta0.mxroute.com (ZoneMTA) with ESMTPSA id 1942dca489e000310e.001 for <75313@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 03 Jan 2025 20:10:19 +0000 X-Zone-Loop: d3cd2562ee5ae7dd93fb90b696a6f5b9179b1fc7afe9 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=C/FxqB3wXs7g83Dxc1F21AAqg7RqxMeEmwVR+yjoQoQ=; b=Rl70ZPw/A1ChgwQwDxs7jU10ie X+biPvh0xCkcITbVFCf/31pxIiYbC8semtXnOBjmQ+gsUS31ZdJlJcMwGn8Zt7eNhgD463cElgkOJ ml21axQBP2VfbcxokHMFC2X1SxdDR1KUWwDPJERlOPmDclr26z5lz0cXxg4xEYOpk1EAOKVbhnGdd zI8n6sIdWK/fWMGxbdhb6mzg8B0E/Dl01FmJBJXL1P5b9KR9Nq9NuY244AG8n7cqBQdTdV2NK/dCK 5dKHch2/1NyMjR84JYwJl0QdVO9MmTWHfpQlFT/TFpVlG8uSXoaumegWlLn0x+jxVjXcqsbuW0UkC a5CcK+qA==; In-Reply-To: <871pxkuqiz.fsf@zaichuan.net> (DU Zaichuan via's message of "Fri, 03 Jan 2025 11:43:00 +0100") X-Authenticated-Id: masked@neverwas.me 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298308 Archived-At: DU Zaichuan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > To reproduce the bug in emacs -Q, > > 1. (kill-ring-deindent-mode t) > > 2. open erc and join any channel. > > 3. try to copy with M-w someone's message or the channel notice. Thanks. A slightly distilled version, sans ERC: 1. M-x kill-ring-deindent-mode RET 2. M-: (insert (propertize "(progn\n 1\n 2\n 3)" 'read-only t)) RET 3. C-SPC 4. C-P ; error: Text is read-only 5. M-w ; error: Text is read-only > > When using the set-mark-command to highlight the texts, message gives > "kill-ring-deindent-buffer-substring-function: Text is read-only". Indeed. It seems all `filter-buffer-substring-function' advice members, like `kill-ring-deindent-buffer-substring-function', run after every command when the region is active because `region-extract-function' needs to supply `gui-set-selection' with the region's text. I see two ways of dealing with this: 1. Local advice around `filter-buffer-substring-function'. (defun erc--filter-buffer-substring (orig &rest args) (if (eq this-command #'kill-ring-save) (with-silent-modifications (apply orig args)) (apply orig args))) So, somewhere in ERC's major-mode setup, we'd do: (add-function :around (local 'filter-buffer-substring-function) #'erc--filter-buffer-substring) However, this won't do anything for "Text is read only" spam related to other commands, like `previous-line' or `move-end-of-line' (when the region is active). But it should at least restore the ability to copy with M-w. 2. Address this somewhere in lisp/indent-aux.el. Binding `inhibit-read-only' to t around the call to `indent-rigidly' in `kill-ring-deindent-buffer-substring-function' seems to help in cursory experiments. Not sure if that's the right move, though. Perhaps Po Lu (Cc'd) has some insights.