GNU bug report logs - #65380
[PATCH] Add command to copy contents in a diff-mode buffer

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: Philip Kaludercic <philipk@HIDDEN>; Keywords: patch; dated Sat, 19 Aug 2023 09:55:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 65380) by debbugs.gnu.org; 22 Aug 2023 11:29:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 22 07:29:25 2023
Received: from localhost ([127.0.0.1]:58660 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qYPZd-0001Wr-5r
	for submit <at> debbugs.gnu.org; Tue, 22 Aug 2023 07:29:25 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43462)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qYPZb-0001Wd-2K
 for 65380 <at> debbugs.gnu.org; Tue, 22 Aug 2023 07:29:23 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qYPZS-0001zP-E2; Tue, 22 Aug 2023 07:29:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=VmMOfhLnwatHzuBP6KXharzbML9KN2lF7mnFk4RJ2zE=; b=X2fkjhlt0LPZ
 c72qZQDiqbOI36lY1lVhgKCHwHpFAENbKshmN9mzOCf9bhSYq1fc0C5HX1w8rLVF77shtt9kti8RP
 XfvOYNQytNthj2c+EnW10xlmb/22XFrnaj7lqj+MimAagM2Lp/Ah7gA0qdYfEGnnPjJ5K6xW83Z3P
 WhYUInJFdpHxRNEBs0Lok1jKhs+uG9JS/m+aaqCLjADeZXSw8QtzUl3P9Iu+y7k9Z5THhcOGK37tv
 27bTUP2nGtn9Aia0pZxnTeiuorMp5NdFvzcwks6cmbfvBQMf4pqZe3p8jWnI45T6P3zEZNBF2wMtp
 QFB/LMi1aBlrfm0xeJfq3w==;
Date: Tue, 22 Aug 2023 14:29:34 +0300
Message-Id: <83fs4btiw1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <87fs4bgwuj.fsf@HIDDEN> (message from Philip Kaludercic on
 Tue, 22 Aug 2023 11:06:28 +0000)
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <86o7j2qgmc.fsf@HIDDEN> <83cyzhwpcj.fsf@HIDDEN>
 <87a5ultvuy.fsf@HIDDEN> <83a5ulwos6.fsf@HIDDEN>
 <87fs4bgwuj.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, juri@HIDDEN
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: -3.3 (---)

> From: Philip Kaludercic <philipk@HIDDEN>
> Cc: juri@HIDDEN,  65380 <at> debbugs.gnu.org
> Date: Tue, 22 Aug 2023 11:06:28 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> From: Philip Kaludercic <philipk@HIDDEN>
> >> Cc: Juri Linkov <juri@HIDDEN>,  65380 <at> debbugs.gnu.org
> >> Date: Sun, 20 Aug 2023 18:24:53 +0000
> >> 
> >> Eli Zaretskii <eliz@HIDDEN> writes:
> >> 
> >> >> From: Juri Linkov <juri@HIDDEN>
> >> >> Cc: Philip Kaludercic <philipk@HIDDEN>,  65380 <at> debbugs.gnu.org
> >> >> Date: Sun, 20 Aug 2023 19:30:03 +0300
> >> >> 
> >> >> Regarding the implementation, there is the function
> >> >> 'diff-hunk-text', but it's limited to one hunk only.
> >> >
> >> > So is the proposed new function, isn't it?
> >> 
> >> No, the current proposal doesn't have any special handling for text
> >> between hunks.
> >
> > AFAIU, the function you proposed removes the first character from each
> > line in the region, so how will it handle multiple hunks?
> >
> > Or maybe I misunderstood what you meant by "No"?
> 
> The command does not error when the region selects more than just a
> sub-region of a hunk, but it doesn't do anything useful either.

Then how about making a command that is basically a wrapper around
diff-hunk-text, and allows to copy bodies of N hunks, given an
argument of N?  Wouldn't that be more useful?




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

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


Received: (at 65380) by debbugs.gnu.org; 22 Aug 2023 11:06:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 22 07:06:42 2023
Received: from localhost ([127.0.0.1]:58633 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qYPDe-0000qa-4Y
	for submit <at> debbugs.gnu.org; Tue, 22 Aug 2023 07:06:42 -0400
Received: from mout02.posteo.de ([185.67.36.66]:48529)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qYPDc-0000qM-4Z
 for 65380 <at> debbugs.gnu.org; Tue, 22 Aug 2023 07:06:40 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id F3403240104
 for <65380 <at> debbugs.gnu.org>; Tue, 22 Aug 2023 13:06:30 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1692702391; bh=MeEnFLTfqSoCW0DEheD1iylT/8+W0VtIxsiKTA6OSNw=;
 h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From;
 b=BhjDr/itImgnwv9BHPV2WxchEsep8oh1/bLTeHQHNZCMGCzDlWIJV0HtPw1VEZ/So
 e1VNzDFHzPnyKwGgY8pZbQ1AUhARtWb7jiJ79EKOoSyUpzQd8jkkNDCzKcA2BCfxLi
 xkoXN/lNDgPHzTz50jCwW5fP4I7e92/+bpxQQ8mfq9KmdFJXw493idLj7ehONNeE0e
 9kYLwPhbEvoPrkluU4HzxWfT2cLQBdXO2U+lw+1Eo28sKiDSVDPy6eoecG95/JW88B
 DLZfCbeeKp3CNdCZpuaj5Bi2ocgSetgoY5l6n0nnvKRCeSZBOCqO3hIN+Ma53AMh1z
 8tC8dbAM/skgw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4RVRP21p7bz9rxN;
 Tue, 22 Aug 2023 13:06:30 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83a5ulwos6.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 20 Aug
 2023 21:29:29 +0300")
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <86o7j2qgmc.fsf@HIDDEN> <83cyzhwpcj.fsf@HIDDEN>
 <87a5ultvuy.fsf@HIDDEN> <83a5ulwos6.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Tue, 22 Aug 2023 11:06:28 +0000
Message-ID: <87fs4bgwuj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, juri@HIDDEN
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: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Philip Kaludercic <philipk@HIDDEN>
>> Cc: Juri Linkov <juri@HIDDEN>,  65380 <at> debbugs.gnu.org
>> Date: Sun, 20 Aug 2023 18:24:53 +0000
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> >> From: Juri Linkov <juri@HIDDEN>
>> >> Cc: Philip Kaludercic <philipk@HIDDEN>,  65380 <at> debbugs.gnu.org
>> >> Date: Sun, 20 Aug 2023 19:30:03 +0300
>> >> 
>> >> Regarding the implementation, there is the function
>> >> 'diff-hunk-text', but it's limited to one hunk only.
>> >
>> > So is the proposed new function, isn't it?
>> 
>> No, the current proposal doesn't have any special handling for text
>> between hunks.
>
> AFAIU, the function you proposed removes the first character from each
> line in the region, so how will it handle multiple hunks?
>
> Or maybe I misunderstood what you meant by "No"?

The command does not error when the region selects more than just a
sub-region of a hunk, but it doesn't do anything useful either.




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

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


Received: (at 65380) by debbugs.gnu.org; 21 Aug 2023 00:34:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 20:34:54 2023
Received: from localhost ([127.0.0.1]:55074 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXssf-0006ta-PO
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 20:34:54 -0400
Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]:53599)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1qXsse-0006tO-Ds
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 20:34:52 -0400
Received: by mail-ot1-x32c.google.com with SMTP id
 46e09a7af769-6bcaa6d5e2cso2412482a34.3
 for <65380 <at> debbugs.gnu.org>; Sun, 20 Aug 2023 17:34:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1692578085; x=1693182885;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=bmm0dxvIxkyshZvVxRAETmJ4c90CDHBJG5YSD44A19Y=;
 b=qNADYIxO9OpwDKFLWRqk/pp5ynxx+KBlyMgA115HFb0N9ix2/LEzKA/wJGjxcCYPES
 AWOHnMXqX2Iai7XVjHm1ml9ZRYY1bQIqruIjTsOx/IZnsqCDgo7uvqJCclGS5iDqDLlh
 xlmaNFgLPO+cVOfeUYDJxNXuu/E1+pobE0q/qh7vL5qB86n9v4VmNy6PoBXy4m2evUt3
 i6Ic1W4i6PjGc0cDFx8x3+QbFVbwt6J7yS4gp/SsbywazyTwMwnEBBCDvgvZ90+DViyd
 uT8eobW/RHHXC4duQUAlOUHjYn284D/cEY3YlOL9AGlRDU6DvIYqjF+PBbMXu+0iAkK2
 t9gg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1692578085; x=1693182885;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=bmm0dxvIxkyshZvVxRAETmJ4c90CDHBJG5YSD44A19Y=;
 b=Q9GqsfDoydQEwrY84DqnoOYsW0j5kINtiqEybNbfhcw61gKB6yrsazXQ0VHHVnq06a
 MMAe1yIGLLqMiEsSikce8kViST9DhAES4CiXbwfeyDlLbtGtlFn/oIEVHSK8Pm2jdmDo
 RBTypkBD33q4oyie+o3FRx9fNZVFegoLXZxZzx6H26CG0RUzdpPuelb/UHZSy5O+ziRN
 SDF6XFrLOR5itm5zLcGPXXM+agCBEIL5ArwY0p+iEmIYiRMZhoo0dkk/D4vzvePDjMt/
 P2ahgdFJ2R51iwmpQfAhRTT6kHuCuHi5Z/iMdi9+mI+OR8FkHULolATcnBNcWK+vYjzm
 ZVZw==
X-Gm-Message-State: AOJu0Ywf7zmIdO3ChN/zSaBUCJimm7I6Bh8IzWK4o+0jOMFEe8NPo82R
 akk4NkOBSHAHk7V71pvvrsM=
X-Google-Smtp-Source: AGHT+IGG3xmakr9+zxI0OhWEGXtQvxWrE2gz0Yfqti58JPt64B0eraFRfwTFbkgIub3SI95G8BSqDA==
X-Received: by 2002:a9d:7c93:0:b0:6bc:f20a:3b65 with SMTP id
 q19-20020a9d7c93000000b006bcf20a3b65mr6772638otn.23.1692578084730; 
 Sun, 20 Aug 2023 17:34:44 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id
 z19-20020a63e113000000b005646e6634dcsm5266537pgh.83.2023.08.20.17.34.43
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 20 Aug 2023 17:34:44 -0700 (PDT)
Message-ID: <2c3c9bbf-8c1f-fcb8-3bf9-95b0f776fb6d@HIDDEN>
Date: Sun, 20 Aug 2023 17:34:43 -0700
MIME-Version: 1.0
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
Content-Language: en-US
To: Gregory Heytings <gregory@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
 <22de08b62b5abe7309b8@HIDDEN>
 <7896ab38-c938-2f08-806b-3543e8b64173@HIDDEN>
 <22de08b62b886f50c32f@HIDDEN>
 <b9803f21-cf2d-a16b-d5e2-7559e7e3ee37@HIDDEN>
 <22de08b62b10f30b4d4c@HIDDEN> <22de08b62bdcabe4be0b@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <22de08b62bdcabe4be0b@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Philip Kaludercic <philipk@HIDDEN>
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 (-)

On 8/20/2023 4:39 PM, Gregory Heytings wrote:
>> I would do something else: a command to move the killed rectangle to 
>> the kill-ring.  And perhaps a command to do the opposite: transform 
>> the last item of the kill-ring into a killed rectangle.
>>
> 
> And here are the two commands I had in mind:
[snip]> WDYT?

Hm, it could work. I'm not sure we *need* to be able to go from the kill 
ring to 'killed-rectangle', but if people are happy with the 
implementation, I don't see a problem.

I wonder how this would interact with 'rectangle-mark-mode' though. That 
puts the killed rectangle on the "regular" kill ring, but applies a 
'yank-handler' text property to the killed rect. 'rectangle-mark-mode' 
might need its own implementation for this. (Either not setting 
'yank-handler' when killing or having a way of ignoring the 
'yank-handler' when yanking?)

(I also wonder if it would make sense for the "normal" rect commands 
like "C-x r k" / 'kill-rectangle' to integrate with the kill ring like 
'rectangle-mark-mode', but that's another can of worms...)




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 23:39:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 19:39:17 2023
Received: from localhost ([127.0.0.1]:55056 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXs0q-0005Wj-KJ
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 19:39:16 -0400
Received: from heytings.org ([95.142.160.155]:47042)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qXs0n-0005WZ-M6
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 19:39:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1692574750;
 bh=95ubxgoXd0gYWl5QTeg9Lser7WFyz3LmGMCzIt+KYt4=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=u4/UNux47roHIfaT837uknZkGjOCDNvEgwZyw/6RDJFktvOJrV6aSdKGDgtyE7WAY
 7/oTCzPnggYGAETNPpS9ocVfjd/diVep0ZZOHvG6pnysaoNYdyqNQpjETpR8ntnnKo
 a0skK2VUAQ0LzulouOdzvhXf5Vw0xmsOOaHW9XJ515e+nPLUY9kgmTs0IllzGjNQHT
 NeF2u82zBrGVbGpNeKr0mGGqL9JNTpvsIxkq2mI/W/zF2Ab85vNI7a62pIY5UdpRGc
 VZ4foQXiU+lJYgoHCG344qIFX8LmglXD0p32VXDuC18VSvY5bdmpJIy/N9KMQtzAsZ
 q5FSZ9Glomxpw==
Date: Sun, 20 Aug 2023 23:39:09 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <22de08b62b10f30b4d4c@HIDDEN>
Message-ID: <22de08b62bdcabe4be0b@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
 <22de08b62b5abe7309b8@HIDDEN>
 <7896ab38-c938-2f08-806b-3543e8b64173@HIDDEN>
 <22de08b62b886f50c32f@HIDDEN>
 <b9803f21-cf2d-a16b-d5e2-7559e7e3ee37@HIDDEN>
 <22de08b62b10f30b4d4c@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=us-ascii
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Philip Kaludercic <philipk@HIDDEN>
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 (-)


>> Yeah, the question then is: should it be new kill/copy commands or a 
>> new yank command?
>
> I would do something else: a command to move the killed rectangle to the 
> kill-ring.  And perhaps a command to do the opposite: transform the last 
> item of the kill-ring into a killed rectangle.
>

And here are the two commands I had in mind:

(defun move-killed-rectangle-to-kill-ring ()
   "Move the killed rectangle to the `kill-ring'."
   (interactive)
   (if killed-rectangle
       (with-temp-buffer
 	(while killed-rectangle
 	  (insert-for-yank (car killed-rectangle))
 	  (insert "\n")
 	  (setq killed-rectangle (cdr killed-rectangle)))
 	(kill-ring-save (point-min) (point-max)))
     (user-error "No killed rectangle")))

(defun copy-last-kill-to-killed-rectangle ()
   "Transform the current item of `kill-ring' into a killed rectangle"
   (interactive)
   (with-temp-buffer
     (let ((max -1))
       (insert-for-yank (current-kill 0 t))
       (goto-char (point-min))
       (while (not (eobp))
 	(move-end-of-line nil)
 	(let ((col (current-column)))
 	  (when (> col max)
 	    (setq max col)))
 	(forward-line 1))
       (let ((col (current-column)))
 	(when (< col max)
 	  (insert (make-string (- max col) ? ))))
     (kill-rectangle (point-min) (point-max)))))

WDYT?





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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 22:31:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 18:31:37 2023
Received: from localhost ([127.0.0.1]:55049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXqxM-0003tm-Mq
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 18:31:36 -0400
Received: from heytings.org ([95.142.160.155]:46986)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qXqxK-0003td-Dw
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 18:31:35 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1692570691;
 bh=bTxiXNwjwSj6g1Lr90Cy2nG85zd1zyqu8VGCkDntaPQ=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=syIEeUR5SmjwWFoSMbXcs3TsOu6WjkzxKLG7lREbVbzO0+gUYXgwqnzu15Pptxou/
 A0F+fbvmEafvWTLe0v058NQI7Sp0AVNBdoz9wE30MsSbRzc2phcT2mCraPVlU0UjYz
 ehNJDpqyMbVqXlmdm6acrG/StvnRrMzP+d3DOSbF/hq7M/Oqhn8zE4tCVg9fdhJhNF
 ytkTN4kJ/+pzTG6Wxm7cUX2991//eHuzNXPq0XN06gblU1Xn4p4c0yWmHK4hAdHlVp
 wGRV7Ve76I4DGn0fpGcEdP8DutHCDHeNEyBBAEr72dm4O9RSA7k2RKpwT19HZd0l2+
 uBsVSFpeI2dAg==
Date: Sun, 20 Aug 2023 22:31:30 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <b9803f21-cf2d-a16b-d5e2-7559e7e3ee37@HIDDEN>
Message-ID: <22de08b62b10f30b4d4c@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
 <22de08b62b5abe7309b8@HIDDEN>
 <7896ab38-c938-2f08-806b-3543e8b64173@HIDDEN>
 <22de08b62b886f50c32f@HIDDEN>
 <b9803f21-cf2d-a16b-d5e2-7559e7e3ee37@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Philip Kaludercic <philipk@HIDDEN>
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 (-)


>
> Yeah, the question then is: should it be new kill/copy commands or a new 
> yank command?
>

I would do something else: a command to move the killed rectangle to the 
kill-ring.  And perhaps a command to do the opposite: transform the last 
item of the kill-ring into a killed rectangle.





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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 22:21:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 18:21:42 2023
Received: from localhost ([127.0.0.1]:55040 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXqnm-0003eD-Bl
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 18:21:42 -0400
Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]:46439)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1qXqnj-0003dw-Pm
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 18:21:40 -0400
Received: by mail-oa1-x33.google.com with SMTP id
 586e51a60fabf-1c504386370so1767564fac.1
 for <65380 <at> debbugs.gnu.org>; Sun, 20 Aug 2023 15:21:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1692570092; x=1693174892;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=A05ir9D29KDc1JwQtumNt7kahYkPGXwsPjcWqyUNC4g=;
 b=dk7Mn0225BuBBB99jRtmhVuOJt8sBvmHqoLp0iAtmlI3a3shycjjV9s96lJz4juSO0
 QApmVZ/0N/8fyujIGVMuk/1pr4w7RhQBWAZWEMAevEm+4xhogxh7gDKXeVQlfYqWmVaj
 Y8qppcRNXroAJ6k9wbsuOGV1VVL+ElRz8KwGjp+t98xTVAnia5tTtVXKS3tzal0RIPEs
 TYfqpQYiPNkEaR4QtPcFG6GBYvy+/Fbcl90bc0n2Xgm7zbQ9sjpV7eCg9FccwJoWTTxY
 KdcXsTxhu+t9qltwKJ3XPomtL7yvVOk0ahsy0ea94u3MM7Hu5Canv2iy0KwFvyUm58Tl
 uywQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1692570092; x=1693174892;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=A05ir9D29KDc1JwQtumNt7kahYkPGXwsPjcWqyUNC4g=;
 b=Ejyp/wFpmmSAIy940bTcPFzwKp7l83ODjRz7YPEDBaDwVtjjwXhMTCBGoDFi9kdpma
 XloZQd3yxbKMeD+Fydd+P1ZxLlOoW8iuIz01soIjDtmNOX3TqLbzLf56uhRxgsTP6APL
 XTBV6cqQmIOJ+v4G3WffnZC4zHESlRjWv1HYS2P8o4dkEXI2zzBhVmsGPVnfhydWpuNL
 mmTwyTOLm1/XliuhTFhJr1ovTrD4QB80cJ/KwKZru8vUHfDiHC4JEi4rFOXZOVzUPuOl
 un2Qs9zj9EdyR2DdKYpHWJMW+tcoO8UY7kfOTTSu3bkUZw7wCmii8NHouPOeX230gfNZ
 9ZfA==
X-Gm-Message-State: AOJu0YwAre7LzRbYnLbWCPejcWSBHftPTQDPskrT484tmkvhjTySXymi
 ///fjMDAC1rwBpEge7wUr7o=
X-Google-Smtp-Source: AGHT+IHLEIG3V5RkuM5DEOmNxPThzfbDM1mB2kgiTtaj2LUAUoEQj/2D/fqSr8seyZL5NoTKtJ2/ug==
X-Received: by 2002:a05:6870:d149:b0:1c0:1424:5e79 with SMTP id
 f9-20020a056870d14900b001c014245e79mr7506782oac.42.1692570092103; 
 Sun, 20 Aug 2023 15:21:32 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id
 x52-20020a056a000bf400b006870ff20254sm4820904pfu.125.2023.08.20.15.21.31
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 20 Aug 2023 15:21:31 -0700 (PDT)
Message-ID: <b9803f21-cf2d-a16b-d5e2-7559e7e3ee37@HIDDEN>
Date: Sun, 20 Aug 2023 15:21:30 -0700
MIME-Version: 1.0
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
Content-Language: en-US
To: Gregory Heytings <gregory@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
 <22de08b62b5abe7309b8@HIDDEN>
 <7896ab38-c938-2f08-806b-3543e8b64173@HIDDEN>
 <22de08b62b886f50c32f@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <22de08b62b886f50c32f@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On 8/20/2023 2:29 PM, Gregory Heytings wrote: > >> That's
 not quite what I mean. "C-x r y" ('yank-rectangle') yanks the >> rectangle
 *as a rectangle*. That is, if I just copied a rectangle with >> 5 l [...]
 Content analysis details:   (3.6 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [2001:4860:4864:20:0:0:0:33 listed in] [zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:4860:4864:20:0:0:0:33 listed in] [list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (jporterbugs[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Philip Kaludercic <philipk@HIDDEN>
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: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  On 8/20/2023 2:29 PM, Gregory Heytings wrote: > >> That's
   not quite what I mean. "C-x r y" ('yank-rectangle') yanks the >> rectangle
    *as a rectangle*. That is, if I just copied a rectangle with >> 5 l [...]
    
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [2001:4860:4864:20:0:0:0:33 listed in]
                             [zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2001:4860:4864:20:0:0:0:33 listed in]
                             [list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (jporterbugs[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

On 8/20/2023 2:29 PM, Gregory Heytings wrote:
>
>> That's not quite what I mean. "C-x r y" ('yank-rectangle') yanks the 
>> rectangle *as a rectangle*. That is, if I just copied a rectangle with 
>> 5 lines, and yank it with 'yank-rectangle', it will add it to the next 
>> 5 existing lines. Instead, what I want is to insert 5 new lines.
>>
> 
> Indeed, I see what you mean.  Perhaps a new C-x r command that would do 
> that could be added to Emacs?

Yeah, the question then is: should it be new kill/copy commands or a new 
yank command? The former would mean you could use all the existing yank 
functions to paste the text in, but the latter means you can defer your 
decision about how to yank the text (as a regular region or as a 
rectangle) until you're ready to actually yank.

I'd lean a bit towards the former, but that does mean (potentially) two 
new key bindings.



... hmm, or maybe you could make the existing rectangle kill/copy 
commands also add to the "regular" kill ring automatically? But then 
that might cause issues with 'rectangle-mark-mode', where 'C-y' performs 
'yank-rectangle'[1]: how would I use 'rectangle-mark-mode' to copy a 
rect and then paste it as a regular region?

[1] Well, technically 'rectangle--insert-for-yank', but they both call 
'insert-rectangle' in the end.




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 21:29:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 17:29:48 2023
Received: from localhost ([127.0.0.1]:54992 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXpzY-0002ED-MG
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 17:29:48 -0400
Received: from heytings.org ([95.142.160.155]:46878)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qXpzW-0002E1-CR
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 17:29:47 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1692566983;
 bh=IqIlbOpCwviGgBo+kLii8xlFGonFMN1fJI3tO/3FugQ=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=qNv85YMEi24wcgAURtmZ+xjry+xHsOHgyyfDG8rqiHNTDOLcSM3Z8ZAHBM9jw/JjJ
 PPoRB7KuuOM7Lt2qvzuns74jtQiMhfys7jgNoQGi7Sk+sVom6+IQ7Ks6rKW9BrWTYa
 Zpd/f+Pnd894CIqCuDODH/pu1DN0Rk2dPdW4Y6gdQ2WjotzvqKoSQ9mYP/31PDZ7qL
 jsvFOOi2JLaRUQalDv2H3yZl0eKG0vqSwVGVQF2kDNMTRRVK13uoys4oFzslLeiflZ
 uoGGE6CTTN/A1xkZz0d6HpejqhIniPI2H6Op5Gr835cRLGjT27UpeaoYC8dKRVxchU
 xf5Eo/l+B46tA==
Date: Sun, 20 Aug 2023 21:29:43 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <7896ab38-c938-2f08-806b-3543e8b64173@HIDDEN>
Message-ID: <22de08b62b886f50c32f@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
 <22de08b62b5abe7309b8@HIDDEN>
 <7896ab38-c938-2f08-806b-3543e8b64173@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Philip Kaludercic <philipk@HIDDEN>
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 (-)


>
> That's not quite what I mean. "C-x r y" ('yank-rectangle') yanks the 
> rectangle *as a rectangle*. That is, if I just copied a rectangle with 5 
> lines, and yank it with 'yank-rectangle', it will add it to the next 5 
> existing lines. Instead, what I want is to insert 5 new lines.
>

Indeed, I see what you mean.  Perhaps a new C-x r command that would do 
that could be added to Emacs?





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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 20:45:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 16:45:31 2023
Received: from localhost ([127.0.0.1]:54921 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXpIh-0006fz-7d
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 16:45:31 -0400
Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:56445)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1qXpIf-0006fi-4z
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 16:45:30 -0400
Received: by mail-pf1-x42f.google.com with SMTP id
 d2e1a72fcca58-68a3cae6e1eso389265b3a.0
 for <65380 <at> debbugs.gnu.org>; Sun, 20 Aug 2023 13:45:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1692564321; x=1693169121;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=IowvIBKa6UyLicIlX/Ncy0lIR1d4ero2sGx+DMvhdVE=;
 b=SGvwb2n1BGsQQtK3VF6aMWH4IxkIzM7MNI6z1eIsPD+EA7THS5JEm4fUndl1nBgqZ1
 NERBFZO349QkLBALqfEaDiGPQ/P858CnarF5pU0rPa08B/FqvYIZ45nhBn1dM4uQedBe
 BJREnTy7glqh4HoFJTRSWv2pv3KBXNMiHTfweVK4ms8NjwxKn+4ElZPSTcDmEnUFlqL3
 +28UQPgNieilYunVW1icbodYEWIBHb/vW5B/5mLZj6+MMX/W4j1GIKw1J/E8XGJVpDzh
 0Q12E2A5s5KdLr645ydTZJDF5oiTfjRa8EBegQ+/2axUAMJSglCLNBpVCooNzPsZ7ZWA
 x22w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1692564321; x=1693169121;
 h=content-transfer-encoding:in-reply-to:from:references:cc:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=IowvIBKa6UyLicIlX/Ncy0lIR1d4ero2sGx+DMvhdVE=;
 b=MCbuDtfazFbbxkIejLL0DwZOxi7ntC5a/cuTryn5b6lLZZ5GUQbYoI7jeCW1lwBo59
 wWgN33z3X74mvoscDzsX//Bi1gOqQoTJifyiizL5MamQmL/hIpaDQ+IIH81isC8orNT4
 b/ZAz2aeTKF96mHaKOzRgozGX8RlVdjF81VFx+UjDtOSfI/kVxMSFZqGCklHUpbi/4zI
 4aArxfjXaIgyoVRyZa6tyZbEZoJa5SmxYdsFeTgWUKDQqAIliUQgM9VK2u/Qe+ZC9qNS
 h6Jo1JIwIU8sh/IOLVtkS0dScxC93Z2tXvZzd7TnGovsbEQWtDwta/vMeeIQYW2j6E0m
 3EnA==
X-Gm-Message-State: AOJu0Yx1QpcrRAd799ZB8JT3saEOsMcz4kAveLOHM61XJvnxcWPO0H8o
 OLM+olw+LXRMi8y48JDUado=
X-Google-Smtp-Source: AGHT+IHARqhWrvq1ZmJzhCvGSm6B5GRkOIDz00ZJcmnC6jqYN7TqBS/kS56p26nnGsunfqrxZAIiPA==
X-Received: by 2002:a05:6a00:1a4f:b0:68a:5395:7aa9 with SMTP id
 h15-20020a056a001a4f00b0068a53957aa9mr408911pfv.6.1692564321502; 
 Sun, 20 Aug 2023 13:45:21 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id
 a2-20020aa780c2000000b00688214cff65sm4797410pfn.44.2023.08.20.13.45.20
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 20 Aug 2023 13:45:21 -0700 (PDT)
Message-ID: <7896ab38-c938-2f08-806b-3543e8b64173@HIDDEN>
Date: Sun, 20 Aug 2023 13:45:20 -0700
MIME-Version: 1.0
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
Content-Language: en-US
To: Gregory Heytings <gregory@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
 <22de08b62b5abe7309b8@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <22de08b62b5abe7309b8@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Philip Kaludercic <philipk@HIDDEN>
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 (-)

On 8/20/2023 1:13 PM, Gregory Heytings wrote:
> 
>>
>> Some way of yanking a rectangular selection as though it were a normal 
>> region (or some way to put the rectangular selection on the normal 
>> kill ring) would be great, and would solve this in a more-general way.
>>
> 
> These commands exist: C-x r k to kill a rectangular selection, C-x r M-w 
> to save it, and C-x r y to yank it.

That's not quite what I mean. "C-x r y" ('yank-rectangle') yanks the 
rectangle *as a rectangle*. That is, if I just copied a rectangle with 5 
lines, and yank it with 'yank-rectangle', it will add it to the next 5 
existing lines. Instead, what I want is to insert 5 new lines.

For example, if my buffer is:

   Hello
   There
   World

And I copied this rectangle:

   1
   2

Then 'yank-rectangle' at the beginning of the buffer yields:

   1Hello
   2There
   World

But I want:

   1
   2
   Hello
   There
   World

The latter would be much more useful when trying to copy/yank a rect out 
of a diff buffer as in this report.




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 20:13:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 16:13:59 2023
Received: from localhost ([127.0.0.1]:54907 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXooB-0005vV-Dy
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 16:13:59 -0400
Received: from heytings.org ([95.142.160.155]:46784)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qXoo9-0005vM-Uo
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 16:13:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1692562434;
 bh=9fNrlQj3gDY5t5O+jrWOx6idvE9VeZ2DoqscDmsjFP0=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=lsDshROYuZW7VDDLq6KTufY6F3+hpeJLcv0HI73rxebgWS61vW8MfE4MhEhX2AFKd
 JqQN69qFl7A9Vv3OoJuqU+kXvzRWhw0IYo0P892d1rCwNA8czH5eb4+nQ+fqTfDb4X
 lOVTkPQRYay0VlbXLIGRJlDqjgmZzSkxqhAmA375W4TSWIfACs8RC1wZ0GvO1tgoh9
 9Rjns5YufhrDDu1tTxtBIKgoPjy9iJFsIv5dSrBf57i+1lAvGkEaWeUZ5YaUeJvtWe
 i7Xl2Q73zG88HiRtlJ1soBuYOdhAaBV6Vmy2kYuo0HksdLYo/Ieth0f1h5H9LROMJ2
 GrkV41HGDux4Q==
Date: Sun, 20 Aug 2023 20:13:53 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
Message-ID: <22de08b62b5abe7309b8@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Philip Kaludercic <philipk@HIDDEN>
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 (-)


>
> Some way of yanking a rectangular selection as though it were a normal 
> region (or some way to put the rectangular selection on the normal kill 
> ring) would be great, and would solve this in a more-general way.
>

These commands exist: C-x r k to kill a rectangular selection, C-x r M-w 
to save it, and C-x r y to yank it.





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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 19:48:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 15:48:05 2023
Received: from localhost ([127.0.0.1]:54891 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXoP6-0005ID-Qg
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 15:48:05 -0400
Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]:61826)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1qXoP5-0005HB-8S
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 15:48:03 -0400
Received: by mail-oa1-x2b.google.com with SMTP id
 586e51a60fabf-1ba5cda3530so1784695fac.3
 for <65380 <at> debbugs.gnu.org>; Sun, 20 Aug 2023 12:48:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1692560875; x=1693165675;
 h=content-transfer-encoding:in-reply-to:from:content-language
 :references:cc:to:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=IEdZtrrb1ii5krXVho9+1Q7TrX/92u7u/pqZiNW2x8Q=;
 b=W4+QujR8qNI0XuxtcLgs/9ftAtm8KcGKla8k5um8xy8LuuqIZDSDNbZsbcrUkGEgsg
 8b3Uuej0joGuje6ejqQDJQRSBjDYDAdcSANpD/cfaDfWQ2nzMnyA0lTYvrgCooyiCXse
 k9yZKWAGcU+YIDZn6/b3oSCOcCZZ9H9PxrogOoy7XyzIoyieC706ZF8kxUscjw3X7tA3
 6rFzfZDdcXfTRAuiAUp9YniOi7hrWUK51vdhT2YBwPI+jSGXdMtUJay0SRTtRS0s1y00
 ZF7lEiHl9PsZ7rkUfAdmZTMOIX7tWzh6a8sNH4qxg+4DBG1bQ6H02a+u/vab73Ox419h
 oSuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1692560875; x=1693165675;
 h=content-transfer-encoding:in-reply-to:from:content-language
 :references:cc:to:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=IEdZtrrb1ii5krXVho9+1Q7TrX/92u7u/pqZiNW2x8Q=;
 b=gmSeU64PeE8kAKVCjo1XJhwb0oUl6yszyvlXn4wHQ35StZoJpOuiCy+wWhBb2qkXJx
 SozNl1ktS/WHrHFZDuwG0vyeud2UYvpKtKva3MZggjKA9fjPJkq+NKsSQytXniIE9ATr
 1+AqW4zvaOt+5NE2lF+k/eRL78MW1ktlj1RW+3jKB8mA2pYkc5FeJOi4ya/JMjfyLsRW
 2IJ0bFdrgIxPDGafNNGDLgThFh7d9UNqnci2z4xkRaYMT9SqIDzpoMO8xa1/wBuWq3HW
 Z0vqiWnBKftxZk6l5TvaBJdk/WEwQjprblibKR1est9z6rGPjmMiHD5nzeO2bSSbsHpA
 tlww==
X-Gm-Message-State: AOJu0YzMtGYnjsxAjAPRHA0aU16+BFjc13xNYeIqwXHLKo1Jo7RbGDYL
 wHmkEhkYevfF7oBBID4wzD5RWdILpK8=
X-Google-Smtp-Source: AGHT+IFUKeLy5WJIoWvIHq6NoZqh58/jN1joW1OOo5CwLHxQq8Rb0tecn+8wxviGRguuVa1LwpjCVg==
X-Received: by 2002:a05:6870:d28d:b0:1c8:baa5:a50f with SMTP id
 d13-20020a056870d28d00b001c8baa5a50fmr7435097oae.27.1692560875365; 
 Sun, 20 Aug 2023 12:47:55 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id
 rm4-20020a17090b3ec400b0026094c23d0asm4812250pjb.17.2023.08.20.12.47.54
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 20 Aug 2023 12:47:54 -0700 (PDT)
Message-ID: <3bee8689-f8b7-117e-0165-34df01366901@HIDDEN>
Date: Sun, 20 Aug 2023 12:47:53 -0700
MIME-Version: 1.0
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
To: Eli Zaretskii <eliz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
Content-Language: en-US
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <83r0nyyhlz.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On 8/19/2023 12:09 PM, Eli Zaretskii wrote: > I'd like to
 hear from more people who will find this useful enough to > have in Emacs.
 My first thought was that this is something you should > keep as yo [...]
 Content analysis details:   (3.6 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [2001:4860:4864:20:0:0:0:2b listed in] [zen.spamhaus.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (jporterbugs[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:4860:4864:20:0:0:0:2b listed in] [list.dnswl.org]
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  On 8/19/2023 12:09 PM, Eli Zaretskii wrote: > I'd like to
   hear from more people who will find this useful enough to > have in Emacs.
    My first thought was that this is something you should > keep as yo [...]
    
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [2001:4860:4864:20:0:0:0:2b listed in]
                             [zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2001:4860:4864:20:0:0:0:2b listed in]
                             [list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (jporterbugs[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

On 8/19/2023 12:09 PM, Eli Zaretskii wrote:
> I'd like to hear from more people who will find this useful enough to
> have in Emacs.  My first thought was that this is something you should
> keep as your local extension, but maybe I'm mistaken.

Based on my understanding of the current implementation, I would *not* 
find this useful, and instead I'd propose a couple of different ways to 
handle this.

First, the original message says, "rectangular selection might be 
possible, but that behaves differently when the text is yanked". I've 
been bitten by that a few times in the past, and I'd much rather a 
general solution to that problem instead. Some way of yanking a 
rectangular selection as though it were a normal region (or some way to 
put the rectangular selection on the normal kill ring) would be great, 
and would solve this in a more-general way. Then, for example, you could 
use the same command to copy the contents of a diff *or* to copy a 
commented-out block of code without the comment introducers. Something like:

   ;; (defun hello ()
   ;;   "Say hello."
   ;;   (message "Hello"))

If I could select a rectangle around the actual code to copy it, 
excluding the leading ";; ", that would be useful (occasionally, at least).

Second, for the diff case in particular, I'd rather have a command that 
copies the added or unchanged lines, and *skips* the removed lines. (As 
far as I can tell, the proposed implementation copies the removed lines 
as well.) Then I could actually yank this into my destination and it 
would work. Copying the removed lines would mean I need to go and remove 
them manually, only now I've lost the "-" indicator that tells me which 
lines are removed.




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 18:29:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 14:29:26 2023
Received: from localhost ([127.0.0.1]:54857 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXnAz-0003Jy-Vf
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 14:29:26 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51172)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qXnAx-0003Jl-KG
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 14:29:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qXnAp-0006TJ-Vj; Sun, 20 Aug 2023 14:29:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=rFPHEapnxTIP6CPmqPPv75F4Tf5/b7J2LppVP04b8KY=; b=HyOBXMSswe7D
 5i4gPHBV1ZuG0gaqoAqyq/m1DaAuXcmMyLfDH99ad/5p6GWCd8aWSvKNgv4HdNl+wO/2CEQ3FfT+N
 RAyJpdAQodfnHbHx00fIkVXzWDTHfD3PwSIfzPe9tl1QWuMnF30vnqYEU4mJbxa3zj6WTQM6Z4zub
 MXOg0N8Bg+rvYI9i/iwXJwddzI/wUPA1FiegZydPRUzGeCTJKGos9i6emqh9Un//hacaKMHH4uz3F
 9fyrrloy4Kl18kiOwOPUm9bl+op6pWpBa0yAXiEPl+kLQYMtiKm9N76RPeWWERbJJ8u51UnryF/aH
 rTDcn8kGagkYQfbcq5wvrg==;
Date: Sun, 20 Aug 2023 21:29:29 +0300
Message-Id: <83a5ulwos6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <87a5ultvuy.fsf@HIDDEN> (message from Philip Kaludercic on
 Sun, 20 Aug 2023 18:24:53 +0000)
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <86o7j2qgmc.fsf@HIDDEN> <83cyzhwpcj.fsf@HIDDEN>
 <87a5ultvuy.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, juri@HIDDEN
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: -3.3 (---)

> From: Philip Kaludercic <philipk@HIDDEN>
> Cc: Juri Linkov <juri@HIDDEN>,  65380 <at> debbugs.gnu.org
> Date: Sun, 20 Aug 2023 18:24:53 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> From: Juri Linkov <juri@HIDDEN>
> >> Cc: Philip Kaludercic <philipk@HIDDEN>,  65380 <at> debbugs.gnu.org
> >> Date: Sun, 20 Aug 2023 19:30:03 +0300
> >> 
> >> Regarding the implementation, there is the function
> >> 'diff-hunk-text', but it's limited to one hunk only.
> >
> > So is the proposed new function, isn't it?
> 
> No, the current proposal doesn't have any special handling for text
> between hunks.

AFAIU, the function you proposed removes the first character from each
line in the region, so how will it handle multiple hunks?

Or maybe I misunderstood what you meant by "No"?




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 18:25:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 14:25:11 2023
Received: from localhost ([127.0.0.1]:54846 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXn6s-0003Di-VR
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 14:25:11 -0400
Received: from mout02.posteo.de ([185.67.36.66]:55713)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qXn6q-0003DN-GG
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 14:25:09 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id C8336240109
 for <65380 <at> debbugs.gnu.org>; Sun, 20 Aug 2023 20:25:00 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1692555900; bh=CD229m9Mz1W6/NubH7PqWOzyZx9C0AZL8ZsYnFipwmc=;
 h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From;
 b=HGzlmVUheMGbvcSeFmVhbg/5HX5rfrLfdFILn2bPeTAv0SUsArLylKOj194bmhcbj
 IxFn0LHexbF7ELykd76QFhSSN2tWgycQUKeayRDxU61PZg/+iHEBp1ZHZzoj8oh+/s
 YCrnswYTvqBDgYG50nHaa3/hTI42JJZ7V9k9BQ1sPOP4wEixZbjGymDxrcXuzeovMS
 HyfOU/1MIxZEh4hZL7ZuvdwNpOWBWXAO5eJ3N+JEzWz1KdfJgG2iHxEd6+IBoymVRi
 E4oqSo8qOo1uhQ7Jvw6G5rThgksdiJw9IvejrlBJsw6EdFYK3BgSz46xBzBv1lNyx7
 TTCGLfEn9BMrw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4RTPCp6tYZz6tx5;
 Sun, 20 Aug 2023 20:24:54 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83cyzhwpcj.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 20 Aug
 2023 21:17:16 +0300")
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <86o7j2qgmc.fsf@HIDDEN> <83cyzhwpcj.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Sun, 20 Aug 2023 18:24:53 +0000
Message-ID: <87a5ultvuy.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
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: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Juri Linkov <juri@HIDDEN>
>> Cc: Philip Kaludercic <philipk@HIDDEN>,  65380 <at> debbugs.gnu.org
>> Date: Sun, 20 Aug 2023 19:30:03 +0300
>> 
>> Regarding the implementation, there is the function
>> 'diff-hunk-text', but it's limited to one hunk only.
>
> So is the proposed new function, isn't it?

No, the current proposal doesn't have any special handling for text
between hunks.




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 18:17:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 14:17:12 2023
Received: from localhost ([127.0.0.1]:54839 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXmz9-000325-WE
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 14:17:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42988)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qXmz7-00031o-4Q
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 14:17:10 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qXmyy-0004YK-V9; Sun, 20 Aug 2023 14:17:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=NNUt2i+45AJ5yP4EuswZzQ9TNi6x6UZYjK4IbX8EMUQ=; b=DtdV8B7x1llP
 63BOyLSXVYe8VTZrVfvkHTouhAdBpb9J5I6FwEntDwBDSp/DJFhgv1k01IoS8rU8HrscRxGKrINRh
 Xe+chFE71jGBeEqDjrWooGXbLRzfMEtQ4GKFNRoLGzcfIpMs9b7ejFVTfdWa5+hMLbVsOrW6/4s8h
 VKERZrkwlNoY3qxB+QinUmPR8o4WtQBNqAYSi+hlUGZII9o1NsXOB3xaN+M4gdMVl23o04IMNuP+B
 EtKgO1BaHv1tJEzLKRGH+wuolQiHnoytHr1LuHOCVmHECrWwuyOcRypUaDunvRIa46DmNEZcXI5Xh
 aX3Vz/cE2eAMgZ+MvU0Ltw==;
Date: Sun, 20 Aug 2023 21:17:16 +0300
Message-Id: <83cyzhwpcj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86o7j2qgmc.fsf@HIDDEN> (message from Juri Linkov on
 Sun, 20 Aug 2023 19:30:03 +0300)
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
 <86o7j2qgmc.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, philipk@HIDDEN
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: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: Philip Kaludercic <philipk@HIDDEN>,  65380 <at> debbugs.gnu.org
> Date: Sun, 20 Aug 2023 19:30:03 +0300
> 
> Regarding the implementation, there is the function
> 'diff-hunk-text', but it's limited to one hunk only.

So is the proposed new function, isn't it?




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 17:27:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 20 13:27:40 2023
Received: from localhost ([127.0.0.1]:54751 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXmDD-0004ta-LQ
	for submit <at> debbugs.gnu.org; Sun, 20 Aug 2023 13:27:39 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:45749)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qXmDB-0004tJ-NL
 for 65380 <at> debbugs.gnu.org; Sun, 20 Aug 2023 13:27:38 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 5B0D620003;
 Sun, 20 Aug 2023 17:27:27 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83r0nyyhlz.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 19 Aug
 2023 22:09:12 +0300")
Organization: LINKOV.NET
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
Date: Sun, 20 Aug 2023 19:30:03 +0300
Message-ID: <86o7j2qgmc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>
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.7 (-)

>> > But diffs don't necessarily show the entire body/ies of function(s),
>> > they show just part of them.  So this seems to be useful only in a
>> > very small subset of cases?
>>
>> In theory yes, but as I mentioned in my first message, it comes up
>> surprisingly often, at least to the degree that I think it would be
>> something nice to have in general.  If you think the current
>> implementation is too primitive, one could extend it to check if the
>> region is a subregion of a hunk, and handle that appropriately.
>
> I'd like to hear from more people who will find this useful enough to
> have in Emacs.  My first thought was that this is something you should
> keep as your local extension, but maybe I'm mistaken.

Sometimes it's useful to copy the plain text from the diff
without applying the patch.  Regarding the implementation, there is
the function 'diff-hunk-text', but it's limited to one hunk only.
So another variant would be to extend 'diff--filter-substring'
that conditionally could modify the kill-ring-save filter
depending on a new customizable variable.
Although for some strange reason, the filter is not applied
when using the region.  I think this is a bug, or at least
a misfeature.




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 00:59:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 20:59:25 2023
Received: from localhost ([127.0.0.1]:52514 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXWmq-0008Q7-IR
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 20:59:24 -0400
Received: from sonic311-32.consmr.mail.ir2.yahoo.com ([77.238.176.164]:34867)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mardani29@HIDDEN>) id 1qXWmm-0008Pr-2N
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 20:59:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048;
 t=1692493152; bh=70gn0EU5PYqdTnT2pZXZrusJSHG/+5d7R5LiciAETj8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To;
 b=fETN9WXMJGxjuskvqFQ1hGmxw6dQSRiJl0ZnWCW6r5AqVWNFNmG3jOt4+rcxa2jV0k8Rx0IeVijn/OOR6nukdGxDdwE14TDNIngzlTmxoaRqkhmVMC6hgmYdPVn7zU0BSjjtgVW8elNXFgKoCIzK0fB8IBrzngrXK83zUS6yxcMntOlb4e484ImhsrDsw+miKy3VitlwQGyRfphnHZg4kHL4HO07mfnoI3qAVz55unjePKptH74Vn2aP35m0+XhC2iOFBTIKkUnPugrN79ulrmpJy13MH7WYJ3UsmuocUDHJ3TiMaVhYwq4sJOef9hmUZA2RpEoIJyw+SoLoqs/ApA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1692493152; bh=xTpTyBmiBjBBi6wYoHjjFhxqfwzt4fH58VnlmE6aJb+=;
 h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
 b=V9ksP+5m5tfBJSVDBUEMft8FDyWq0TKJ8ekFdUDf5xQgEqTPtVgWqQA5LIYiB8OgmGUuw5n1EwmtNDAHEx7U/OKWNEKsBbUCrkw2rGd2qRkZJboeyJ+8dNOicM3j3EFgO6oYWU3/wQD3eMPRLbFjO0p1F3+mIckrqxz46Ds09Rd+wZeE/ATABvNSD27ZGS6e8HVvkRf4SPACyWsmIprjpbIM+xX+1khkklJEcRYk8vj/cQO2rv+dyXLrqTajQaTRXeKqg4efwYDwyl6PhA+McZYZQ/X0v0s2SaOfLsCkOayeW3RrNmQrorFdU0HFFJyZ4cpR6gvdA2P1YJ9B4JA76A==
X-YMail-OSG: FpcAoRYVM1mQDRX6.Sf9gyBEKCIMCRUaXgrqIbJ7EmBT7V4bQAIOK_yVro2948h
 2jncJQJYdDbnbwzijgtGG3T.HqJxdzj4yF2sw6skikf2KsrDExgRXSzqU5ipJWitFAiZSeIxWfl.
 yA1a50IQFn4x7bDnJHRD6WOp6zipw84McdRTXu2qRd1j1WDR.Uqpk6XbHf8HbCZ5L30Oc4Xcjwy6
 ebyBGy7E3ZFacTx8fI.kiLHW_BggUpEV5v2Tam4PbAhXSFbJxavF9RIwkgwCx8ekTQlvCoFQAFdq
 3r00qCv5zkeEV8gpmQIy2xekkdRzm_te7q_I7xA8JutVKjqEakAvkAKq5c9bJGPnT7EG9S0oNiys
 3jCe3Id2H9iQzWq3hocSeK5X.Sh3sZBMfzsQpQjcr9y0kjEh4b4xmchYCjw7i_JK8b77TSFZ54kl
 blHuZc.m.Rq5OrtQwPzkE2UvX6r2xRZemoGwXmRNKFtOUabbJ0QhPGHhZGEgz40l8VH7.uyq2cga
 BvcRkPICT1Zy.KFsv72m6VtMoXuwxrM_yDF7kF4fA2e91f39t6hrOJHrN8TRhyR7R7MODPBKA6L8
 pnPTVKxeIfwH60dKfV8g2Xgqv.nY84AAX.OkWPabP86WDdo3TwhZRq1QbTYj0UdGjs5lVSkP.O9y
 7NrvTbxZygx..u2XId29aiiUNoZldmAx4JG1MBsUr1Y._3kj.fUsdDw5wdELYhGNKEE8aOvnPe_Y
 PuOryCMm3oOCSRwbXkfH5nlN_3cE0NMRjmoJ6Y5xeh_yuXvNL6Iuyb2IVY6FPHpU.MXFK1zIu30g
 _K7rNAYL.u7z7PLxnt7zvYWGewfHfbrxkHTP_cx2MpP0NAdjtFz2o2C2u_6x3cxfWI6Ww98uDxsj
 1O.VsIRRqJsGvLoZGEVuiVXC3BMXfDQCz_Mmve.0yJLYPk5TP2uclWzsrebQr9HTf8s52JuL4aRO
 2IuoLWFsNAdkiVGbt9bHp4jU9s2onUN7mbq6PyqlFuhbDtf.lvektZcCbN84ayFNDb_r76snwcV2
 XRPUJFTvfGm79v4.pOT0voa4VUIi5UgP7DFwppdiHpFF2YSgylKutnaBa4vL2XmWPsKccCluVlh1
 DtZGV3uAcwOdAGLRZbOcHh_3oEWDzDpG_OF33cSctA5ijkxsXClDOEP1b.Ol0DUOC.yseDh3RU4G
 Tg_N6kiwMZH3RXIcSOlejGSD8kZ0ribfquvIo1g0zMaxAODEpxvnj_DPGYieihDCEVynFA3n3LIG
 K3cVSaN9nzyePrXxNm9XW4jeVaoOwUyyzzf_0kyn9iScFW_emw5sxA.jbpgjk6Ad1PzrPdMiFQf_
 DkEcmx5b0aK2vZw5MKhjXwzCauY2lXOKREX6MMVsCi.dLxEDdRMqURW.ct2CL.t5M4Vki2vl3uvX
 P0P.14OFdJ6HTSTuqPEsGJsIMrV3B42g1uPaS4A2m_5BXTvwZvfsWu63UUM8peXUrUr6qvY.SxEa
 xUIUeEpkZj9Um9p2ZxUw7lr5pHBMxovc3ahXOErx8l7PmSIzLC.qTWwX2jhJWynAKEPbHd8Pgc0M
 qGuFLWu1vr4odzDEcyKe0OyVjuMWoZGqPcOLLTIw2glpEtPdaPqsvbQMJ4.Qx70SfT_qV4uPqyUH
 y7hAShjrQYz2sqhu7VpomfuPqQLF2cxqe8TpnFgGfz1rSTPl4i0ep5Tp.C..qV2bFlCu9ry0NFdS
 tXyGeVk2hNQ7mlMGKF8oPD0vYT6Z_.IxO3VBvFEgbZghjaEk2KNxGJUYLsRjDAkBPE40oKyxNjsz
 D3IduF473OGDoapJqBsn1ziKDfaN6yqk7sopgKZG28HGEoxj0ZIeQG2SlutpmtzMc5MjBQf7RktT
 CkSiE_v3oJszGpVkiABW_rpYg.X6dNmHtGJ3jozzgaIu1oBlup20GR32q5TfJ6q.1lp84Z65Prxf
 8KP8z3eEst39T9MGyjbN7wS4Lzy_GJCpIOhQB4cZNemC9blMmOzoJEvcdQ01s6DZuQIN4g20YKyd
 4ya4JBK2zkk5.dEUtNXtgayyvk3Pai8GvJdXuyQ6gv4hBb5gtnQ7.BnYxCBwB2j4LTVxPLSgi06Q
 yhu92dTUe.CuR9Gq3grkt6zNfOp0KuUW0cmQ1Uo7fk32TB8rLQ2ns6JLpLZiIsF7kHTRCOKZmnzd
 _q0l.K60H6AwfPedN4b6z1Ih28wQZfGGV4.wd7JuZHc9JfwNpAzlJnCy7GNpMHrU1aFXGEmY_J_s
 mrLifsZ8Wv9bkJ5xII3k7gb2svZtSO..R5GPikCVKfA--
X-Sonic-MF: <mardani29@HIDDEN>
X-Sonic-ID: ec789e3f-df73-4a91-af53-324fb41c2258
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic311.consmr.mail.ir2.yahoo.com with HTTP; Sun, 20 Aug 2023 00:59:12 +0000
Received: by hermes--production-ir2-5cc57b9c45-v4w2n (Yahoo Inc. Hermes SMTP
 Server) with ESMTPA ID 009cc9cbb3a5a4c96946e16ae78c0988; 
 Sun, 20 Aug 2023 00:59:07 +0000 (UTC)
From: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <87ttsvwdv2.fsf@HIDDEN> (Philip Kaludercic's message of "Sat, 
 19 Aug 2023 10:00:49 +0000")
References: <87wmxrwe6h.fsf@HIDDEN> <87ttsvwdv2.fsf@HIDDEN>
Date: Sun, 20 Aug 2023 02:59:06 +0200
Message-ID: <m17cpqmsv9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Mailer: WebService/1.1.21732
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 1330
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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: -0.8 (/)

Philip Kaludercic <philipk@HIDDEN> writes:

> +(defun diff-kill-ring-save (beg end)
> +  "Save contents of the region between BEG and END akin to `kill-ring-save'.
> +The contents of a region will not include diff indicators at the
> +beginning of each line."
> +  (interactive (list (region-beginning) (region-end)))
> +  (let ((at-bol (save-excursion (goto-char beg) (bolp)))
> +        lines)
> +    (save-restriction
> +      (narrow-to-region beg end)
> +      (goto-char (point-min))
> +      (while (not (eobp))
> +        (let ((line (thing-at-point 'line t)))
> +          ;; In case the user has selected a region that begins
> +          ;; mid-line, we should not chomp off the first character.
> +          (if (and (null lines) (not at-bol))
> +              (push line lines)
> +            (push (substring line 1) lines)))
> +        (forward-line)))
> +    (let ((region-extract-function
> +           (lambda (_) (apply #'concat (nreverse lines)))))
> +      (kill-ring-save beg end t))))
>

As an alternative implementation, to avoid creating lots of intermediate
substrings, we could check if we're inside a hunk and, if so, perform a
regular expression replace to remove the diff indicators.  If the region
covers text outside of a hunk, then we could copy the text normally, as
if the user pressed M-w.




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

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


Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 00:41:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 20:41:17 2023
Received: from localhost ([127.0.0.1]:52509 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXWVI-00080E-LW
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 20:41:17 -0400
Received: from sonic301-20.consmr.mail.ir2.yahoo.com ([77.238.176.97]:37028)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mardani29@HIDDEN>) id 1qXWVG-000800-2e
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 20:41:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048;
 t=1692492066; bh=aOovPnEmbXLVEMURlWY5ivTS9/B+znPIfk+LyOmfEB4=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To;
 b=OBijYddfc2M/yvZeiELASHFOsaYTA2WAp3OQGMtoV4zc9gpii2yQJdwpmsRvXE2K59gXSaQhsSljfruP97BfY8AWdOYJSiZHinmDBm6IoyhlBXbUDWqfaAfYauZC+reIWeGeARlFaKZLPCH0OkP5baTwDKx/M1RxIGnK/rnPUbVPl8GP819LG7JXCXMeb40qkJeW92A2ED4BtYFNncZ7EXWLlJrz6FUjWBR7KMd/Uy5bNed5vDWlm6yZ5d8LfyE2Dp41dJHAsaiVXw6h8ls8Tf3TzMaIadU9HOJI1x7NZISrTKMQh3yI7OouXcZH4L65rBjJb+/TzKtIZIQEy97r8Q==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1692492066; bh=F9WuCc8wyDGNe+UFfUmk6IRQ9LVioR6wRwdIJ9lx5YP=;
 h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
 b=t6MM4fX43fO2fr93kQalM0crppu9FlURnLWqD1i4qXiSWDjZv+HBel2dWzchhQDOm/BMLnY363rM3te2o4Xfjrg1KVGxKzd1/rYyRE55kI8J+5IrtVklqNDK7/aALquQgV82SLQof44OWP3lf133e/qC0WqEmCGRuagGu+VurIgn5NtkIQNx4E5cGAr1K5p0IYQfCK9TBfbvvByVefTLKHicg3RJQRjCGSzaXlI4jL3yHbat6JcYVd9z8UQQCNfaR0mJlWU1Ge485If7W4Ovrj3uNwjAqLnCdaxHNdTSdYj/cgLxshIi5TOYDFSC5+Nyt8RXL/RzjTMzsSj0phMqnA==
X-YMail-OSG: U1.bXawVM1nX4F3g3DOOyMe9yvKjGQFpDO3Am5Vzh1oSlJmkOcg9Oq4V5qKN4Sb
 92H4BaeurMekvssqVOwPw027F1RFvUXoTyDhnGEJd13dZM8Y94czkizr4McwMiQSDBYPq_k1t9qa
 aiHSLwA.8OYvHbLsW.jzXB1kFi2c2BBHjy8vjGSG1j1Ts.eUIMSjhrdE14FPJDU5Ap8sECPYoMWH
 aPlyyTP6Ql7KeREJDJjQN7DruktUA9AErEhQBZCw9Hvic093FiChUs55eQiFy6YyPHeUCzp1Da3B
 l5CloAnjtktvYFGnig7wapBmfjmYhoYKy4QlRBLIRPySf3Mg5a7VxW2OtFPRNlmGMgwo0gU9iEiE
 l1O8gspSPA8vANceHdXv54bSS52tIsFj7wiWQhPYx3ifBdtwILbc8Y0zXpprTU6.JOtlO4uoS2Lc
 GENVZx4g82xuxJULIVOIRFbsOYcWoJZJ.1_VxJMukIlzS..upw52HAiQKIlsHobv5u2ZruUDsr0N
 skynPv2duhOs6aL0qVB0.kRdeFGxnlxJPECu8y8326rArrgiOE2b2SSLQ4Bn60akyh5iWfyUbi3u
 PQajC0hzpl5.jY3QX7oqjtFSEGREW4BYqAwavnEtG5Cu7TlszgNn6vYbox59Oa9lXdOSYoFboYIY
 hzKs2Gm_koLnI8NqJN8CLdM25GwkhDFqtVHDcSI7xIlzB5XyXEYjJtoQbQUdmryy4uBDpZGjIBf2
 i4SXU9vKCYhrVGkBBVm9nljppJVwIVN87PFLIvHXQzqHFiLbuhhj3mnCaA1H.R4ovBHvmvvUFXZ0
 UyLicTZ0LFQYnNeQ6E8LZAcOhkEmHGy_p6TBTZeCYEJJqL8BPABg1h.TFfCU6RxA.ahYrthwk2Bj
 0.qLtwijsQ9KScDbLCQ3riX9JyGew4dPSO406q3DX92TR6KY62O6Ch_kzMo_uBkoqz41_YKbR5bC
 Q.S0kWLibmgeV8LFf_Yp8_apQVEmKIunorfrPLqYTfvyrbvGL3AB.6qnyjIhir2sWJiUcNOlY3Un
 x8VoW_xwj16A5m93EZeW1qg4YtYL9Nd_11jKd.NDp1IVKidDhy5DaOrxIrdjwPEBzSv2N36gTzF.
 KSFTJDXeew4HdmEoe00X6BiLNcXpxvmPrWvhgnAyFD9z.iGFFnrHM_2q.ODjpXXntqoxUl4Awac3
 6O52yZhkwS0hnu0.NhJviSrDlDgdijDFp_9yCVu0zoHnKfxOHHg3EP0emCLvW8BV4laIW_ApafOq
 moww71UcXnIDjdS8mEVw8Od1ILZnxiW0pES_yAZdItsGVB6APfRo2qBDy22QRdODXzo16UxEkaHV
 j3DSjj9rP4tpGcndXG3zYxhP4Qhw.cnHAl.XApPwxMVB_vecYvhT0xnoWT_fQRHN6btUlc4WASv1
 A83IBYVSoDLe4vTDqfOshybAqaNx2CYvKoQ0pwfuCb8xdmjOT.BezLEdQMvUXN9n6EqTrrULG6R9
 honLNe4hU2G8KhhmWBa4lDFB3s.pcaT7hseVDXPYOYf.DLYGn3N6DucII5Auk3ypY3NO3hgxGnhh
 x1NEYqMBxgfxrche78RXoUH9bQos60s5wrsz4DVFV6o2zoFQnsZSYxFzeo6htM5Ewxd8Oasm5Tkp
 U73ss4TMgmRxc5E3S_Va_JYY4eCRgR_QWCbqYbaEsH8pGF9r1kYCQalqkBfiAwm4V4i93cYpT8iN
 zosEQi1_UzEGAM_R7TcVROBQtbO8vPqj67n7QQLc4sgZ8oVaido8cwTsfWg0HkocFY5pE4WVYxCY
 ljlGJrdO8wdfZxsBAyZPZ3cctzuu43IAobqk9Uw4ox7q7NOILV92s7cZFJGed_GQl2Hdv8oMeN4S
 IzG6RS5499u3KD8i.yRxnBcS6yQHS9hrStSNBQpU4f.jG8_S4NwPqfJ1lh.D9uSrZCB.p40EKfMe
 3D2zuHANDFB3n_7lRSrF151tOdIMdbRgkvDz5XZyLN5bLCVgMZho8pJLsVBGr1G7Bq.nqD5k31hm
 AP7dq7kKBIkoOC00W5AeKHwKuxTKMb22ByZ0xT80NJ3eMn03uoXXIbSFkP6c95Co5mU33SiuLoi6
 yyla3ZAxE3WNwiRB0_G3OsGzELndQ0_VbJYnbY6f2.0wmjHy3ZZipWa2paoJGOhkC_OtAbquhF29
 WGHIrgePOjhPAzaVIVwMXmX.mx3VDkIekLFyiQe0zCiqSselyAv0qUqJoVCdJ98asn74PafS99TO
 ee.PhFeHEwM9mslCqfcW4SDhmXoDf2Xj9LImC8pOb8Bzl
X-Sonic-MF: <mardani29@HIDDEN>
X-Sonic-ID: 5afd7344-6c74-495e-95a8-9a50c2008414
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic301.consmr.mail.ir2.yahoo.com with HTTP; Sun, 20 Aug 2023 00:41:06 +0000
Received: by hermes--production-ir2-5cc57b9c45-mk5d2 (Yahoo Inc. Hermes SMTP
 Server) with ESMTPA ID 1aceae9d232e5d2e57eeb4fe0cae2681; 
 Sun, 20 Aug 2023 00:41:05 +0000 (UTC)
From: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83r0nyyhlz.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 19 Aug
 2023 22:09:12 +0300")
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
Date: Sun, 20 Aug 2023 02:41:04 +0200
Message-ID: <m1bkf2mtpb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Mailer: WebService/1.1.21732
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 1066
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>
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.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Philip Kaludercic <philipk@HIDDEN>
>> Cc: 65380 <at> debbugs.gnu.org
>> Date: Sat, 19 Aug 2023 15:45:13 +0000
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> > But diffs don't necessarily show the entire body/ies of function(s),
>> > they show just part of them.  So this seems to be useful only in a
>> > very small subset of cases?
>> 
>> In theory yes, but as I mentioned in my first message, it comes up
>> surprisingly often, at least to the degree that I think it would be
>> something nice to have in general.  If you think the current
>> implementation is too primitive, one could extend it to check if the
>> region is a subregion of a hunk, and handle that appropriately.
>
> I'd like to hear from more people who will find this useful enough to
> have in Emacs.  My first thought was that this is something you should
> keep as your local extension, but maybe I'm mistaken.

I'd find this command useful.  When I copy parts of a diff for other
purposes, I usually have to remove the diff markers manually.




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 22:49:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 18:49:37 2023
Received: from localhost ([127.0.0.1]:52436 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXUlF-0005IZ-Gx
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 18:49:37 -0400
Received: from qs51p00im-qukt01080502.me.com ([17.57.155.23]:34921)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <salutis@HIDDEN>) id 1qXUlB-0005IG-C1
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 18:49:36 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai;
 t=1692485366; bh=WB3oC8uyHA/GOB3i6OcrSpKBiEQnSGULvikxqMzJ+M8=;
 h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type;
 b=JTSZMagyEg4EqPjFMRMOE5uGmZBtWSkBZGeWYechXS98UZpRZQ06Hx07e4dF/FE5z
 OMxxabHyaq9Np6FkyI35fKVfAmcPjkszWpS+/ibzVnB+PwaKeSmc6CNpfeAb/+Srd9
 Nwg4A2W41+kaPQeyb8qy4+7OsDl5uC2wMiiubx6m0wAIvlkiEA9zQRUNNw6fq+/7Lg
 rPNvTKqIskamcrIZmZcWJreT8lAJD+M+xQFrhiUeoUCugGcv9ibhzdWUOfGjBasJ/5
 MPg3plFtIsdrFJ8PS+UHQoJWW7TKqFXf83vML1tqMuOW8uyfLfYa8vpt2mhhz4EFui
 XsqLFvRZi6i0Q==
Received: from Rudolfs-MacBook-Air.local (qs51p00im-dlb-asmtp-mailmevip.me.com
 [17.57.155.28])
 by qs51p00im-qukt01080502.me.com (Postfix) with ESMTPSA id 71A6F4E401CD;
 Sat, 19 Aug 2023 22:49:25 +0000 (UTC)
From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <salutis@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83r0nyyhlz.fsf@HIDDEN>
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
Date: Sun, 20 Aug 2023 00:49:15 +0200
Message-ID: <m2jztqtzpw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-GUID: NDR2agK99N1pYdvzgB2HUoGYTtjYuTu2
X-Proofpoint-ORIG-GUID: NDR2agK99N1pYdvzgB2HUoGYTtjYuTu2
X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?=
 =?UTF-8?Q?2903e8d5c8f:6.0.138,18.0.790,17.11.62.513.0000000_definitions?=
 =?UTF-8?Q?=3D2022-01-12=5F02:2020-02-14=5F02,2022-01-12=5F02,2021-12-02?=
 =?UTF-8?Q?=5F01_signatures=3D0?=
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0
 mlxlogscore=925
 clxscore=1011 suspectscore=0 mlxscore=0 adultscore=0 bulkscore=0
 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2212070000 definitions=main-2308190221
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> I'd like to hear from more people who will find this useful enough to
> have in Emacs.  My first thought was that this is something you should
> keep as your local extension, but maybe I'm mistaken.

I, too, find myself removing those +/- signs quite often.

Rudy
--=20
"One can begin to reason only when a clear picture has been formed in
the imagination."
-- Walter Warwick Sawyer, Mathematician's Delight, 1943

Rudolf Adamkovi=C4=8D <salutis@HIDDEN> [he/him]
Studenohorsk=C3=A1 25
84103 Bratislava
Slovakia




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 21:01:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 17:01:26 2023
Received: from localhost ([127.0.0.1]:52398 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXT4Y-0002cu-6G
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 17:01:26 -0400
Received: from out2-smtp.messagingengine.com ([66.111.4.26]:50981)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <spwhitton@HIDDEN>) id 1qXT4U-0002cg-Ni
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 17:01:25 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.nyi.internal (Postfix) with ESMTP id 5DA5B5C00A8;
 Sat, 19 Aug 2023 17:01:16 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Sat, 19 Aug 2023 17:01:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name;
 h=cc:cc:content-type:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to; s=fm3; t=1692478876; x=
 1692565276; bh=CHFIs3B/R7ylnw7ohivkpf6uabku7F4UFTjPEq6+VNQ=; b=P
 Ym6VxjLomXSDR3YhZlZ8OqTNR7VmP+dRE3n8TwlOyTk9linU4BoydXL7xNoe9bQe
 LnrOgF0LvsEBPeWD3Gao8rHVog/+xN7slWyMPR19o+A52e7yDLRvaqve0rYfH0Cz
 Hpav8IGdphn+HwFRbMjEVdkFM6T8zgWp82xN19fsbmgsmnbvvqbRkS0bIFj+euk2
 xjQJnB9jRwNIVmHPfKbXGg82lXrzRmBgesj1HXp/qIO+Ajr2pY/H0EsU46ALWUOQ
 35HQT4tvq/eBh44VBT3DY+WQJF+ulKrqBYQJ5UWedlwhz/sln2NVlJMm1blVpbPo
 A4GZIKhaFCWJK8lCAftAw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:sender:subject
 :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm1; t=1692478876; x=1692565276; bh=CHFIs3B/R7yln
 w7ohivkpf6uabku7F4UFTjPEq6+VNQ=; b=ZB8iXaU1WUnNfrbE7ia2JruFGnzvx
 tnHjRWqfy+dF9JkPKzWQg0G70mQV2VVT4A8Mf7NGPBNi8uqWqHwBrg3El6Tcz8SA
 NLW2G9WidBtI8RifzEnn/Js24fvEz4vOWbsR5PZVi2MvXsDPWVl8SUh9RttPb9jN
 YGL6mbbvMliEpYKgvezepoWVA9VJI/qqtVfGDi8jn4eAZ93dw846d7Sub/w5Atgk
 hBw7qPOwYqhvpPrt9pjD0fUaPDH3hxTdBS4lmOYkQP7zzZsbjO895OQE2aH4j/mf
 vBuDSQ8eqFtSXWoWddajTRLmS5CClbWOFhGKksEVFkDLehhV1QbRgkI4Q==
X-ME-Sender: <xms:my3hZJgNlmzOCoqBhjtzKee4pR9IfP1Pxd6Lmqt353G6ECf1sLtuvw>
 <xme:my3hZOB1MKx3dkxOQkNUEY2s-OqJ2L8MK5kyFbniQvOBHuMMoQpfTCI6MfWKcXD7h
 fyyhsW3WcPHiOXPjg>
X-ME-Received: <xmr:my3hZJHIabxw1M38fwX_CVzyQhwsBCWNBRjK_GjSOqE98Ve7hJRMidO3U4GPN3t7LTg-59rHhuQZ5_1rhI65rK7SgviLA-bMAzeJ1qfVCRt3MaZx9ma08oQ4EgDV3w1jdYD4j5bh>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudduhedgudehkecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggr
 nhcuhghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg
 eqnecuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedu
 keeggeelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg
 hilhhfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv
X-ME-Proxy: <xmx:nC3hZOQXzCsLgkF8HFLdbrFDQyIbLVyqe2ON3ZiQcv7hvdhCmg5vKw>
 <xmx:nC3hZGzI0P1qG-D4jdzvzjq473vNYwBEvy02mGfzg1ZgLrFks5C9DA>
 <xmx:nC3hZE76bJIWeOfwM9ua8WMj3qVPUuaJTTp1eUKOOEJFBmITEn5gWQ>
 <xmx:nC3hZLq7cJMo1xz3jWaGSDqwn0ekldOSSVZns4zKIe3azbJLbB4WoA>
Feedback-ID: i23c04076:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 19 Aug 2023 17:01:15 -0400 (EDT)
Received: by melete.silentflame.com (Postfix, from userid 1000)
 id DC6877ECACA; Sat, 19 Aug 2023 22:01:12 +0100 (BST)
From: Sean Whitton <spwhitton@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83r0nyyhlz.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 19 Aug
 2023 22:09:12 +0300")
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
Date: Sat, 19 Aug 2023 22:01:12 +0100
Message-ID: <87r0ny927b.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>
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.7 (-)

Hello,

On Sat 19 Aug 2023 at 10:09pm +03, Eli Zaretskii wrote:

> I'd like to hear from more people who will find this useful enough to
> have in Emacs.  My first thought was that this is something you should
> keep as your local extension, but maybe I'm mistaken.

This comes up for me in Debian packaging work, and I would like to have
this feature.  The diff contains the addition of a new test, say.  I
want to copy the test into a version of the package that's different
from the one the patch was originally prepared for.

-- 
Sean Whitton




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 19:30:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 15:30:46 2023
Received: from localhost ([127.0.0.1]:52316 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXRen-00006z-M8
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 15:30:45 -0400
Received: from mout02.posteo.de ([185.67.36.66]:48763)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qXRei-00006c-Vj
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 15:30:44 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 8C4C7240101
 for <65380 <at> debbugs.gnu.org>; Sat, 19 Aug 2023 21:30:33 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1692473433; bh=nfEif4S0GkqFYqmTuKhXg3lxRS0S0L9RKJ/C2wBcEks=;
 h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From;
 b=SdnxE74BcbNYPEjLkD5djBe+6wgOfsaX4t5Swk9jaZhh5xbpyOmpJOrOE12N+s97H
 Ki3do5wKQVxb9qgf/hD8d4m7tonmuQw6ylmeLCgH8JkR04+fNsHdh4WYVvWbV3k3zY
 mfQLNUHgCuxgUDY0RlGxkC/B8WLiZN0dcQgonaKyRe8QM6JwbYkcjE029ysfcluR9E
 tUuLmxttO31KJcdY0TAPLVkZvHF2nPFcVywuxXihJS4k6aC1+z9GZnB4KRksEgYXw6
 b5/Aog/blCDKaDDmfbuPxpdRkH1p1IZu2220hQI34jS15VSXGfQYjJO4a4n+5gke72
 VSZirSBRD/Yxw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4RSpjw1h1Bz9rxH;
 Sat, 19 Aug 2023 21:30:27 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83r0nyyhlz.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 19 Aug
 2023 22:09:12 +0300")
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN> <83r0nyyhlz.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Sat, 19 Aug 2023 19:30:27 +0000
Message-ID: <87v8davnho.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Philip Kaludercic <philipk@HIDDEN>
>> Cc: 65380 <at> debbugs.gnu.org
>> Date: Sat, 19 Aug 2023 15:45:13 +0000
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> > But diffs don't necessarily show the entire body/ies of function(s),
>> > they show just part of them.  So this seems to be useful only in a
>> > very small subset of cases?
>> 
>> In theory yes, but as I mentioned in my first message, it comes up
>> surprisingly often, at least to the degree that I think it would be
>> something nice to have in general.  If you think the current
>> implementation is too primitive, one could extend it to check if the
>> region is a subregion of a hunk, and handle that appropriately.
>
> I'd like to hear from more people who will find this useful enough to
> have in Emacs.  My first thought was that this is something you should
> keep as your local extension, but maybe I'm mistaken.

I have no problem with that, and there is no urgency in applying this
patch.




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 19:09:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 15:09:11 2023
Received: from localhost ([127.0.0.1]:52293 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXRJu-00081N-Kh
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 15:09:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:48068)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qXRJr-00081A-SI
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 15:09:09 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qXRJj-0008G8-Ii; Sat, 19 Aug 2023 15:08:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=F8ujw6TXl7D2GOlk0UXhwNXBPvn/qPsZMUNQdtzdp/0=; b=relKHu6tIwh9
 YlLWfN/VSI/fA09kdV71shBetDaN1D8L/8TnZ+XmPRVeXQ42KDLoQ0L6DMpI6yaCRPoacJ6dW83og
 86IZOyHjwBf+M+597cJTdJ0uD2pwiS19PimEkHOiVdvaw87l3pJjUP5RWzndgOmUB5OYfQ3AuH18m
 urIHyio5S0dKrbFWkkhqCAGRTl++jd/mo0xCTXp1QtTM1xcdnRDzOXwBBWjRWq7leoYn1qUuB5xpA
 3xD9EJI4aW/rhmdYxsnLao8VRe4pXWH3z23J78d48Cz0c4qTeJ1Meq/WOvt7VJgXlbEhLoGQIHhEA
 OT0XQXYmZ+WbXv3S91hEWw==;
Date: Sat, 19 Aug 2023 22:09:12 +0300
Message-Id: <83r0nyyhlz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <87jztrvxx2.fsf@HIDDEN> (message from Philip Kaludercic on
 Sat, 19 Aug 2023 15:45:13 +0000)
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
 <87jztrvxx2.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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: -3.3 (---)

> From: Philip Kaludercic <philipk@HIDDEN>
> Cc: 65380 <at> debbugs.gnu.org
> Date: Sat, 19 Aug 2023 15:45:13 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > But diffs don't necessarily show the entire body/ies of function(s),
> > they show just part of them.  So this seems to be useful only in a
> > very small subset of cases?
> 
> In theory yes, but as I mentioned in my first message, it comes up
> surprisingly often, at least to the degree that I think it would be
> something nice to have in general.  If you think the current
> implementation is too primitive, one could extend it to check if the
> region is a subregion of a hunk, and handle that appropriately.

I'd like to hear from more people who will find this useful enough to
have in Emacs.  My first thought was that this is something you should
keep as your local extension, but maybe I'm mistaken.




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 15:45:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 11:45:29 2023
Received: from localhost ([127.0.0.1]:52143 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXO8m-0002jP-I1
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 11:45:29 -0400
Received: from mout02.posteo.de ([185.67.36.66]:37589)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qXO8h-0002j2-Bx
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 11:45:26 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id EBC08240101
 for <65380 <at> debbugs.gnu.org>; Sat, 19 Aug 2023 17:45:15 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1692459916; bh=iQxwLhDaCKysTVnSOgFqwaZCbDE13WiM/1tauMMoe60=;
 h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From;
 b=SjfxWT6s7D2DLirdbUanriwKl561wqPhZ9oCYF4kupdFjkdj8dZgQofHcME9A6BE6
 +rNZ+IepqwxpuHqSJHswjnBTyP+KeudnyeH7w0PGx6bpNkKK7eamg9fD5a3+c84tEL
 Jen0YY+lzzlAw+kToOKNErNGu5zcU/+92mcxBDdblPD7TTcPkPorCudC3AuX3O6tv2
 kkw92FbyHNVL6bcpz9H/dbzxM3qF9ojBhg9XgOhvix2faep4JnmsE5BCAY6gMfmIKr
 4cxDAP/B2vI6jzrnThHfU+88lx/pkTfHebV5VQqJ0YjrvhdGW6FnrCiky3yq4ubVQH
 7qg8pLM7bHT5A==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4RSjk313r5z9rxH;
 Sat, 19 Aug 2023 17:45:14 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83lee7z3xs.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 19 Aug
 2023 14:06:55 +0300")
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN> <83lee7z3xs.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Sat, 19 Aug 2023 15:45:13 +0000
Message-ID: <87jztrvxx2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Philip Kaludercic <philipk@HIDDEN>
>> Cc: 65380 <at> debbugs.gnu.org
>> Date: Sat, 19 Aug 2023 10:48:03 +0000
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> > Please tell more about the use cases where this would be useful.  I
>> > couldn't understand that from the patch itself.
>> 
>> A simple example is where someone sends me a patch with a Elisp function
>> I'd like to evaluate.  If I can't or don't want to apply the patch right
>> now, I can use `diff-kill-ring-save' to copy the function without the
>> leading "+" into my scratch buffer and evaluate it there.
>
> But diffs don't necessarily show the entire body/ies of function(s),
> they show just part of them.  So this seems to be useful only in a
> very small subset of cases?

In theory yes, but as I mentioned in my first message, it comes up
surprisingly often, at least to the degree that I think it would be
something nice to have in general.  If you think the current
implementation is too primitive, one could extend it to check if the
region is a subregion of a hunk, and handle that appropriately.




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 11:06:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 07:06:56 2023
Received: from localhost ([127.0.0.1]:49591 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXJnD-0000s1-Vi
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 07:06:56 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:53618)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qXJn8-0000ri-8c
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 07:06:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qXJn1-0003YI-Fn; Sat, 19 Aug 2023 07:06:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=0oYO6idLpFfk3SHFcuaZpVt/CNU8iTqi0q2pNfpqt1g=; b=TDACzrSlmfrr
 kxYP6PfL1y16vuokL3c7s8noY1D6qN6mz+DRErMZVrfqLes+gkMzJn5XaNqw/1U24ec452yMeEG5X
 +79/ejJzydZDEIr5DOUReGJW6cSWDYDw5uUrJqe1LHQ2OWrjgOEcPba5UE9DBSB/+p0OXrTp9j5qC
 0GOANqtrTFrSn7RTEs3cS1bLiEAAJfchS+QQGSoXtOS0pLReYxEot/wFWfNKF0BqVD9Zt4Lv5/iyC
 Xiu3eHyBTtgSclJKrOabpQ0pXNLAc1Vgmy/8PhBFiOFERgAalAfqEQoJQc4Pu4KaEhU/56aC4Ylb8
 V+k/CzmMW8VjWsmXLMWz+w==;
Date: Sat, 19 Aug 2023 14:06:55 +0300
Message-Id: <83lee7z3xs.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <87pm3jwboc.fsf@HIDDEN> (message from Philip Kaludercic on
 Sat, 19 Aug 2023 10:48:03 +0000)
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
 <87pm3jwboc.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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: -3.3 (---)

> From: Philip Kaludercic <philipk@HIDDEN>
> Cc: 65380 <at> debbugs.gnu.org
> Date: Sat, 19 Aug 2023 10:48:03 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Please tell more about the use cases where this would be useful.  I
> > couldn't understand that from the patch itself.
> 
> A simple example is where someone sends me a patch with a Elisp function
> I'd like to evaluate.  If I can't or don't want to apply the patch right
> now, I can use `diff-kill-ring-save' to copy the function without the
> leading "+" into my scratch buffer and evaluate it there.

But diffs don't necessarily show the entire body/ies of function(s),
they show just part of them.  So this seems to be useful only in a
very small subset of cases?




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 10:48:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 06:48:16 2023
Received: from localhost ([127.0.0.1]:49574 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXJVA-0000NL-5W
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 06:48:16 -0400
Received: from mout01.posteo.de ([185.67.36.65]:60375)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qXJV7-0000MG-0S
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 06:48:14 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 72EED240028
 for <65380 <at> debbugs.gnu.org>; Sat, 19 Aug 2023 12:48:05 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1692442085; bh=s2EZ8s5CB1SvrEEo0RH4OfS6Qx/VhIyPQjlAJRnapSg=;
 h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From;
 b=fnZFpraV9ZsyLrxuXs4iW3DcUHh2JWmsypk+v2SPoUhFn6trVFKnJLB0eDynt5Q2M
 5etb74eyM15s9KgUfSVpQZTB3EsMIWksGRPu9MOlB7XLWMivVe9uf4OXvwk+dOcSTp
 73Sy+ALNu+NmTPJY/zh6VpEYkde9MoMC+5GUdspXcLJGOwHr6wFdU00IeXFMuulPyw
 XflRf6BdjWDtFs9P9szSPrH5aW5FgD7x7AWeQ3sn2G7JtMdngmHQUgAY7vDMteOdN+
 5ENX7qTCP3TwSdq52LHoRQKMA0x1f0uewTuvVE/3pViIGswxsOIv27tsNmo1EF6yTt
 QD+A0dBfLPmZA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4RSb784xV3z6tvs;
 Sat, 19 Aug 2023 12:48:04 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <83o7j3z4wm.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 19 Aug
 2023 13:46:01 +0300")
References: <87wmxrwe6h.fsf@HIDDEN> <83o7j3z4wm.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Sat, 19 Aug 2023 10:48:03 +0000
Message-ID: <87pm3jwboc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Philip Kaludercic <philipk@HIDDEN>
>> Date: Sat, 19 Aug 2023 09:53:58 +0000
>> 
>> This command solves a long-standing annoyance I have had when working
>> with diffs.  To my knowledge there is no existing way to achieve this
>> (rectangular selection might be possible, but that behaves differently
>> when the text is yanked).  The binding "w" seems intuitive when
>> contrasted with "M-w", but might be confused with "W" (widen).  Not sure
>> if that is an issue or not.
>
> Please tell more about the use cases where this would be useful.  I
> couldn't understand that from the patch itself.

A simple example is where someone sends me a patch with a Elisp function
I'd like to evaluate.  If I can't or don't want to apply the patch right
now, I can use `diff-kill-ring-save' to copy the function without the
leading "+" into my scratch buffer and evaluate it there.

> Thanks.




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 10:45:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 06:45:58 2023
Received: from localhost ([127.0.0.1]:49566 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXJSw-0000GH-Ic
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 06:45:58 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46048)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qXJSt-0000G1-O5
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 06:45:56 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qXJSn-0007JC-1W; Sat, 19 Aug 2023 06:45:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=0sKpy02Qeyv2cdsJ3V7j5FZGTWPRkLICmaJUHkXw6wA=; b=WMyHoXi7vypl
 C7J/clliWmGsy1LofSqV2VjAnrA7V+pAF4hludu5VWDed+IsZO422DyCMnyY20nIDUeWgyCpKtqKj
 l8rIC5oDVKFI2tJGvxEkRUc7UJ1A/IvcraXspA0c+y0c53GsTmJX5piqizrbC6REhts6W8mtxhnoi
 XWR5Ie3vr+J/4j/YJ3qSlPd+cg0Un678ZNdWpfbRnhmwdL5cu4+94wAT7RCwi8SmLWc9kLF261RBR
 n4Xw1nrHHxPD4EBdLOA2GFkqjZJtfJRB5GHLb9ixB74uRO0JysrMPprc2oOBFGPE2vvR/AV5E02Ew
 JAwnx2LvrCkopGbtDI2plA==;
Date: Sat, 19 Aug 2023 13:46:01 +0300
Message-Id: <83o7j3z4wm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <87wmxrwe6h.fsf@HIDDEN> (message from Philip Kaludercic on
 Sat, 19 Aug 2023 09:53:58 +0000)
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
References: <87wmxrwe6h.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
Cc: 65380 <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: -3.3 (---)

> From: Philip Kaludercic <philipk@HIDDEN>
> Date: Sat, 19 Aug 2023 09:53:58 +0000
> 
> This command solves a long-standing annoyance I have had when working
> with diffs.  To my knowledge there is no existing way to achieve this
> (rectangular selection might be possible, but that behaves differently
> when the text is yanked).  The binding "w" seems intuitive when
> contrasted with "M-w", but might be confused with "W" (widen).  Not sure
> if that is an issue or not.

Please tell more about the use cases where this would be useful.  I
couldn't understand that from the patch itself.

Thanks.




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

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


Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 10:01:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 06:01:01 2023
Received: from localhost ([127.0.0.1]:49528 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXIlQ-0007MK-Ro
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 06:01:01 -0400
Received: from mout02.posteo.de ([185.67.36.66]:51963)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qXIlO-0007M4-Mu
 for 65380 <at> debbugs.gnu.org; Sat, 19 Aug 2023 06:00:59 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 06CE0240103
 for <65380 <at> debbugs.gnu.org>; Sat, 19 Aug 2023 12:00:51 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1692439251; bh=7QjQZAnOQ+78ptjwOVuTHpL2ZROSuOTaV6sAZovZ44g=;
 h=From:To:Subject:Autocrypt:Date:Message-ID:MIME-Version:From;
 b=D27n95nBcpwp1rXWSyLLhK/Ns3t6kyjnEem3PglmjFs81k0NustT0P4qGo/jR4pvW
 +2P9TAJPkVgfDpIFcrr63B1gWVhT+1F4VkcMW9dP0ZdobWMb1yS0LXo4lfs/G1uGvb
 tO/5KPEbUC62w8vDk/Ea/45y3gY7MNN7wDeXwGxyVOJ9kUNyAQTG4DsmWdu3fcUCek
 IDDkioxzSLnoIyhiX5YXkdJkHA3YkCFgX9qPTeSjP9fhhQu3mUyc9Cj/ylnj67LXHC
 MHC+gF91HdDwetU0zZ+hUSCElqbIQPZYPbDSFOwrptikM3pKW4/x09Mbez2qVT7Y5T
 amHeQvyEKDa4A==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4RSZ4f4TmPz9rxF
 for <65380 <at> debbugs.gnu.org>; Sat, 19 Aug 2023 12:00:50 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: 65380 <at> debbugs.gnu.org
Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode
 buffer
In-Reply-To: <87wmxrwe6h.fsf@HIDDEN> (Philip Kaludercic's message of "Sat, 
 19 Aug 2023 09:53:58 +0000")
References: <87wmxrwe6h.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Sat, 19 Aug 2023 10:00:49 +0000
Message-ID: <87ttsvwdv2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65380
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: -3.3 (---)

--=-=-=
Content-Type: text/plain

Philip Kaludercic <philipk@HIDDEN> writes:

> Tags: patch
>
>
> This command solves a long-standing annoyance I have had when working
> with diffs.  To my knowledge there is no existing way to achieve this
> (rectangular selection might be possible, but that behaves differently
> when the text is yanked).  The binding "w" seems intuitive when
> contrasted with "M-w", but might be confused with "W" (widen).  Not sure
> if that is an issue or not.
>
> In GNU Emacs 30.0.50 (build 8, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.37, cairo version 1.16.0) of 2023-08-18 built on quetzal
> Repository revision: 2f74a459d2a82578fd9a92e9e2facdca90dad974
> Repository branch: feature/a-package-for-elpa
> System Description: Debian GNU/Linux 12 (bookworm)
>
> Configured using:
>  'configure --with-pgtk --with-native-compilation --with-imagemagick
>  --with-tree-sitter'

It seems I prepared to patch too hastily, and forgot to add a docstring.
Here is the updated version, with a docstring:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-command-to-copy-contents-in-a-diff-mode-buffer.patch

From fc39bd54ac93dbebec3b4c16aa1fe995cd421c92 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Sat, 19 Aug 2023 11:47:54 +0200
Subject: [PATCH] Add command to copy contents in a diff-mode buffer

* lisp/vc/diff-mode.el (diff-mode-shared-map): Bind 'diff-kill-ring-save'.
(diff-mode-map): Ensure the "w" binding does not get prefixed.
(diff-kill-ring-save): Add new command
* etc/NEWS: Mention 'diff-kill-ring-save'.
---
 etc/NEWS             |  7 +++++++
 lisp/vc/diff-mode.el | 24 +++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6588299c532..9ce510e0f81 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -276,6 +276,13 @@ This allows changing which type of whitespace changes are ignored when
 regenerating hunks with 'diff-ignore-whitespace-hunk'.  Defaults to
 the previously hard-coded "-b".
 
+---
+*** New command 'diff-kill-ring-save'.
+This command behaves like 'kill-ring-save', but removes change
+indicators ("+", "-") from the beginning of a line.  This is useful
+when you wish to copy part of the contents of a diff, but not the diff
+itself.
+
 ** Ediff
 
 ---
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index d776375d681..342d2d8ce90 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -195,6 +195,7 @@ diff-mode-shared-map
   "RET" #'diff-goto-source
   "<mouse-2>" #'diff-goto-source
   "W" #'widen
+  "w" #'diff-kill-ring-save
   "o" #'diff-goto-source                ; other-window
   "A" #'diff-ediff-patch
   "r" #'diff-restrict-view
@@ -207,7 +208,7 @@ diff-mode-map
           ;; We want to inherit most bindings from
           ;; `diff-mode-shared-map', but not all since they may hide
           ;; useful `M-<foo>' global bindings when editing.
-          (dolist (key '("A" "r" "R" "g" "q" "W" "z"))
+          (dolist (key '("A" "r" "R" "g" "q" "W" "w" "z"))
             (keymap-set map key nil))
           map)
   ;; From compilation-minor-mode.
@@ -2079,6 +2080,27 @@ diff-goto-source
       (goto-char (+ (car pos) (cdr src)))
       (when buffer (next-error-found buffer (current-buffer))))))
 
+(defun diff-kill-ring-save (beg end)
+  "Save contents of the region between BEG and END akin to `kill-ring-save'.
+The contents of a region will not include diff indicators at the
+beginning of each line."
+  (interactive (list (region-beginning) (region-end)))
+  (let ((at-bol (save-excursion (goto-char beg) (bolp)))
+        lines)
+    (save-restriction
+      (narrow-to-region beg end)
+      (goto-char (point-min))
+      (while (not (eobp))
+        (let ((line (thing-at-point 'line t)))
+          ;; In case the user has selected a region that begins
+          ;; mid-line, we should not chomp off the first character.
+          (if (and (null lines) (not at-bol))
+              (push line lines)
+            (push (substring line 1) lines)))
+        (forward-line)))
+    (let ((region-extract-function
+           (lambda (_) (apply #'concat (nreverse lines)))))
+      (kill-ring-save beg end t))))
 
 (defun diff-current-defun ()
   "Find the name of function at point.
-- 
2.39.2


--=-=-=--




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

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


Received: (at submit) by debbugs.gnu.org; 19 Aug 2023 09:54:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 19 05:54:13 2023
Received: from localhost ([127.0.0.1]:49522 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qXIeq-0007BP-Rw
	for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 05:54:13 -0400
Received: from lists.gnu.org ([2001:470:142::17]:56738)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qXIep-0007BD-V4
 for submit <at> debbugs.gnu.org; Sat, 19 Aug 2023 05:54:12 -0400
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 <philipk@HIDDEN>)
 id 1qXIei-0005Ui-Ua
 for bug-gnu-emacs@HIDDEN; Sat, 19 Aug 2023 05:54:05 -0400
Received: from mout01.posteo.de ([185.67.36.65])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philipk@HIDDEN>)
 id 1qXIeg-0005L9-94
 for bug-gnu-emacs@HIDDEN; Sat, 19 Aug 2023 05:54:04 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 5BACA240027
 for <bug-gnu-emacs@HIDDEN>; Sat, 19 Aug 2023 11:53:59 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1692438839; bh=ngzJykeBRSkwaym6sBdOFt60WPZiyGgYlVtxF8KAD4U=;
 h=From:To:Subject:Autocrypt:Date:Message-ID:MIME-Version:From;
 b=NxERapPzTZqex7V74MbA1WIQCNQ7ZYaLFdsRLVKSiZTBDcjmK79Fyj3DiEF4zWFdG
 zeWRd3cmpARznRznMi+DHruq0H9bTlxV7XFRGx85FNgrb5Tqsh6uCpWYquHzNjTZZK
 EnpCPBSCDw+ajSSgeAkl5WaTKmtLBklUb/44LgQrgcDXG9cW7EWnn2GrThkgiwprjX
 91vXa3smUuACcCeoJbMQuBKuP5vAvc59nmq+//+UefjyrktlRTRwuY4Fn2Kqu24A0S
 pGzt7HuBJcueYgEoJ8lTZZWUd5ov9CThc8R1cjoKqRrZKgbOoal94pcaIo9pg0009I
 p+uY6RJHcYtfw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4RSYwk6MRQz9rxD
 for <bug-gnu-emacs@HIDDEN>; Sat, 19 Aug 2023 11:53:58 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Add command to copy contents in a diff-mode buffer
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Sat, 19 Aug 2023 09:53:58 +0000
Message-ID: <87wmxrwe6h.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@HIDDEN;
 helo=mout01.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
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.0 (/)

--=-=-=
Content-Type: text/plain

Tags: patch


This command solves a long-standing annoyance I have had when working
with diffs.  To my knowledge there is no existing way to achieve this
(rectangular selection might be possible, but that behaves differently
when the text is yanked).  The binding "w" seems intuitive when
contrasted with "M-w", but might be confused with "W" (widen).  Not sure
if that is an issue or not.

In GNU Emacs 30.0.50 (build 8, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.16.0) of 2023-08-18 built on quetzal
Repository revision: 2f74a459d2a82578fd9a92e9e2facdca90dad974
Repository branch: feature/a-package-for-elpa
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-pgtk --with-native-compilation --with-imagemagick
 --with-tree-sitter'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Add-command-to-copy-contents-in-a-diff-mode-buffer.patch

From 9d755a12614fb9c1afe4dd88cecfbe16c3c009c4 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Sat, 19 Aug 2023 11:47:54 +0200
Subject: [PATCH] Add command to copy contents in a diff-mode buffer

* lisp/vc/diff-mode.el (diff-mode-shared-map): Bind 'diff-kill-ring-save'.
(diff-mode-map): Ensure the "w" binding does not get prefixed.
(diff-kill-ring-save): Add new command
* etc/NEWS: Mention 'diff-kill-ring-save'.
---
 etc/NEWS             |  7 +++++++
 lisp/vc/diff-mode.el | 22 +++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6588299c532..9ce510e0f81 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -276,6 +276,13 @@ This allows changing which type of whitespace changes are ignored when
 regenerating hunks with 'diff-ignore-whitespace-hunk'.  Defaults to
 the previously hard-coded "-b".
 
+---
+*** New command 'diff-kill-ring-save'.
+This command behaves like 'kill-ring-save', but removes change
+indicators ("+", "-") from the beginning of a line.  This is useful
+when you wish to copy part of the contents of a diff, but not the diff
+itself.
+
 ** Ediff
 
 ---
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index d776375d681..fce61837069 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -195,6 +195,7 @@ diff-mode-shared-map
   "RET" #'diff-goto-source
   "<mouse-2>" #'diff-goto-source
   "W" #'widen
+  "w" #'diff-kill-ring-save
   "o" #'diff-goto-source                ; other-window
   "A" #'diff-ediff-patch
   "r" #'diff-restrict-view
@@ -207,7 +208,7 @@ diff-mode-map
           ;; We want to inherit most bindings from
           ;; `diff-mode-shared-map', but not all since they may hide
           ;; useful `M-<foo>' global bindings when editing.
-          (dolist (key '("A" "r" "R" "g" "q" "W" "z"))
+          (dolist (key '("A" "r" "R" "g" "q" "W" "w" "z"))
             (keymap-set map key nil))
           map)
   ;; From compilation-minor-mode.
@@ -2079,6 +2080,25 @@ diff-goto-source
       (goto-char (+ (car pos) (cdr src)))
       (when buffer (next-error-found buffer (current-buffer))))))
 
+(defun diff-kill-ring-save ()
+  " "
+  (interactive)
+  (let ((at-bol (save-excursion
+                  (goto-char (region-beginning))
+                  (bolp)))
+        lines)
+    (save-restriction
+      (narrow-to-region (region-beginning) (region-end))
+      (goto-char (point-min))
+      (while (not (eobp))
+        (let ((line (thing-at-point 'line t)))
+          (if (and (null lines) (not at-bol))
+              (push line lines)
+            (push (substring line 1) lines)))
+        (forward-line)))
+    (let ((region-extract-function
+           (lambda (_) (apply #'concat (nreverse lines)))))
+      (copy-region-as-kill nil nil t))))
 
 (defun diff-current-defun ()
   "Find the name of function at point.
-- 
2.39.2


--=-=-=--




Acknowledgement sent to Philip Kaludercic <philipk@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#65380; 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: Tue, 22 Aug 2023 11:30:02 UTC

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