From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer Date: Sun, 20 Aug 2023 19:30:03 +0300 Organization: LINKOV.NET Message-ID: <86o7j2qgmc.fsf@mail.linkov.net> References: <87wmxrwe6h.fsf@posteo.net> <83o7j3z4wm.fsf@gnu.org> <87pm3jwboc.fsf@posteo.net> <83lee7z3xs.fsf@gnu.org> <87jztrvxx2.fsf@posteo.net> <83r0nyyhlz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3098"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 65380@debbugs.gnu.org, Philip Kaludercic To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 20 19:28:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qXmDq-0000fF-TM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Aug 2023 19:28:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXmDc-00060k-KR; Sun, 20 Aug 2023 13:28:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXmDa-0005zc-Gc for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 13:28:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qXmDa-0002cT-8L for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 13:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qXmDb-0004vx-UP for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 13:28:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Aug 2023 17:28:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65380 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65380-submit@debbugs.gnu.org id=B65380.169255246018826 (code B ref 65380); Sun, 20 Aug 2023 17:28:03 +0000 Original-Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 17:27:40 +0000 Original-Received: from localhost ([127.0.0.1]:54751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXmDD-0004ta-LQ for submit@debbugs.gnu.org; Sun, 20 Aug 2023 13:27:39 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:45749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXmDB-0004tJ-NL for 65380@debbugs.gnu.org; Sun, 20 Aug 2023 13:27:38 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 5B0D620003; Sun, 20 Aug 2023 17:27:27 +0000 (UTC) In-Reply-To: <83r0nyyhlz.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 22:09:12 +0300") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268010 Archived-At: >> > 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.