GNU bug report logs - #75313
31.0.50; ERC 5.6.1-git: M-w cannot copy multiline text when kill-ring-deindent-mode is on

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: DU Zaichuan <du@HIDDEN>; dated Fri, 3 Jan 2025 13:20:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 75313 <at> debbugs.gnu.org:


Received: (at 75313) by debbugs.gnu.org; 3 Jan 2025 20:10:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 03 15:10:26 2025
Received: from localhost ([127.0.0.1]:52282 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTo01-0006YL-H1
	for submit <at> debbugs.gnu.org; Fri, 03 Jan 2025 15:10:25 -0500
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 <jp@HIDDEN>) id 1tTnzz-0006Y8-1j
 for 75313 <at> debbugs.gnu.org; Fri, 03 Jan 2025 15:10:23 -0500
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 <at> 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==;
From: "J.P." <jp@HIDDEN>
To: DU Zaichuan <du@HIDDEN>
Subject: Re: bug#75313: 31.0.50; ERC 5.6.1-git: M-w cannot copy multiline
 text when kill-ring-deindent-mode is on
In-Reply-To: <871pxkuqiz.fsf@HIDDEN> (DU Zaichuan via's message of "Fri, 
 03 Jan 2025 11:43:00 +0100")
References: <871pxkuqiz.fsf@HIDDEN>
Date: Fri, 03 Jan 2025 12:10:16 -0800
Message-ID: <878qrrzmjb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Authenticated-Id: masked@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75313
Cc: Po Lu <luangruo@HIDDEN>, emacs-erc@HIDDEN, 75313 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

DU Zaichuan via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@HIDDEN> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75313; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Jan 2025 13:19:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 03 08:19:47 2025
Received: from localhost ([127.0.0.1]:49997 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tThac-0006m4-3T
	for submit <at> debbugs.gnu.org; Fri, 03 Jan 2025 08:19:47 -0500
Received: from lists.gnu.org ([2001:470:142::17]:50936)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <du@HIDDEN>) id 1tTf9J-000882-LH
 for submit <at> debbugs.gnu.org; Fri, 03 Jan 2025 05:43:26 -0500
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 <du@HIDDEN>) id 1tTf9B-0002hH-Cw
 for bug-gnu-emacs@HIDDEN; Fri, 03 Jan 2025 05:43:19 -0500
Received: from out-175.mta0.migadu.com ([2001:41d0:1004:224b::af])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <du@HIDDEN>) id 1tTf96-0002bn-Om
 for bug-gnu-emacs@HIDDEN; Fri, 03 Jan 2025 05:43:16 -0500
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zaichuan.net;
 s=key1; t=1735900983;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding;
 bh=TH8aruJDUDgsEiie+GW7LKXcxsH4u2EQBLSMSfua2nA=;
 b=sTfpEUcieGUN2rDRxrOF4/Ev9pTSBtX4WRBIv6eo+eObPnwz6461W8DLVpkkKdFHCaoBzM
 62u0OD5NjaJZ2PsTUpJQsOys7wnmjIpcinYCs2Mol4rhvXdta2rshp09A+2x+j2Sx4Bd52
 jmUiLp7988lnoDQE3Awijs4H0ciqUyrnlE7eglUYnGeOZbcUJfMtJeYooRP1eY/onvIN2O
 ZLcPYFSNXvNrRBkpoTS7B+busZL0NfjTos1RFXXoQJ/22vcxYVDzsuIYP/mqY+d8WR+lJ5
 tFcKo8jEWvh/5Vl7PF5FUGs/aVcQCupljXSbWrOy3VyTzBVVb6WC3tc4BKVQOg==
From: DU Zaichuan <du@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; ERC 5.6.1-git: M-w cannot copy multiline text when
 kill-ring-deindent-mode is on
X-Debbugs-CC: emacs-erc@HIDDEN
X-Debbugs-Cc: 
Date: Fri, 03 Jan 2025 11:43:00 +0100
Message-ID: <871pxkuqiz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=2001:41d0:1004:224b::af;
 envelope-from=du@HIDDEN; helo=out-175.mta0.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 03 Jan 2025 08:19:45 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

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.

When using the set-mark-command to highlight the texts, message gives
"kill-ring-deindent-buffer-substring-function: Text is read-only".

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2024-12-28 built on arch
Repository revision: af3bbc83600bec6c8621e1b04437dbfdeb329106
Repository branch: HEAD
System Description: Arch Linux

Configured using:
 'configure --with-native-compilation=3Daot --with-pgtk'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

--=20
Best regards,
Zaichuan =E5=9C=A8=E5=B7=9D (he/him)
https://zaichuan.net




Acknowledgement sent to DU Zaichuan <du@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#75313; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.