From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 05:54:13 2023 Received: (at submit) by debbugs.gnu.org; 19 Aug 2023 09:54:13 +0000 Received: from localhost ([127.0.0.1]:49522 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXIeq-0007BP-Rw for submit@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 ) id 1qXIep-0007BD-V4 for submit@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 ) id 1qXIei-0005Ui-Ua for bug-gnu-emacs@gnu.org; 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 ) id 1qXIeg-0005L9-94 for bug-gnu-emacs@gnu.org; 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 ; 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 ; Sat, 19 Aug 2023 11:53:58 +0200 (CEST) From: Philip Kaludercic To: bug-gnu-emacs@gnu.org Subject: [PATCH] Add command to copy contents in a diff-mode buffer Autocrypt: addr=philipk@posteo.net; 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@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; 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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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 "" #'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-' 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 06:01:01 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 10:01:01 +0000 Received: from localhost ([127.0.0.1]:49528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXIlQ-0007MK-Ro for submit@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 ) id 1qXIlO-0007M4-Mu for 65380@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@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@debbugs.gnu.org>; Sat, 19 Aug 2023 12:00:50 +0200 (CEST) From: Philip Kaludercic To: 65380@debbugs.gnu.org Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <87wmxrwe6h.fsf@posteo.net> (Philip Kaludercic's message of "Sat, 19 Aug 2023 09:53:58 +0000") References: <87wmxrwe6h.fsf@posteo.net> Autocrypt: addr=philipk@posteo.net; 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@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Philip Kaludercic 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 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 "" #'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-' 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 06:45:58 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 10:45:59 +0000 Received: from localhost ([127.0.0.1]:49566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXJSw-0000GH-Ic for submit@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 ) id 1qXJSt-0000G1-O5 for 65380@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 ) 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@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87wmxrwe6h.fsf@posteo.net> (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@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 06:48:16 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 10:48:16 +0000 Received: from localhost ([127.0.0.1]:49574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXJVA-0000NL-5W for submit@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 ) id 1qXJV7-0000MG-0S for 65380@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@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 To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83o7j3z4wm.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 13:46:01 +0300") References: <87wmxrwe6h.fsf@posteo.net> <83o7j3z4wm.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; 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@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 07:06:56 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 11:06:56 +0000 Received: from localhost ([127.0.0.1]:49591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXJnD-0000s1-Vi for submit@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 ) id 1qXJn8-0000ri-8c for 65380@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 ) 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@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87pm3jwboc.fsf@posteo.net> (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@posteo.net> <83o7j3z4wm.fsf@gnu.org> <87pm3jwboc.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: 65380@debbugs.gnu.org > Date: Sat, 19 Aug 2023 10:48:03 +0000 > > Eli Zaretskii 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? From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 11:45:29 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 15:45:29 +0000 Received: from localhost ([127.0.0.1]:52143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXO8m-0002jP-I1 for submit@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 ) id 1qXO8h-0002j2-Bx for 65380@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@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 To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83lee7z3xs.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 14:06:55 +0300") References: <87wmxrwe6h.fsf@posteo.net> <83o7j3z4wm.fsf@gnu.org> <87pm3jwboc.fsf@posteo.net> <83lee7z3xs.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; 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@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: 65380@debbugs.gnu.org >> Date: Sat, 19 Aug 2023 10:48:03 +0000 >> >> Eli Zaretskii 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 15:09:11 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 19:09:11 +0000 Received: from localhost ([127.0.0.1]:52293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXRJu-00081N-Kh for submit@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 ) id 1qXRJr-00081A-SI for 65380@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 ) 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@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87jztrvxx2.fsf@posteo.net> (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@posteo.net> <83o7j3z4wm.fsf@gnu.org> <87pm3jwboc.fsf@posteo.net> <83lee7z3xs.fsf@gnu.org> <87jztrvxx2.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: 65380@debbugs.gnu.org > Date: Sat, 19 Aug 2023 15:45:13 +0000 > > Eli Zaretskii 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 15:30:46 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 19:30:46 +0000 Received: from localhost ([127.0.0.1]:52316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXRen-00006z-M8 for submit@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 ) id 1qXRei-00006c-Vj for 65380@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@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 To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83r0nyyhlz.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 22:09:12 +0300") 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> Autocrypt: addr=philipk@posteo.net; 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@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: 65380@debbugs.gnu.org >> Date: Sat, 19 Aug 2023 15:45:13 +0000 >> >> Eli Zaretskii 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 17:01:26 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 21:01:26 +0000 Received: from localhost ([127.0.0.1]:52398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXT4Y-0002cu-6G for submit@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 ) id 1qXT4U-0002cg-Ni for 65380@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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudduhedgudehkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggr nhcuhghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg eqnecuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedu keeggeelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: 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 To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83r0nyyhlz.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 22:09:12 +0300") 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> Date: Sat, 19 Aug 2023 22:01:12 +0100 Message-ID: <87r0ny927b.fsf@melete.silentflame.com> 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@debbugs.gnu.org, Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 18:49:37 2023 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2023 22:49:37 +0000 Received: from localhost ([127.0.0.1]:52436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXUlF-0005IZ-Gx for submit@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 ) id 1qXUlB-0005IG-C1 for 65380@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?= To: Eli Zaretskii , Philip Kaludercic Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83r0nyyhlz.fsf@gnu.org> 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> Date: Sun, 20 Aug 2023 00:49:15 +0200 Message-ID: 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii 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 [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 20:41:17 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 00:41:17 +0000 Received: from localhost ([127.0.0.1]:52509 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXWVI-00080E-LW for submit@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 ) id 1qXWVG-000800-2e for 65380@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: 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?= To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83r0nyyhlz.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 22:09:12 +0300") 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> Date: Sun, 20 Aug 2023 02:41:04 +0200 Message-ID: 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@debbugs.gnu.org, Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: 65380@debbugs.gnu.org >> Date: Sat, 19 Aug 2023 15:45:13 +0000 >> >> Eli Zaretskii 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 20:59:25 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 00:59:25 +0000 Received: from localhost ([127.0.0.1]:52514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXWmq-0008Q7-IR for submit@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 ) id 1qXWmm-0008Pr-2N for 65380@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: 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?= To: Philip Kaludercic Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <87ttsvwdv2.fsf@posteo.net> (Philip Kaludercic's message of "Sat, 19 Aug 2023 10:00:49 +0000") References: <87wmxrwe6h.fsf@posteo.net> <87ttsvwdv2.fsf@posteo.net> Date: Sun, 20 Aug 2023 02:59:06 +0200 Message-ID: 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Philip Kaludercic 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 13:27:40 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 17:27:40 +0000 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 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 Received: by mail.gandi.net (Postfix) with ESMTPSA id 5B0D620003; Sun, 20 Aug 2023 17:27:27 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83r0nyyhlz.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 22:09:12 +0300") Organization: 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> Date: Sun, 20 Aug 2023 19:30:03 +0300 Message-ID: <86o7j2qgmc.fsf@mail.linkov.net> 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@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 14:17:12 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 18:17:12 +0000 Received: from localhost ([127.0.0.1]:54839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXmz9-000325-WE for submit@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 ) id 1qXmz7-00031o-4Q for 65380@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 ) 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@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <86o7j2qgmc.fsf@mail.linkov.net> (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@posteo.net> <83o7j3z4wm.fsf@gnu.org> <87pm3jwboc.fsf@posteo.net> <83lee7z3xs.fsf@gnu.org> <87jztrvxx2.fsf@posteo.net> <83r0nyyhlz.fsf@gnu.org> <86o7j2qgmc.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, philipk@posteo.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Juri Linkov > Cc: Philip Kaludercic , 65380@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? From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 14:25:11 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 18:25:11 +0000 Received: from localhost ([127.0.0.1]:54846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXn6s-0003Di-VR for submit@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 ) id 1qXn6q-0003DN-GG for 65380@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@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 To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83cyzhwpcj.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 20 Aug 2023 21:17:16 +0300") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; 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@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Juri Linkov >> Cc: Philip Kaludercic , 65380@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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 14:29:26 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 18:29:26 +0000 Received: from localhost ([127.0.0.1]:54857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXnAz-0003Jy-Vf for submit@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 ) id 1qXnAx-0003Jl-KG for 65380@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 ) 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@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87a5ultvuy.fsf@posteo.net> (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@posteo.net> <83o7j3z4wm.fsf@gnu.org> <87pm3jwboc.fsf@posteo.net> <83lee7z3xs.fsf@gnu.org> <87jztrvxx2.fsf@posteo.net> <83r0nyyhlz.fsf@gnu.org> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: Juri Linkov , 65380@debbugs.gnu.org > Date: Sun, 20 Aug 2023 18:24:53 +0000 > > Eli Zaretskii writes: > > >> From: Juri Linkov > >> Cc: Philip Kaludercic , 65380@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"? From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 15:48:05 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 19:48:05 +0000 Received: from localhost ([127.0.0.1]:54891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXoP6-0005ID-Qg for submit@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 ) id 1qXoP5-0005HB-8S for 65380@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@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@gmail.com> 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 , Philip Kaludercic 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> Content-Language: en-US From: Jim Porter In-Reply-To: <83r0nyyhlz.fsf@gnu.org> 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 16:13:59 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 20:13:59 +0000 Received: from localhost ([127.0.0.1]:54907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXooB-0005vV-Dy for submit@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 ) id 1qXoo9-0005vM-Uo for 65380@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 To: Jim Porter Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <3bee8689-f8b7-117e-0165-34df01366901@gmail.com> Message-ID: <22de08b62b5abe7309b8@heytings.org> 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> <3bee8689-f8b7-117e-0165-34df01366901@gmail.com> 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@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 16:45:31 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 20:45:31 +0000 Received: from localhost ([127.0.0.1]:54921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXpIh-0006fz-7d for submit@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 ) id 1qXpIf-0006fi-4z for 65380@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@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@gmail.com> 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 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> <3bee8689-f8b7-117e-0165-34df01366901@gmail.com> <22de08b62b5abe7309b8@heytings.org> From: Jim Porter In-Reply-To: <22de08b62b5abe7309b8@heytings.org> 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@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 17:29:48 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 21:29:49 +0000 Received: from localhost ([127.0.0.1]:54992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXpzY-0002ED-MG for submit@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 ) id 1qXpzW-0002E1-CR for 65380@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 To: Jim Porter Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <7896ab38-c938-2f08-806b-3543e8b64173@gmail.com> Message-ID: <22de08b62b886f50c32f@heytings.org> 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> <3bee8689-f8b7-117e-0165-34df01366901@gmail.com> <22de08b62b5abe7309b8@heytings.org> <7896ab38-c938-2f08-806b-3543e8b64173@gmail.com> 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@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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? From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 18:21:42 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 22:21:42 +0000 Received: from localhost ([127.0.0.1]:55040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXqnm-0003eD-Bl for submit@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 ) id 1qXqnj-0003dw-Pm for 65380@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@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: 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 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> <3bee8689-f8b7-117e-0165-34df01366901@gmail.com> <22de08b62b5abe7309b8@heytings.org> <7896ab38-c938-2f08-806b-3543e8b64173@gmail.com> <22de08b62b886f50c32f@heytings.org> From: Jim Porter In-Reply-To: <22de08b62b886f50c32f@heytings.org> 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@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 18:31:37 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 22:31:37 +0000 Received: from localhost ([127.0.0.1]:55049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXqxM-0003tm-Mq for submit@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 ) id 1qXqxK-0003td-Dw for 65380@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 To: Jim Porter Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: Message-ID: <22de08b62b10f30b4d4c@heytings.org> 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> <3bee8689-f8b7-117e-0165-34df01366901@gmail.com> <22de08b62b5abe7309b8@heytings.org> <7896ab38-c938-2f08-806b-3543e8b64173@gmail.com> <22de08b62b886f50c32f@heytings.org> 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@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 19:39:17 2023 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 23:39:17 +0000 Received: from localhost ([127.0.0.1]:55056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXs0q-0005Wj-KJ for submit@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 ) id 1qXs0n-0005WZ-M6 for 65380@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 To: Jim Porter Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <22de08b62b10f30b4d4c@heytings.org> Message-ID: <22de08b62bdcabe4be0b@heytings.org> 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> <3bee8689-f8b7-117e-0165-34df01366901@gmail.com> <22de08b62b5abe7309b8@heytings.org> <7896ab38-c938-2f08-806b-3543e8b64173@gmail.com> <22de08b62b886f50c32f@heytings.org> <22de08b62b10f30b4d4c@heytings.org> 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@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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? From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 20:34:54 2023 Received: (at 65380) by debbugs.gnu.org; 21 Aug 2023 00:34:54 +0000 Received: from localhost ([127.0.0.1]:55074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXssf-0006ta-PO for submit@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 ) id 1qXsse-0006tO-Ds for 65380@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@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@gmail.com> 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 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> <3bee8689-f8b7-117e-0165-34df01366901@gmail.com> <22de08b62b5abe7309b8@heytings.org> <7896ab38-c938-2f08-806b-3543e8b64173@gmail.com> <22de08b62b886f50c32f@heytings.org> <22de08b62b10f30b4d4c@heytings.org> <22de08b62bdcabe4be0b@heytings.org> From: Jim Porter In-Reply-To: <22de08b62bdcabe4be0b@heytings.org> 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@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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...) From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 22 07:06:42 2023 Received: (at 65380) by debbugs.gnu.org; 22 Aug 2023 11:06:42 +0000 Received: from localhost ([127.0.0.1]:58633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYPDe-0000qa-4Y for submit@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 ) id 1qYPDc-0000qM-4Z for 65380@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@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 To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83a5ulwos6.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 20 Aug 2023 21:29:29 +0300") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; 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@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: Juri Linkov , 65380@debbugs.gnu.org >> Date: Sun, 20 Aug 2023 18:24:53 +0000 >> >> Eli Zaretskii writes: >> >> >> From: Juri Linkov >> >> Cc: Philip Kaludercic , 65380@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. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 22 07:29:25 2023 Received: (at 65380) by debbugs.gnu.org; 22 Aug 2023 11:29:25 +0000 Received: from localhost ([127.0.0.1]:58660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYPZd-0001Wr-5r for submit@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 ) id 1qYPZb-0001Wd-2K for 65380@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 ) 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@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87fs4bgwuj.fsf@posteo.net> (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@posteo.net> <83o7j3z4wm.fsf@gnu.org> <87pm3jwboc.fsf@posteo.net> <83lee7z3xs.fsf@gnu.org> <87jztrvxx2.fsf@posteo.net> <83r0nyyhlz.fsf@gnu.org> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Tue, 22 Aug 2023 11:06:28 +0000 > > Eli Zaretskii writes: > > >> From: Philip Kaludercic > >> Cc: Juri Linkov , 65380@debbugs.gnu.org > >> Date: Sun, 20 Aug 2023 18:24:53 +0000 > >> > >> Eli Zaretskii writes: > >> > >> >> From: Juri Linkov > >> >> Cc: Philip Kaludercic , 65380@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? From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 07:50:07 2023 Received: (at 65380) by debbugs.gnu.org; 13 Sep 2023 11:50:07 +0000 Received: from localhost ([127.0.0.1]:60982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgONi-0005eb-Kp for submit@debbugs.gnu.org; Wed, 13 Sep 2023 07:50:06 -0400 Received: from mout02.posteo.de ([185.67.36.66]:60679) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgONf-0005dv-6Q for 65380@debbugs.gnu.org; Wed, 13 Sep 2023 07:50:05 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 3749B240103 for <65380@debbugs.gnu.org>; Wed, 13 Sep 2023 13:49:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1694605792; bh=KyNoeTdtmDBSs6MPhohWbjZk/B6UYtY8N0U/LKyR5vU=; h=From:To:Cc:Subject:Date:Message-ID:Autocrypt:MIME-Version: Content-Transfer-Encoding:From; b=QRChSWYFh4TOEPGVyeNOmkEB4qI7UesGiP638vRlPikFFsJEB7C2JMuGSy3zZ3vKM QEWhZK95u/wCOF9g/31QZLhIHMZBnY9on5TPUgf4fEhSr3bT5Oh/96d3++4fCNchUh H1zxtzpNFKemG8M74yO4XnjfJ5Fm8lGux5MVWOyuxDXATLdT5Cnedp9JqMMq2j/yro x6J+rHXYJ4NWGpB29urgE6+TIFY7Wdm3WyRF9m3B5O3ovLUGbZ+G0+58bnbq/nEBOB E4wnzjAMJeL1ZoaScDapDO+LRhbgEXjuZ6piFxaxU6Tc89CDMklxx4DuehrtqYOF+P b+ZlNly+qZMXg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RlzJv5zt0z6tvt; Wed, 13 Sep 2023 13:49:51 +0200 (CEST) From: Philip Kaludercic To: Daniel =?utf-8?Q?Mart=C3=ADn?= Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: ("Daniel =?utf-8?Q?Mart=C3=ADn=22's?= message of "Sun, 20 Aug 2023 02:59:06 +0200") Date: Sun, 20 Aug 2023 07:52:29 +0000 Message-ID: <87msymup4y.fsf@posteo.net> References: <87wmxrwe6h.fsf@posteo.net> <87ttsvwdv2.fsf@posteo.net> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.2 (-) Daniel Mart=C3=ADn writes: > Philip Kaludercic writes: > >> +(defun diff-kill-ring-save (beg end) >> + "Save contents of the region between BEG and END akin to `kill-ring-s= ave'. >> +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. What text would we want to copy outside of a hunk? Something like a patch commit message? From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 17 12:35:11 2024 Received: (at 65380) by debbugs.gnu.org; 17 Aug 2024 16:35:11 +0000 Received: from localhost ([127.0.0.1]:54877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfMOV-0006AW-9W for submit@debbugs.gnu.org; Sat, 17 Aug 2024 12:35:11 -0400 Received: from mout02.posteo.de ([185.67.36.66]:55541) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfMOR-00069t-8o for 65380@debbugs.gnu.org; Sat, 17 Aug 2024 12:35:09 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 4831C240104 for <65380@debbugs.gnu.org>; Sat, 17 Aug 2024 18:34:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1723912461; bh=OBjX0CpRDsSD0drVeBDe90xNCDNIEiXfr+MiBmrwbIk=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=hNeedueEpKxsQEz4O1hOkM4KabeHBmzWN9J2HzqUW7dCqWkF8NaXa/BZujwERxZh7 hUWylCW0Czt7O4LC/GURSoOz2EqUlWo4WHYRI0SzoFhvCWAIsvtAam8SI+28j6cqOf SL4CvlXnN7mxjXevMVGJTqONpbAUx4Ycfr0jtzmzw7MkuhqT7VS3Nc12lKu15h7ZoR mIQqFPdua4fPBuJsGKCcIbVa8Uq9xENjTW81QglFtuLMrxEoMwx1dRlU1sUAQ6xvpy YM8ZrnxBlvWFSVRKH5P7pZ7HkuKHUdOiTJDTCL9UoVf95BFiQN7s2BjLCGttICEfS+ RVUH8TeCskGuQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WmPZf4Zmvz6tsf; Sat, 17 Aug 2024 18:34:18 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <83fs4btiw1.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 22 Aug 2023 14:29:34 +0300") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Sat, 17 Aug 2024 16:34:17 +0000 Message-ID: <871q2n152u.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Tue, 22 Aug 2023 11:06:28 +0000 >> >> Eli Zaretskii writes: >> >> >> From: Philip Kaludercic >> >> Cc: Juri Linkov , 65380@debbugs.gnu.org >> >> Date: Sun, 20 Aug 2023 18:24:53 +0000 >> >> >> >> Eli Zaretskii writes: >> >> >> >> >> From: Juri Linkov >> >> >> Cc: Philip Kaludercic , 65380@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? Sorry for the unreasonably delay in responding to this message. I've finally come up with something acceptable: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-command-to-copy-contents-in-a-diff-mode-buffer.patch >From 463e555d2bd4837f02163ef3e93df85c7dc092da Mon Sep 17 00:00:00 2001 From: Philip Kaludercic 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'. --- lisp/vc/diff-mode.el | 46 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 81e8b23ee33..94e40f5900b 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -196,6 +196,7 @@ diff-mode-shared-map "RET" #'diff-goto-source "" #'diff-goto-source "W" #'widen + "w" #'diff-kill-ring-save "o" #'diff-goto-source ; other-window "A" #'diff-ediff-patch "r" #'diff-restrict-view @@ -208,7 +209,7 @@ diff-mode-map ;; We want to inherit most bindings from ;; `diff-mode-shared-map', but not all since they may hide ;; useful `M-' 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. @@ -2108,6 +2109,49 @@ diff-goto-source (goto-char (+ (car pos) (cdr src))) (when buffer (next-error-found buffer (current-buffer)))))) +(defun diff-kill-ring-save (beg end &optional reverse) + "Save contents of the region between BEG and END akin to `kill-ring-save'. +By default the command will copy the text that applying the diff would +produce, along with the text between hunks. If REVERSE is non-nil, or +the command was invoked with a prefix argument, copy the deleted text." + (interactive (list (region-beginning) (region-end) + current-prefix-arg)) + (unless (derived-mode-p 'diff-mode) + (user-error "Command can only be invoked in a diff-buffer")) + (revert-buffer) ;refresh the diff + (let ((parts '())) + (save-excursion + (goto-char beg) + (catch 'break + (while t + (let ((hunk (diff-hunk-text + (buffer-substring + (save-excursion (diff-beginning-of-hunk)) + (save-excursion + (min (diff-end-of-hunk) end))) + (not reverse) + (save-excursion + (- (point) (diff-beginning-of-hunk)))))) + (push (substring (car hunk) (cdr hunk)) + parts)) + ;; check if we have copied everything + (diff-end-of-hunk) + (when (< end (point)) (throw 'break t)) + ;; copy the text between hunks + (let (start) + (save-window-excursion + (save-excursion + (forward-line -1) + (diff-goto-source) + (forward-line +1) + (setq start (point)))) + (save-window-excursion + (diff-goto-source) + (push (buffer-substring start (point)) + parts)))))) + (kill-new (string-join (nreverse parts))) + (setq deactivate-mark t) + (message "Copied text"))) (defun diff-current-defun () "Find the name of function at point. -- 2.46.0 --=-=-= Content-Type: text/plain This will also copy text between hunks. I've tested it a bit, but I am sure someone else here might find some edge-cases. -- Philip Kaludercic on peregrine --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 18 11:30:18 2024 Received: (at 65380) by debbugs.gnu.org; 18 Aug 2024 15:30:18 +0000 Received: from localhost ([127.0.0.1]:56498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfhrF-0001bO-Tb for submit@debbugs.gnu.org; Sun, 18 Aug 2024 11:30:18 -0400 Received: from mout01.posteo.de ([185.67.36.65]:40325) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfhrD-0001b8-8x for 65380@debbugs.gnu.org; Sun, 18 Aug 2024 11:30:16 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 93E25240028 for <65380@debbugs.gnu.org>; Sun, 18 Aug 2024 17:29:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1723994968; bh=MbclzdMuWINrgMI4zJWkywJL3WekMM2HuXNZj94PyYw=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=aaOhDGk1fbLU3uzGDBRA9O2QISe4zyeE5lBm5FvNnL0g93UByZDUNph7SXPo+/RSP LtsxQSKZgcO2rkk0/CzEkRS6Pf5YwWhYMN86LjWsUq+QIb7hgkPeXz1jUhTwqFVuZB ctj1xUQTiuBkulJ0u1q1h3HE0X5M+3foMhj2d4OngNdrZRxc7FJl66UDJv2yAY56je Qh4ID04bNVI2Akridxb7PtM7jJkjBkSk+ypS9V3bLVlf4IotIohdhPaZ3en8SHqhjN cagCBYCV2OKrvg2GwL+Td0XAxWk7ZDjvFy7Ez/F1P4cd5zCeQ+v80Gby5x2+5gSbeD 2le+OxVc105nw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Wn05M2xpBz9rxG; Sun, 18 Aug 2024 17:29:26 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <871q2n152u.fsf@posteo.net> (Philip Kaludercic's message of "Sat, 17 Aug 2024 18:34:17 +0200") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Sun, 18 Aug 2024 15:29:25 +0000 Message-ID: <87frr1zw6i.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Philip Kaludercic writes: > + ;; copy the text between hunks > + (let (start) > + (save-window-excursion > + (save-excursion > + (forward-line -1) > + (diff-goto-source) > + (forward-line +1) > + (setq start (point)))) One issue I still have here is that the `forwarad-line' might scroll the window, which `save-window-excursion' doesn't restore. To fix this I have written a general macro for subr.el to restore the scroll position: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Add-new-macro-to-restore-the-scroll-position-of-a-wi.patch >From c289c114ac381105cb550b3805041ad5cf5e61a5 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 18 Aug 2024 17:26:01 +0200 Subject: [PATCH 2/2] Add new macro to restore the scroll position of a window * lisp/subr.el (save-window-start): Add macro. --- lisp/subr.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/subr.el b/lisp/subr.el index 9ea18ca5bff..003e27f2ad7 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4922,6 +4922,16 @@ save-window-excursion (unwind-protect (progn ,@body) (set-window-configuration ,c))))) +(defmacro save-window-start (&rest body) + "Execute BODY, then restore the starting position of the selected window." + (declare (indent 0) (debug t)) + (let ((window (make-symbol "window")) + (start (make-symbol "start"))) + `(let* ((,window (selected-window)) + (,start (window-start ,window))) + (unwind-protect ,(macroexp-progn body) + (set-window-start ,window ,start t))))) + (defun internal-temp-output-buffer-show (buffer) "Internal function for `with-output-to-temp-buffer'." (with-current-buffer buffer -- 2.46.0 --=-=-= Content-Type: text/plain and updated the previous patch accordingly (+ some other minor improvements): --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-command-to-copy-contents-in-a-diff-mode-buffer.patch >From 4565d12cdcbdb22c316f741e656d5388e880201c Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 19 Aug 2023 11:47:54 +0200 Subject: [PATCH 1/2] 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-beginning-of-hunk-position, diff-end-of-hunk-position): New utility functions. (diff-kill-ring-save): Add the command. * etc/NEWS: Mention 'diff-kill-ring-save'. (Bug#65380) --- lisp/vc/diff-mode.el | 59 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 81e8b23ee33..2a41862e363 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -196,6 +196,7 @@ diff-mode-shared-map "RET" #'diff-goto-source "" #'diff-goto-source "W" #'widen + "w" #'diff-kill-ring-save "o" #'diff-goto-source ; other-window "A" #'diff-ediff-patch "r" #'diff-restrict-view @@ -208,7 +209,7 @@ diff-mode-map ;; We want to inherit most bindings from ;; `diff-mode-shared-map', but not all since they may hide ;; useful `M-' 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. @@ -630,6 +631,22 @@ diff-end-of-hunk ;; The return value is used by easy-mmode-define-navigation. (goto-char (or end (point-max))))) +(defun diff-beginning-of-hunk-position (&optional try-harder) + "Call `diff-end-of-hunk' without moving. +The optional argument TRY-HARDER is passed on to +`diff-beginning-of-hunk'." + (save-excursion + (save-window-excursion + (diff-beginning-of-hunk try-harder)))) + +(defun diff-end-of-hunk-position (&optional style donttrustheader) + "Call `diff-end-of-hunk' without moving. +The optional arguments STYLE and DONTTRUSTHEADER are passed on to +`diff-end-of-hunk'." + (save-excursion + (save-window-excursion + (diff-end-of-hunk style donttrustheader)))) + ;; "index ", "old mode", "new mode", "new file mode" and ;; "deleted file mode" are output by git-diff. (defconst diff-file-junk-re @@ -2108,6 +2125,46 @@ diff-goto-source (goto-char (+ (car pos) (cdr src))) (when buffer (next-error-found buffer (current-buffer)))))) +(defun diff-kill-ring-save (beg end &optional reverse) + "Save contents of the region between BEG and END akin to `kill-ring-save'. +By default the command will copy the text that applying the diff would +produce, along with the text between hunks. If REVERSE is non-nil, or +the command was invoked with a prefix argument, copy the deleted text." + (interactive (list (region-beginning) (region-end) current-prefix-arg)) + (unless (derived-mode-p 'diff-mode) + (user-error "Command can only be invoked in a diff-buffer")) + (revert-buffer t t t) ;refresh the diff + (let ((parts '())) + (save-excursion + (goto-char beg) + (catch 'break + (while t + (let ((hunk (diff-hunk-text + (buffer-substring + (diff-beginning-of-hunk-position) + (min (diff-end-of-hunk-position) end)) + (not reverse) + (- (point) (diff-beginning-of-hunk-position))))) + (push (substring (car hunk) (cdr hunk)) + parts)) + ;; check if we have copied everything + (diff-end-of-hunk) + (when (<= end (point)) (throw 'break t)) + ;; copy the text between hunks + (let ((inhibit-message t) start) + (save-window-excursion + (save-excursion + (forward-line -1) + (diff-goto-source t) + (forward-line +1) + (setq start (point)))) + (save-window-excursion + (diff-goto-source t) + (push (buffer-substring start (point)) + parts)))))) + (kill-new (string-join (nreverse parts))) + (setq deactivate-mark t) + (message (if reverse "Copied original text" "Copied modified text")))) (defun diff-current-defun () "Find the name of function at point. -- 2.46.0 --=-=-= Content-Type: text/plain -- Philip Kaludercic on peregrine --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 18 11:44:27 2024 Received: (at 65380) by debbugs.gnu.org; 18 Aug 2024 15:44:28 +0000 Received: from localhost ([127.0.0.1]:56515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfi4x-0001zc-IU for submit@debbugs.gnu.org; Sun, 18 Aug 2024 11:44:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfi4v-0001zO-PE for 65380@debbugs.gnu.org; Sun, 18 Aug 2024 11:44:26 -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 ) id 1sfi4A-0007ne-Vv; Sun, 18 Aug 2024 11:43:39 -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=arIdTFGTgeutDG88AGgP06HLtPFZIy9An2AUONS1Lg0=; b=noQYkeT5FrFM IaVbz/n8324Wk0dm+ef7B60e2lQjg/rRAuJkO9n9/y+laJNk6cqYgKy6wSQ4P0mM889nOcD4lgCzp c1ATk1ycRxkzmlSqP2/CoYl0HuZZys5dvAfxgnaJNloMeC+WRV8sjlcjKJUWCUbsw1my0jPgqEfg+ 6619ivD+e3lIedRwaSr/CvD5HYFYCjsHm8C6kOpvAW6I60iZRenv2mxtnfqiPsIh2RYgChjXZTyFf tPmsZlQKvQEEum28SdYMEIWlv/VEE2CS0YQReoPzbohW1e2+/804qBWYf3I4L9TCn3OujwdyeAcgY TiflaWDDU4RsftlxFRX7Dg==; Date: Sun, 18 Aug 2024 18:43:36 +0300 Message-Id: <864j7hzviv.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87frr1zw6i.fsf@posteo.net> (message from Philip Kaludercic on Sun, 18 Aug 2024 15:29:25 +0000) Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Sun, 18 Aug 2024 15:29:25 +0000 > > > + ;; copy the text between hunks > > + (let (start) > > + (save-window-excursion > > + (save-excursion > > + (forward-line -1) > > + (diff-goto-source) > > + (forward-line +1) > > + (setq start (point)))) > > One issue I still have here is that the `forwarad-line' might scroll the > window, which `save-window-excursion' doesn't restore. I don't understand what you are saying here. As long as a Lisp program runs and doesn't force redisplay (via sit-for or explicit calls to 'redisplay' or somesuch), forwarad-line cannot cause any scroll of the window, because what scrolls the window is redisplay when it kicks in and finds that point is outside of the window. So if the above code takes care to restore point before it finishes, the window won't scroll. Or what am I missing? > To fix this I have written a general macro for subr.el to restore > the scroll position: Let's first make sure we understand what happens here before we add such a macro. (It also has some conceptual problems of its own, but let's defer that until we actually sure it is needed.) From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 18 12:21:45 2024 Received: (at 65380) by debbugs.gnu.org; 18 Aug 2024 16:21:45 +0000 Received: from localhost ([127.0.0.1]:56545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfif3-0002wE-AA for submit@debbugs.gnu.org; Sun, 18 Aug 2024 12:21:45 -0400 Received: from mout01.posteo.de ([185.67.36.65]:42139) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfif1-0002vo-0J for 65380@debbugs.gnu.org; Sun, 18 Aug 2024 12:21:44 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 45A86240028 for <65380@debbugs.gnu.org>; Sun, 18 Aug 2024 18:20:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1723998056; bh=eKrUVzuIGvmK5awb5ZaWJ1RA88U5hWRCY7XvORUN760=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=YnBzaVsOnvtGZhE1erJrp/nKpsus5VlR29aHZHWTquAvlOMl0f59URIvJSqJ3k6P6 Ck34XjZLTNSCqlHpTloOZ8L6uDWAQoVeRC68nizkkkoNXvmWpvcOQ/or3MTcJ29lrv Aayc3+2AosW7zLuefRS7qS63G+kT8gVkG4cqtAch1yKbloMVU+AVaCP05X4roK5oXV n+j9+5JJ6cJz3GW3maeNOlGbzFOjJHhY8QBlfFyTfJJfA84Oz2vwMttB0Z335oLVma luZ/Mr34kTYI6v5lWTlvboRvZd8zUwXs7WOmIKtDEDYzeSw004sPDhtrD9ZXyIDPxN DnKHkULpyHXdg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Wn1Dk10Ctz6tvk; Sun, 18 Aug 2024 18:20:53 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <864j7hzviv.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Aug 2024 18:43:36 +0300") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Sun, 18 Aug 2024 16:20:52 +0000 Message-ID: <87bk1pztsr.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Sun, 18 Aug 2024 15:29:25 +0000 >> >> > + ;; copy the text between hunks >> > + (let (start) >> > + (save-window-excursion >> > + (save-excursion >> > + (forward-line -1) >> > + (diff-goto-source) >> > + (forward-line +1) >> > + (setq start (point)))) >> >> One issue I still have here is that the `forwarad-line' might scroll the >> window, which `save-window-excursion' doesn't restore. > > I don't understand what you are saying here. As long as a Lisp > program runs and doesn't force redisplay (via sit-for or explicit > calls to 'redisplay' or somesuch), forwarad-line cannot cause any > scroll of the window, because what scrolls the window is redisplay > when it kicks in and finds that point is outside of the window. So if > the above code takes care to restore point before it finishes, the > window won't scroll. Or what am I missing? No, you were right, and I manged to locate what was causing the issue. I had a (revert-buffer t t t) at the beginning of the function. Wrapping `save-window-start' around just that expression also prevented the displayed portion of the window from changing. Thinking about the proposal again, it might seem better to avoid calling `revert-buffer' in the first place. The problem I was concerned with was that if a .diff was outdated, jumping to the original file might not do the right thing and copy the wrong inter-hunk text. Now I realise that `revert-buffer' doesn't always help resolve this either, e.g. if copying text from an old .patch file. The proper solution would be to try and detect these kinds of inconsistencies and signal and error instead. >> To fix this I have written a general macro for subr.el to restore >> the scroll position: > > Let's first make sure we understand what happens here before we add > such a macro. (It also has some conceptual problems of its own, but > let's defer that until we actually sure it is needed.) It is not needed, but I would be interested in what the conceptual errors are. -- Philip Kaludercic on peregrine From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 18 14:01:14 2024 Received: (at 65380) by debbugs.gnu.org; 18 Aug 2024 18:01:14 +0000 Received: from localhost ([127.0.0.1]:56768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfkDK-0005yZ-0C for submit@debbugs.gnu.org; Sun, 18 Aug 2024 14:01:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49028) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfkDH-0005yI-PG for 65380@debbugs.gnu.org; Sun, 18 Aug 2024 14:01:12 -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 ) id 1sfkCW-0007w4-0h; Sun, 18 Aug 2024 14:00:24 -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=MXvf/CMM0SLokJxlHDd/lXQB6HCO8aVKZ2dWHpsAhvk=; b=Uu8eb4grkseA SEYMcx+qUBaxNFNO+a0YCkYehO+MRnkW/7v1VhKTVOtlC/EfvvdbAkcIsbgNr2zr8pns5mKjzbck3 a/VmeNKcQ2xcrldwuFluZxiAOsnoNXDzKpGUA7RrzGuCrnD30GdxKgaWERWL4vu3gLsUe33RI5zp0 CpyeBICIPBflnH6jsl25XtHnGVbARKU/ZQf4ak/1xVGNtgw+urtkiS6PteO+/vZuubmqQHGbSyYWn FQdIFmfI1Ttk4q4/qMhDm5Rn4jykC6k12YUovc0pto6RiyFZ3xHtxMqhfQLnzh35N0e3ABd1AIC1q 405XAns1EauKsdupDWZHxQ==; Date: Sun, 18 Aug 2024 21:00:19 +0300 Message-Id: <861q2lzp70.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87bk1pztsr.fsf@posteo.net> (message from Philip Kaludercic on Sun, 18 Aug 2024 16:20:52 +0000) Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Sun, 18 Aug 2024 16:20:52 +0000 > > >> To fix this I have written a general macro for subr.el to restore > >> the scroll position: > > > > Let's first make sure we understand what happens here before we add > > such a macro. (It also has some conceptual problems of its own, but > > let's defer that until we actually sure it is needed.) > > It is not needed, but I would be interested in what the conceptual > errors are. Forcing window-start has some side-effects that could look like bugs. For example, the window's vscroll is reset, and if the original window started its display with an overlay or display property, set-window-start will not necessarily restore the original display, due to boring technical issues. So my recommendation is to avoid calling set-window-start as a means to return to some previous display, because it is not guaranteed that you can do it like that. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 19 15:35:42 2024 Received: (at 65380) by debbugs.gnu.org; 19 Aug 2024 19:35:42 +0000 Received: from localhost ([127.0.0.1]:59271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sg8AH-0006Sf-Qv for submit@debbugs.gnu.org; Mon, 19 Aug 2024 15:35:42 -0400 Received: from mout01.posteo.de ([185.67.36.65]:53431) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sg8AE-0006SM-TR for 65380@debbugs.gnu.org; Mon, 19 Aug 2024 15:35:40 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id A00E3240029 for <65380@debbugs.gnu.org>; Mon, 19 Aug 2024 21:34:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1724096090; bh=kxsrsFR3GkhJmpPhR1C8MRbcqCHIX2kXfjSQiU4P6bw=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=M+wdiSFxWyciwwMY0kfvY2b8hUWJKDEjUyxzd4rNuIPhr70nPSyv93PjoE/e5dXNj c1mgLrJiJpPllZYKiTxQ2eOSSnN2tUNzarGIHL0nrHHOXr4g8IuaF9oMB58slDL4Lv 7ZcBzlM9x060/9Grs3poYWd57nbtN7auzbRSSPlnZP4vYD8OI8f3B2lSDzeeP4oGUQ v7uK2IuuekxBJQl6ksR/renI5TxrqJH7P41ipULjXgZRwUvJqYKVWpI4vcUkkvkIgv x3l+XqaSmZknhuPvpgPjFS5A9NWiEBeSM4gZOIl9Y16cnFzKLpRNxA3Nan+pt39q/X w37Dhgdu69cSQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WnjV11rh4z9rxM; Mon, 19 Aug 2024 21:34:48 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <861q2lzp70.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Aug 2024 21:00:19 +0300") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Mon, 19 Aug 2024 19:34:48 +0000 Message-ID: <87ed6kxq5j.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Sun, 18 Aug 2024 16:20:52 +0000 >> >> >> To fix this I have written a general macro for subr.el to restore >> >> the scroll position: >> > >> > Let's first make sure we understand what happens here before we add >> > such a macro. (It also has some conceptual problems of its own, but >> > let's defer that until we actually sure it is needed.) >> >> It is not needed, but I would be interested in what the conceptual >> errors are. > > Forcing window-start has some side-effects that could look like bugs. > For example, the window's vscroll is reset, and if the original window > started its display with an overlay or display property, > set-window-start will not necessarily restore the original display, > due to boring technical issues. > > So my recommendation is to avoid calling set-window-start as a means > to return to some previous display, because it is not guaranteed that > you can do it like that. OK, I understood and will keep it in mind for the future. Thank you for the background! I'm attaching the newest version of the patch here: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-command-to-copy-contents-in-a-diff-mode-buffer.patch >From b87daa72aa4f833001cd60be0d1f5cfe4064f717 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic 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-beginning-of-hunk-position, diff-end-of-hunk-position): New utility functions. (diff-kill-ring-save): Add the command. * etc/NEWS: Mention 'diff-kill-ring-save'. (Bug#65380) --- etc/NEWS | 9 +++++++ lisp/vc/diff-mode.el | 58 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index b89a80aa14d..e493c1bb035 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -210,6 +210,15 @@ The host name for Kubernetes connections can be of kind used. This overrides the setiing in 'tramp-kubernetes-namespace', if any. +** Diff + +--- +*** New command 'diff-kill-ring-save' +This command copies out the modified contents out of a diff, without +having to apply it first. If the selected range extends a hunk, the +commands attempts to look up and copy the text between from the +referenced file. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 81e8b23ee33..0f3b4c6b4d1 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -196,6 +196,7 @@ diff-mode-shared-map "RET" #'diff-goto-source "" #'diff-goto-source "W" #'widen + "w" #'diff-kill-ring-save "o" #'diff-goto-source ; other-window "A" #'diff-ediff-patch "r" #'diff-restrict-view @@ -208,7 +209,7 @@ diff-mode-map ;; We want to inherit most bindings from ;; `diff-mode-shared-map', but not all since they may hide ;; useful `M-' 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. @@ -630,6 +631,22 @@ diff-end-of-hunk ;; The return value is used by easy-mmode-define-navigation. (goto-char (or end (point-max))))) +(defun diff-beginning-of-hunk-position (&optional try-harder) + "Call `diff-end-of-hunk' without moving. +The optional argument TRY-HARDER is passed on to +`diff-beginning-of-hunk'." + (save-excursion + (save-window-excursion + (diff-beginning-of-hunk try-harder)))) + +(defun diff-end-of-hunk-position (&optional style donttrustheader) + "Call `diff-end-of-hunk' without moving. +The optional arguments STYLE and DONTTRUSTHEADER are passed on to +`diff-end-of-hunk'." + (save-excursion + (save-window-excursion + (diff-end-of-hunk style donttrustheader)))) + ;; "index ", "old mode", "new mode", "new file mode" and ;; "deleted file mode" are output by git-diff. (defconst diff-file-junk-re @@ -2108,6 +2125,45 @@ diff-goto-source (goto-char (+ (car pos) (cdr src))) (when buffer (next-error-found buffer (current-buffer)))))) +(defun diff-kill-ring-save (beg end &optional reverse) + "Save contents of the region between BEG and END akin to `kill-ring-save'. +By default the command will copy the text that applying the diff would +produce, along with the text between hunks. If REVERSE is non-nil, or +the command was invoked with a prefix argument, copy the deleted text." + (interactive (list (region-beginning) (region-end) current-prefix-arg)) + (unless (derived-mode-p 'diff-mode) + (user-error "Command can only be invoked in a diff-buffer")) + (let ((parts '())) + (save-excursion + (goto-char beg) + (catch 'break + (while t + (let ((hunk (diff-hunk-text + (buffer-substring + (diff-beginning-of-hunk-position) + (min (diff-end-of-hunk-position) end)) + (not reverse) + (- (point) (diff-beginning-of-hunk-position))))) + (push (substring (car hunk) (cdr hunk)) + parts)) + ;; check if we have copied everything + (diff-end-of-hunk) + (when (<= end (point)) (throw 'break t)) + ;; copy the text between hunks + (let ((inhibit-message t) start) + (save-window-excursion + (save-excursion + (forward-line -1) + (diff-goto-source t) + (forward-line +1) + (setq start (point)))) + (save-window-excursion + (diff-goto-source t) + (push (buffer-substring start (point)) + parts)))))) + (kill-new (string-join (nreverse parts))) + (setq deactivate-mark t) + (message (if reverse "Copied original text" "Copied modified text")))) (defun diff-current-defun () "Find the name of function at point. -- 2.46.0 --=-=-= Content-Type: text/plain -- Philip Kaludercic on peregrine --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 02:50:01 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 06:50:01 +0000 Received: from localhost ([127.0.0.1]:59691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgIgq-0007zA-NN for submit@debbugs.gnu.org; Tue, 20 Aug 2024 02:50:00 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:39433) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgIgp-0007yw-9U for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 02:49:59 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id A334F1BF206; Tue, 20 Aug 2024 06:49:09 +0000 (UTC) From: Juri Linkov To: Philip Kaludercic Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <87ed6kxq5j.fsf@posteo.net> (Philip Kaludercic's message of "Mon, 19 Aug 2024 19:34:48 +0000") Organization: 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> Date: Tue, 20 Aug 2024 09:44:22 +0300 Message-ID: <86a5h73d89.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I'm attaching the newest version of the patch here: Thanks, I tried it out, and it works nicely for the single hunk case. > +*** New command 'diff-kill-ring-save' > +This command copies out the modified contents out of a diff, without > +having to apply it first. If the selected range extends a hunk, the > +commands attempts to look up and copy the text between from the > +referenced file. I'm not sure about usefulness of the last part in multi-hunk case. Does someone really need to copy a huge part of the source file between hunks at the top and bottom? I expected that multi-hunk case would copy only concatenated text of hunks, not the source file. But I have no strong opinion about this. My main use case will be to copy the text of the current hunk. Could you please support this case where typing 'w' would copy the current hunk when the region is not activated. > @@ -630,6 +631,22 @@ diff-end-of-hunk > +(defun diff-beginning-of-hunk-position (&optional try-harder) > + "Call `diff-end-of-hunk' without moving. > +The optional argument TRY-HARDER is passed on to > +`diff-beginning-of-hunk'." > + (save-excursion > + (save-window-excursion > + (diff-beginning-of-hunk try-harder)))) > + > +(defun diff-end-of-hunk-position (&optional style donttrustheader) > + "Call `diff-end-of-hunk' without moving. > +The optional arguments STYLE and DONTTRUSTHEADER are passed on to > +`diff-end-of-hunk'." > + (save-excursion > + (save-window-excursion > + (diff-end-of-hunk style donttrustheader)))) I don't understand why separate functions with 'save-window-excursion' are needed here, since all other uses of 'diff-beginning-of-hunk' just wrap the calls with 'save-excursion'. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 03:47:49 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 07:47:49 +0000 Received: from localhost ([127.0.0.1]:59749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgJam-00017R-IX for submit@debbugs.gnu.org; Tue, 20 Aug 2024 03:47:49 -0400 Received: from mout01.posteo.de ([185.67.36.65]:57499) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgJaZ-000170-Gf for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 03:47:48 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4A082240029 for <65380@debbugs.gnu.org>; Tue, 20 Aug 2024 09:46:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1724140006; bh=nEZFeVPQHR7FmVnGcD9tA12vH6KQGFTzh2BmkpfQGIM=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=HYhNBX8ztpG+pJlT90LRiKeq4aZUKFcLTpFQ/YGW7DWAdNYaILG9RqDFEmmp3KNiz hBIt1g3r+9pAPEmXjEkNp8U4qv+uZ2aL918zoRmWGy+nBOl8t+o8IY96STSS3JwYGm Ij7Js47FuHPGwxe0adNNiJ/pjZznHttgy9g/If1ORjkGycy0xi4YpK1c0Sscp86+VA FaY9WXcbMM98Q8gwX07MoFjDXMrfcky8br0PXuNy7vzTu0rmEgnBVTOr895SN6rY68 uPHq51RgqmtXr1GQGqFpUPW1pvG9sJrkLpXTPJEBPQZeU1OtphzuLWBxSxgomcJD+w IkUoBVzWk6CAg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Wp1kX5vYgz6v0V; Tue, 20 Aug 2024 09:46:44 +0200 (CEST) From: Philip Kaludercic To: Juri Linkov Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <86a5h73d89.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 20 Aug 2024 09:44:22 +0300") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86a5h73d89.fsf@mail.linkov.net> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Tue, 20 Aug 2024 07:46:43 +0000 Message-ID: <8734mzws9o.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Juri Linkov writes: >> I'm attaching the newest version of the patch here: > > Thanks, I tried it out, and it works nicely for the single hunk case. 1+ >> +*** New command 'diff-kill-ring-save' >> +This command copies out the modified contents out of a diff, without >> +having to apply it first. If the selected range extends a hunk, the >> +commands attempts to look up and copy the text between from the >> +referenced file. > > I'm not sure about usefulness of the last part in multi-hunk case. > Does someone really need to copy a huge part of the source file > between hunks at the top and bottom? I expected that multi-hunk case > would copy only concatenated text of hunks, not the source file. > But I have no strong opinion about this. The main scenario I had in mind was when someone modifies the beginning and the end of a function, and I want to copy all of it at once. I agree that there is usually not much of a use for copying huge parts of a source file, but we get that for free when the beginning-to-end of a function case is handled. > My main use case will be > to copy the text of the current hunk. Could you please support > this case where typing 'w' would copy the current hunk when the > region is not activated. Done, see below. >> @@ -630,6 +631,22 @@ diff-end-of-hunk >> +(defun diff-beginning-of-hunk-position (&optional try-harder) >> + "Call `diff-end-of-hunk' without moving. >> +The optional argument TRY-HARDER is passed on to >> +`diff-beginning-of-hunk'." >> + (save-excursion >> + (save-window-excursion >> + (diff-beginning-of-hunk try-harder)))) >> + >> +(defun diff-end-of-hunk-position (&optional style donttrustheader) >> + "Call `diff-end-of-hunk' without moving. >> +The optional arguments STYLE and DONTTRUSTHEADER are passed on to >> +`diff-end-of-hunk'." >> + (save-excursion >> + (save-window-excursion >> + (diff-end-of-hunk style donttrustheader)))) > > I don't understand why separate functions with 'save-window-excursion' > are needed here, since all other uses of 'diff-beginning-of-hunk' > just wrap the calls with 'save-excursion'. You are right, it isn't needed anymore, and I have removed it. Here is the updated patch: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-command-to-copy-contents-in-a-diff-mode-buffer.patch >From c19e18e3a2fd8df3547ddebce0f63c1620e7d2f6 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic 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 the command. * etc/NEWS: Mention 'diff-kill-ring-save'. (Bug#65380) --- etc/NEWS | 9 ++++++++ lisp/vc/diff-mode.el | 51 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index b89a80aa14d..e493c1bb035 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -210,6 +210,15 @@ The host name for Kubernetes connections can be of kind used. This overrides the setiing in 'tramp-kubernetes-namespace', if any. +** Diff + +--- +*** New command 'diff-kill-ring-save' +This command copies out the modified contents out of a diff, without +having to apply it first. If the selected range extends a hunk, the +commands attempts to look up and copy the text between from the +referenced file. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 81e8b23ee33..5caf2cb5e5b 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -196,6 +196,7 @@ diff-mode-shared-map "RET" #'diff-goto-source "" #'diff-goto-source "W" #'widen + "w" #'diff-kill-ring-save "o" #'diff-goto-source ; other-window "A" #'diff-ediff-patch "r" #'diff-restrict-view @@ -208,7 +209,7 @@ diff-mode-map ;; We want to inherit most bindings from ;; `diff-mode-shared-map', but not all since they may hide ;; useful `M-' 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. @@ -2108,6 +2109,54 @@ diff-goto-source (goto-char (+ (car pos) (cdr src))) (when buffer (next-error-found buffer (current-buffer)))))) +(defun diff-kill-ring-save (beg end &optional reverse) + "Save contents of the region between BEG and END akin to `kill-ring-save'. +By default the command will copy the text that applying the diff would +produce, along with the text between hunks. If REVERSE is non-nil, or +the command was invoked with a prefix argument, copy the deleted text." + (interactive + (append (if (use-region-p) + (list (region-beginning) (region-end)) + (save-excursion + (list (diff-beginning-of-hunk) + (diff-end-of-hunk)))) + (list current-prefix-arg))) + (unless (derived-mode-p 'diff-mode) + (user-error "Command can only be invoked in a diff-buffer")) + (let ((parts '())) + (save-excursion + (goto-char beg) + (catch 'break + (while t + (let ((hunk (diff-hunk-text + (buffer-substring + (save-excursion (diff-beginning-of-hunk)) + (save-excursion (min (diff-end-of-hunk) end))) + (not reverse) + (save-excursion + (- (point) (diff-beginning-of-hunk)))))) + (push (substring (car hunk) (cdr hunk)) + parts)) + ;; check if we have copied everything + (diff-end-of-hunk) + (when (<= end (point)) (throw 'break t)) + ;; copy the text between hunks + (let ((inhibit-message t) start) + (save-window-excursion + (save-excursion + (forward-line -1) + ;; FIXME: Detect if the line we jump to doesn't match + ;; the line in the diff. + (diff-goto-source t) + (forward-line +1) + (setq start (point)))) + (save-window-excursion + (diff-goto-source t) + (push (buffer-substring start (point)) + parts)))))) + (kill-new (string-join (nreverse parts))) + (setq deactivate-mark t) + (message (if reverse "Copied original text" "Copied modified text")))) (defun diff-current-defun () "Find the name of function at point. -- 2.46.0 --=-=-= Content-Type: text/plain -- Philip Kaludercic on peregrine --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 07:37:56 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 11:37:57 +0000 Received: from localhost ([127.0.0.1]:59952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgNBU-0007OX-H4 for submit@debbugs.gnu.org; Tue, 20 Aug 2024 07:37:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49106) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgNBR-0007OE-1c for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 07:37:54 -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 ) id 1sgNAc-00075s-L9; Tue, 20 Aug 2024 07:37:02 -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=MtgKaJvc2+8p5V+jRPeIhGo+44O5mZsJpuWMoFKwu8I=; b=OKeVa+ku2G9L h0GwPO3DxfR4iTlqbhnQIcSjplmy3AoG9xwHGlt2t4bGGmkvpSlVeTel2u8ptMP7s/Snq90SxB1AE emN88AC7emHCUVlPgUw1MvToeOpxek3DlnmBVywzQjqCfgzGB/47f59HF8Jiwlc0ZlM9Z8eRZxDEO pE3xz08jcU6ZRvURLMbNgY9M+m05xTd6sopDEhaAPnv+CWkuKGBF3Ngcs8eKxa/CLtO8cpr16kavO z1JiBc+UFSGlfSjfty9uII9Z8Hs7w0604yJGeeCn991GDFs7iaiwp14G/v+7IHFda9guJGu3/Ok4e xq99Xj7yowzR+ny+F2zKDw==; Date: Tue, 20 Aug 2024 14:36:58 +0300 Message-Id: <86le0rwhlx.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87ed6kxq5j.fsf@posteo.net> (message from Philip Kaludercic on Mon, 19 Aug 2024 19:34:48 +0000) Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Mon, 19 Aug 2024 19:34:48 +0000 > > +*** New command 'diff-kill-ring-save' > +This command copies out the modified contents out of a diff, without > +having to apply it first. This could be reworded to make the effect of the command more clear. For example: This command copies to the 'kill-ring' a region of text modified according to diffs in the current buffer, but without applying the diffs to the original text. > If the selected range extends a hunk, the > +commands attempts to look up and copy the text between from the > +referenced file. ^^^^^^^^^^^^^^^^^ Something is missing (or redundant) in this sentence. > +(defun diff-kill-ring-save (beg end &optional reverse) > + "Save contents of the region between BEG and END akin to `kill-ring-save'. The first line should IMO say something to make it clear this command uses diffs from the current buffer. OTOH, the reference to `kill-ring-save' is much less important. So how about Save to `kill-ring' the result of applying diffs in region between BEG and END. > +By default the command will copy the text that applying the diff would > +produce, along with the text between hunks. If REVERSE is non-nil, or > +the command was invoked with a prefix argument, copy the deleted text." The "deleted text" part here is unclear: who or what deletes text and what text is deleted? From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 08:10:57 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 12:10:57 +0000 Received: from localhost ([127.0.0.1]:59986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgNhQ-0008MK-W6 for submit@debbugs.gnu.org; Tue, 20 Aug 2024 08:10:57 -0400 Received: from mout01.posteo.de ([185.67.36.65]:56793) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgNhN-0008M5-3X for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 08:10:55 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 787ED240028 for <65380@debbugs.gnu.org>; Tue, 20 Aug 2024 14:10:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1724155803; bh=bgcaXuIJX3r6lY+QeZod0tmLa+x01PqFSYZNVHhAJ7s=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=Fev4wTv3dU3RNECI2FvozGwOIOr8XRbAGXVAmeuvojspEf9dDX/si5AiWI7NIx6oS ty2Q9RmJBiTc/YUX02HRMQ/pZwQK/zAOtcZn4c4BmiTE/bmEfQMaYTGznW6hAn1HNv 16qR2iuwPNAHIswAENr4VbJeHoxSw5fOrI4V3VegFm+FCoVkvVLld9X/oinfp/2TwN +3wP5f3+ucs+qEgiQAT+ECOXZOZ403Y+HHY+A3ILOc1d/9LSE401LuJVt1WVm5H2CZ hvJta1MgMj6y2X2MN5b0CFD02y1cnEi37jdOQYRLXqe3Clxc5yKDWx/zrwRkD7ywL/ yn1Ky8I19f56w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Wp7ZL1R97z9rxQ; Tue, 20 Aug 2024 14:10:01 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <86le0rwhlx.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 20 Aug 2024 14:36:58 +0300") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Tue, 20 Aug 2024 12:10:01 +0000 Message-ID: <87y14rv1ie.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Mon, 19 Aug 2024 19:34:48 +0000 >> >> +*** New command 'diff-kill-ring-save' >> +This command copies out the modified contents out of a diff, without >> +having to apply it first. > > This could be reworded to make the effect of the command more clear. > For example: > > This command copies to the 'kill-ring' a region of text modified > according to diffs in the current buffer, but without applying the > diffs to the original text. Applied >> If the selected range extends a hunk, the >> +commands attempts to look up and copy the text between from the >> +referenced file. ^^^^^^^^^^^^^^^^^ > > Something is missing (or redundant) in this sentence. How about "the text in between from". Does that sound better? ^^ >> +(defun diff-kill-ring-save (beg end &optional reverse) >> + "Save contents of the region between BEG and END akin to `kill-ring-save'. > > The first line should IMO say something to make it clear this command > uses diffs from the current buffer. OTOH, the reference to > `kill-ring-save' is much less important. So how about > > Save to `kill-ring' the result of applying diffs in region between BEG and END. I like it. >> +By default the command will copy the text that applying the diff would >> +produce, along with the text between hunks. If REVERSE is non-nil, or >> +the command was invoked with a prefix argument, copy the deleted text." > > The "deleted text" part here is unclear: who or what deletes text and > what text is deleted? I want to express that it copies the parts of the diff, that the changeset removes (lines beginning with "-"). So perhaps "... copy the text removed in the diff" would be better? -- Philip Kaludercic on peregrine From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 09:10:02 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 13:10:02 +0000 Received: from localhost ([127.0.0.1]:60049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgOcb-0001VN-Sl for submit@debbugs.gnu.org; Tue, 20 Aug 2024 09:10:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgOcU-0001Ui-CG for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 09:10:00 -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 ) id 1sgObh-0005Fx-Ho; Tue, 20 Aug 2024 09:09:05 -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=g/JgjktHRVu5pwDMTc9AttvbbUco49wrAbzvKEaR1hU=; b=oyltD8u4Lj48 h1YG+9itej0gZiK2eaYMeoWq/jn+WkHu6j5ZAVcbbSROif4feiM0xxADb6xRpRnoVtsdxlvug++LD snOzcmELBoG0Iy6svXAamJdxo/0MExK4iy2alqQ0HqCivbHB10ZopryI/bpd0gOpPC+J3w7p03wyr x7n5DRVf/UHnwhAMU75mduhXghimSpfGfAvQdwsvJiZOwcLpgr3GJpENjM9BoKcQnHGwAqRO5wMaj k1yzsTSyHkfTOzUthe9BUw8qYvLmZotGI/xQINCkCFPu5ICWK2o2dxauUiv70WkRc+GHDXyfxxei6 8/7hPaDc/MYvvDq/+YetFw==; Date: Tue, 20 Aug 2024 16:09:00 +0300 Message-Id: <86bk1nwdcj.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87y14rv1ie.fsf@posteo.net> (message from Philip Kaludercic on Tue, 20 Aug 2024 12:10:01 +0000) Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Tue, 20 Aug 2024 12:10:01 +0000 > > Eli Zaretskii writes: > > >> If the selected range extends a hunk, the > >> +commands attempts to look up and copy the text between from the > >> +referenced file. ^^^^^^^^^^^^^^^^^ > > > > Something is missing (or redundant) in this sentence. > > How about "the text in between from". Does that sound better? > ^^ If that's what you mean, I suggest "the text in-between the hunks". > >> +By default the command will copy the text that applying the diff would > >> +produce, along with the text between hunks. If REVERSE is non-nil, or > >> +the command was invoked with a prefix argument, copy the deleted text." > > > > The "deleted text" part here is unclear: who or what deletes text and > > what text is deleted? > > I want to express that it copies the parts of the diff, that the > changeset removes (lines beginning with "-"). So perhaps "... copy the text > removed in the diff" would be better? I think "copy the text removed by the diffs", and perhaps say explicitly that those are the lines in the hunks preceded with "-". From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 12:24:06 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 16:24:06 +0000 Received: from localhost ([127.0.0.1]:33589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgReP-0007Ly-Mu for submit@debbugs.gnu.org; Tue, 20 Aug 2024 12:24:06 -0400 Received: from mout01.posteo.de ([185.67.36.65]:36503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgReM-0007LR-AU for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 12:24:04 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id E0AE5240029 for <65380@debbugs.gnu.org>; Tue, 20 Aug 2024 18:23:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1724170991; bh=rlFYmmKlo44OlVedbOO05jNPsApbYIlM1hadxAXWr+o=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=Z8xCYsL4Frec2vTnvEkksJYSh995PocsOoYhBBe8CsKNVzIbRgCK4TD74VVeQvR7C LV3MH4DUxmXqcyzCYLwT8Qo0uKYYI0xnH5AE6s44ap6PPaXhYXj8ZnnkJETxIHKmcr 1TUgXOlxL36LnsnjatZJp+ITHKMnsC7m/9aHO7i+/cW+xGynpGqXP3JmvA90wDQJj+ Gc84iSkDiI4i2X4xxw/PfMAqElfU4PbEIBH/Tx3eCybfKshC3vCXkFYcuAE//CSHsZ jHsBAHxS21vMF8gVdkoiGFOlJ4NwRm03COujHlrfFx64OM+2wXgdKJUuZFXANjHvoh 2LG8tB/wqWrPw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WpFBQ5Mstz9rxD; Tue, 20 Aug 2024 18:23:10 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <86bk1nwdcj.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 20 Aug 2024 16:09:00 +0300") 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Tue, 20 Aug 2024 16:23:09 +0000 Message-ID: <87ttffupsi.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Tue, 20 Aug 2024 12:10:01 +0000 >> >> Eli Zaretskii writes: >> >> >> If the selected range extends a hunk, the >> >> +commands attempts to look up and copy the text between from the >> >> +referenced file. ^^^^^^^^^^^^^^^^^ >> > >> > Something is missing (or redundant) in this sentence. >> >> How about "the text in between from". Does that sound better? >> ^^ > > If that's what you mean, I suggest "the text in-between the hunks". Stole that idea :) >> >> +By default the command will copy the text that applying the diff would >> >> +produce, along with the text between hunks. If REVERSE is non-nil, or >> >> +the command was invoked with a prefix argument, copy the deleted text." >> > >> > The "deleted text" part here is unclear: who or what deletes text and >> > what text is deleted? >> >> I want to express that it copies the parts of the diff, that the >> changeset removes (lines beginning with "-"). So perhaps "... copy the text >> removed in the diff" would be better? > > I think "copy the text removed by the diffs", and perhaps say > explicitly that those are the lines in the hunks preceded with "-". According to `diff-font-lock-keywords' diff-mode also supports the "<" syntax for removed parts of a hunk (I believe this comes from RCS?). Then again, I would assume that the structure and contents of a diff should be familiar to anyone using diff-mode seriously enough to be interested in a command like this one? -- Philip Kaludercic on peregrine From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 13:11:18 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 17:11:18 +0000 Received: from localhost ([127.0.0.1]:33600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgSO6-0000AV-Bq for submit@debbugs.gnu.org; Tue, 20 Aug 2024 13:11:18 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:45257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgSO5-0000AH-Dd for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 13:11:17 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 73E471C0002; Tue, 20 Aug 2024 17:10:05 +0000 (UTC) From: Juri Linkov To: Philip Kaludercic Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <8734mzws9o.fsf@posteo.net> (Philip Kaludercic's message of "Tue, 20 Aug 2024 07:46:43 +0000") Organization: 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86a5h73d89.fsf@mail.linkov.net> <8734mzws9o.fsf@posteo.net> Date: Tue, 20 Aug 2024 19:53:27 +0300 Message-ID: <86o75njh8g.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > The main scenario I had in mind was when someone modifies the beginning > and the end of a function, and I want to copy all of it at once. I > agree that there is usually not much of a use for copying huge parts of > a source file, but we get that for free when the beginning-to-end of a > function case is handled. I see, this is useful for the group of adjacent related hunks. >> My main use case will be >> to copy the text of the current hunk. Could you please support >> this case where typing 'w' would copy the current hunk when the >> region is not activated. > > Done, see below. Thank you! From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 14:43:58 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 18:43:58 +0000 Received: from localhost ([127.0.0.1]:33649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgTpm-0002ff-42 for submit@debbugs.gnu.org; Tue, 20 Aug 2024 14:43:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgTpj-0002fR-1Q for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 14:43: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 ) id 1sgTou-0003WE-VH; Tue, 20 Aug 2024 14:43:05 -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=0IGw91y5erps5RM2LTPUmK/JTIjzSgUAAHZfKTwL4Tw=; b=HTe8ujpbCC3B N7KbKSZPAypQOp1G8wiqmZBKk4KJCyRjgfXBIgyEhipp/nBU8RC4AhkqRHIOBdXVGea7sPkFVsecy z3cij5YnLMNbh1sPkj386m1h2RYOtuDqgnej80k9DNzgcOHUGEMnIFF5RPTNQfbLC0gLPrTjSCQlC ooVHSKmSvVGloEa9HZ3T6sxLfmoT9jMGUhxUX9uGPtWr3cSWRaUUMBghOvJmszQCBuvxlHb2ukVQK 7jSGh0pqxdImDSho37IgaRvfCmafrGLsTVDUK0HzdywxI6xnVbAxG9oBqRoQLsunFOHUf0zbcdq9T 4vOhFmNjwO3ovBNa6EbE8w==; Date: Tue, 20 Aug 2024 21:43:00 +0300 Message-Id: <86v7zvujbf.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87ttffupsi.fsf@posteo.net> (message from Philip Kaludercic on Tue, 20 Aug 2024 16:23:09 +0000) Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer 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> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> <87ttffupsi.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Tue, 20 Aug 2024 16:23:09 +0000 > > Eli Zaretskii writes: > > > I think "copy the text removed by the diffs", and perhaps say > > explicitly that those are the lines in the hunks preceded with "-". > > According to `diff-font-lock-keywords' diff-mode also supports the "<" > syntax for removed parts of a hunk (I believe this comes from RCS?). No, that's the original Diff format, before we had -c and -u. By all means mention the "<" lines as well. > Then again, I would assume that the structure and contents of a diff > should be familiar to anyone using diff-mode seriously enough to be > interested in a command like this one? Yes, but the connection between that and what you mean by "deleted text" might not be obvious to everyone. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 17:36:18 2024 Received: (at 65380) by debbugs.gnu.org; 20 Aug 2024 21:36:18 +0000 Received: from localhost ([127.0.0.1]:33738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgWWY-0007Gq-76 for submit@debbugs.gnu.org; Tue, 20 Aug 2024 17:36:18 -0400 Received: from mout02.posteo.de ([185.67.36.66]:49295) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgWWU-0007GY-AY for 65380@debbugs.gnu.org; Tue, 20 Aug 2024 17:36:17 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 87C40240101 for <65380@debbugs.gnu.org>; Tue, 20 Aug 2024 23:35:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1724189724; bh=PTku9hrYpO/iKWOa+SdNrLJ+WDRWUxp1NgRM2DKrKU4=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=W7zJ93oih3tpW5C8LaScM3M9439gVhPjysnak5rtvfnAD/MLPXQGMXfAeKGj//eg2 zoKYFbfXBtbQJ6wvL7VuGpAzwmJQ1wGXEm0FfBAZFYvssHwCnp0KTw93yBKpcSgi+r +4vmNRThhAhxs8EO8HSmuCjq5MVRtwj2GwumbtbTsRvBGvNFHV/Klx96FI4/usOFk1 pmc1TjwN0EKPCR26OKebesefqVJIjZ1xYTjT3hBHfbkL24U1yTpN8u+y7DwvTD6L8N cq1nfaBywsTC6mzld2W2neDHxvEPD4LlSiKPKCCTvBlqmx1H9I++CLrWgkdr7HI7Ez PlpSWI5WarwMw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WpN6X5X0pz9rxB; Tue, 20 Aug 2024 23:35:11 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <86v7zvujbf.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 20 Aug 2024 21:43:00 +0300") References: <87wmxrwe6h.fsf@posteo.net> <83lee7z3xs.fsf@gnu.org> <87jztrvxx2.fsf@posteo.net> <83r0nyyhlz.fsf@gnu.org> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> <87ttffupsi.fsf@posteo.net> <86v7zvujbf.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Tue, 20 Aug 2024 21:35:06 +0000 Message-ID: <87plq2vpx1.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Tue, 20 Aug 2024 16:23:09 +0000 >> >> Eli Zaretskii writes: >> >> > I think "copy the text removed by the diffs", and perhaps say >> > explicitly that those are the lines in the hunks preceded with "-". >> >> According to `diff-font-lock-keywords' diff-mode also supports the "<" >> syntax for removed parts of a hunk (I believe this comes from RCS?). > > No, that's the original Diff format, before we had -c and -u. > > By all means mention the "<" lines as well. > >> Then again, I would assume that the structure and contents of a diff >> should be familiar to anyone using diff-mode seriously enough to be >> interested in a command like this one? > > Yes, but the connection between that and what you mean by "deleted > text" might not be obvious to everyone. OK on both counts, here is the updated version: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-command-to-copy-contents-in-a-diff-mode-buffer.patch >From 56d4747ca1514fdac6abaf49b9742cdf114aa859 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic 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 the command. * etc/NEWS: Mention 'diff-kill-ring-save'. (Bug#65380) --- etc/NEWS | 9 ++++++++ lisp/vc/diff-mode.el | 52 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index b89a80aa14d..e493c1bb035 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -210,6 +210,15 @@ The host name for Kubernetes connections can be of kind used. This overrides the setiing in 'tramp-kubernetes-namespace', if any. +** Diff + +--- +*** New command 'diff-kill-ring-save' +This command copies out the modified contents out of a diff, without +having to apply it first. If the selected range extends a hunk, the +commands attempts to look up and copy the text between from the +referenced file. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 81e8b23ee33..4810b9ce01c 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -196,6 +196,7 @@ diff-mode-shared-map "RET" #'diff-goto-source "" #'diff-goto-source "W" #'widen + "w" #'diff-kill-ring-save "o" #'diff-goto-source ; other-window "A" #'diff-ediff-patch "r" #'diff-restrict-view @@ -208,7 +209,7 @@ diff-mode-map ;; We want to inherit most bindings from ;; `diff-mode-shared-map', but not all since they may hide ;; useful `M-' 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. @@ -2108,6 +2109,55 @@ diff-goto-source (goto-char (+ (car pos) (cdr src))) (when buffer (next-error-found buffer (current-buffer)))))) +(defun diff-kill-ring-save (beg end &optional reverse) + "Save to `kill-ring' the result of applying diffs in region between BEG and END. +By default the command will copy the text that applying the diff would +produce, along with the text between hunks. If REVERSE is non-nil, or +the command was invoked with a prefix argument, copy the lines that the +diff would remove (beginning with \"+\" or \"<\")." + (interactive + (append (if (use-region-p) + (list (region-beginning) (region-end)) + (save-excursion + (list (diff-beginning-of-hunk) + (diff-end-of-hunk)))) + (list current-prefix-arg))) + (unless (derived-mode-p 'diff-mode) + (user-error "Command can only be invoked in a diff-buffer")) + (let ((parts '())) + (save-excursion + (goto-char beg) + (catch 'break + (while t + (let ((hunk (diff-hunk-text + (buffer-substring + (save-excursion (diff-beginning-of-hunk)) + (save-excursion (min (diff-end-of-hunk) end))) + (not reverse) + (save-excursion + (- (point) (diff-beginning-of-hunk)))))) + (push (substring (car hunk) (cdr hunk)) + parts)) + ;; check if we have copied everything + (diff-end-of-hunk) + (when (<= end (point)) (throw 'break t)) + ;; copy the text between hunks + (let ((inhibit-message t) start) + (save-window-excursion + (save-excursion + (forward-line -1) + ;; FIXME: Detect if the line we jump to doesn't match + ;; the line in the diff. + (diff-goto-source t) + (forward-line +1) + (setq start (point)))) + (save-window-excursion + (diff-goto-source t) + (push (buffer-substring start (point)) + parts)))))) + (kill-new (string-join (nreverse parts))) + (setq deactivate-mark t) + (message (if reverse "Copied original text" "Copied modified text")))) (defun diff-current-defun () "Find the name of function at point. -- 2.46.0 --=-=-= Content-Type: text/plain -- Philip Kaludercic on peregrine --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 21 09:43:39 2024 Received: (at 65380) by debbugs.gnu.org; 21 Aug 2024 13:43:39 +0000 Received: from localhost ([127.0.0.1]:35214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sglcg-0003KG-Rv for submit@debbugs.gnu.org; Wed, 21 Aug 2024 09:43:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sglcd-0003Jz-By for 65380@debbugs.gnu.org; Wed, 21 Aug 2024 09:43:37 -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 ) id 1sglbn-0000o6-K1; Wed, 21 Aug 2024 09:42: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=OKmPDql1X/NumhjJDkOQ0lRKbs0Lp1PcwZC7QPCu9Os=; b=b73Xs4zif+40 51Oh4+g3xAthTuNq9VRJh5qPZJN9/5/bK/UbyWIM3ynHI+fDyyZQYhhrA/VpNWg0KyPoJqquQQF7z mXsdE6Qu0Ec2IIRih6idEcKNOkGeXh6E/N0UySrxjfUoPrg3N9fk2fM/ESqVuW2BtiROaKB5ZCcYt 2IizhIVxbjOtkNfEOZ6BNuMj0HYB19EmKNP3ZUcaUHRQnviejLUkf4WiBYB8HpDtt6APU/JYvFjVZ 1sruCelL4uGBoVJoZ0NLjFaf81x0eBtEfHYz3IGU0IYOBj166g9wItOpOKqvjrogJ19OHygIG0ppf BZiA8Ue5ZEbOCrtObP/SsQ==; Date: Wed, 21 Aug 2024 16:42:40 +0300 Message-Id: <86bk1muh4f.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87plq2vpx1.fsf@posteo.net> (message from Philip Kaludercic on Tue, 20 Aug 2024 21:35:06 +0000) Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer References: <87wmxrwe6h.fsf@posteo.net> <83lee7z3xs.fsf@gnu.org> <87jztrvxx2.fsf@posteo.net> <83r0nyyhlz.fsf@gnu.org> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> <87ttffupsi.fsf@posteo.net> <86v7zvujbf.fsf@gnu.org> <87plq2vpx1.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Tue, 20 Aug 2024 21:35:06 +0000 > > > Yes, but the connection between that and what you mean by "deleted > > text" might not be obvious to everyone. > > OK on both counts, here is the updated version: Thanks. > +*** New command 'diff-kill-ring-save' > +This command copies out the modified contents out of a diff, without ^^^ ^^^ One of these two "outs"s should be removed, I think. > +having to apply it first. If the selected range extends a hunk, the > +commands attempts to look up and copy the text between from the > +referenced file. I think it is better to say "copies to the kill-ring the modified contents..." From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 21 15:40:59 2024 Received: (at 65380) by debbugs.gnu.org; 21 Aug 2024 19:40:59 +0000 Received: from localhost ([127.0.0.1]:36389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgrCV-0005z7-0q for submit@debbugs.gnu.org; Wed, 21 Aug 2024 15:40:59 -0400 Received: from mout02.posteo.de ([185.67.36.66]:45625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgrCQ-0005yp-BY for 65380@debbugs.gnu.org; Wed, 21 Aug 2024 15:40:57 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 8E167240106 for <65380@debbugs.gnu.org>; Wed, 21 Aug 2024 21:40:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1724269203; bh=x3Hrk0mSZIuwoawmASRMFfQ5+deGu8MQr7Byaklo2ok=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=oz0ZiUgh3//hZS1BCIxmKb4CORXJh7qbag/YbLscZ2xWjebe3bY4yvqik0nGie2ox XYBaR3G6su3dvZRWGiff17Wb4/WWZkrGdTxKN2FfuocQoPkbRwSJ7elQCaEByGZHPm uyLDJptRj1JTrMw5nVcoQR9llxarMCgIJ07kdY8IDIM5+BaOaIYoPxyk/9cv3hU60C +k+yvO4a7y4lRjiRALzmQIsO+dZdDKGDv1jVXCIi67OIeGlgMS3K2SbZT76V4H24se F/Y2AdWhIhuvNr2dMAkWDuwiLQhAf5VKT4mQDeX/4O9oNBUXEyYpHcdx2ts4mLoZ9G uu4SIMmazpNMw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WpxW648Cfz6twf; Wed, 21 Aug 2024 21:40:02 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <86bk1muh4f.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 21 Aug 2024 16:42:40 +0300") References: <87wmxrwe6h.fsf@posteo.net> <83r0nyyhlz.fsf@gnu.org> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> <87ttffupsi.fsf@posteo.net> <86v7zvujbf.fsf@gnu.org> <87plq2vpx1.fsf@posteo.net> <86bk1muh4f.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Wed, 21 Aug 2024 19:40:01 +0000 Message-ID: <87wmk9acmm.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Tue, 20 Aug 2024 21:35:06 +0000 >> >> > Yes, but the connection between that and what you mean by "deleted >> > text" might not be obvious to everyone. >> >> OK on both counts, here is the updated version: > > Thanks. > >> +*** New command 'diff-kill-ring-save' >> +This command copies out the modified contents out of a diff, without > ^^^ ^^^ > One of these two "outs"s should be removed, I think. > >> +having to apply it first. If the selected range extends a hunk, the >> +commands attempts to look up and copy the text between from the >> +referenced file. > > I think it is better to say "copies to the kill-ring the modified > contents..." Ugh, I forgot to amend by last patch, this is the current version: This command copies to the 'kill-ring' a region of text modified according to diffs in the current buffer, but without applying the diffs to the original text. If the selected range extends a hunk, the commands attempts to look up and copy the text in-between the hunks. I am thinking about splitting the first sentence up into This command copies text out of a diff to the 'kill-ring'. By default it will use the text the diff would modify, without having to apply a hunk. If the selected range extends a hunk, the commands attempts to look up and copy the text in-between the hunks. WDYT? Here is the patch as it is: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-command-to-copy-contents-in-a-diff-mode-buffer.patch >From 494b9ea69a501f3420c8eee1080d7d45637e39d5 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic 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 the command. * etc/NEWS: Mention 'diff-kill-ring-save'. (Bug#65380) --- etc/NEWS | 10 +++++++++ lisp/vc/diff-mode.el | 52 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index b89a80aa14d..25ceb408e2c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -210,6 +210,16 @@ The host name for Kubernetes connections can be of kind used. This overrides the setiing in 'tramp-kubernetes-namespace', if any. +** Diff + +--- +*** New command 'diff-kill-ring-save' +This command copies to the 'kill-ring' a region of text modified +according to diffs in the current buffer, but without applying the +diffs to the original text. If the selected range extends a hunk, the +commands attempts to look up and copy the text in-between the +hunks. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 81e8b23ee33..4810b9ce01c 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -196,6 +196,7 @@ diff-mode-shared-map "RET" #'diff-goto-source "" #'diff-goto-source "W" #'widen + "w" #'diff-kill-ring-save "o" #'diff-goto-source ; other-window "A" #'diff-ediff-patch "r" #'diff-restrict-view @@ -208,7 +209,7 @@ diff-mode-map ;; We want to inherit most bindings from ;; `diff-mode-shared-map', but not all since they may hide ;; useful `M-' 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. @@ -2108,6 +2109,55 @@ diff-goto-source (goto-char (+ (car pos) (cdr src))) (when buffer (next-error-found buffer (current-buffer)))))) +(defun diff-kill-ring-save (beg end &optional reverse) + "Save to `kill-ring' the result of applying diffs in region between BEG and END. +By default the command will copy the text that applying the diff would +produce, along with the text between hunks. If REVERSE is non-nil, or +the command was invoked with a prefix argument, copy the lines that the +diff would remove (beginning with \"+\" or \"<\")." + (interactive + (append (if (use-region-p) + (list (region-beginning) (region-end)) + (save-excursion + (list (diff-beginning-of-hunk) + (diff-end-of-hunk)))) + (list current-prefix-arg))) + (unless (derived-mode-p 'diff-mode) + (user-error "Command can only be invoked in a diff-buffer")) + (let ((parts '())) + (save-excursion + (goto-char beg) + (catch 'break + (while t + (let ((hunk (diff-hunk-text + (buffer-substring + (save-excursion (diff-beginning-of-hunk)) + (save-excursion (min (diff-end-of-hunk) end))) + (not reverse) + (save-excursion + (- (point) (diff-beginning-of-hunk)))))) + (push (substring (car hunk) (cdr hunk)) + parts)) + ;; check if we have copied everything + (diff-end-of-hunk) + (when (<= end (point)) (throw 'break t)) + ;; copy the text between hunks + (let ((inhibit-message t) start) + (save-window-excursion + (save-excursion + (forward-line -1) + ;; FIXME: Detect if the line we jump to doesn't match + ;; the line in the diff. + (diff-goto-source t) + (forward-line +1) + (setq start (point)))) + (save-window-excursion + (diff-goto-source t) + (push (buffer-substring start (point)) + parts)))))) + (kill-new (string-join (nreverse parts))) + (setq deactivate-mark t) + (message (if reverse "Copied original text" "Copied modified text")))) (defun diff-current-defun () "Find the name of function at point. -- 2.46.0 --=-=-= Content-Type: text/plain -- Philip Kaludercic on peregrine --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 21 23:29:20 2024 Received: (at 65380) by debbugs.gnu.org; 22 Aug 2024 03:29:20 +0000 Received: from localhost ([127.0.0.1]:36537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgyVj-0002BX-OY for submit@debbugs.gnu.org; Wed, 21 Aug 2024 23:29:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgyVf-0002BE-VH for 65380@debbugs.gnu.org; Wed, 21 Aug 2024 23:29:17 -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 ) id 1sgySe-0003uD-L0; Wed, 21 Aug 2024 23:26:13 -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=S06Buu5jt3k5tGI3i8Ea04GIhZ8Wl4702scEEttnM+M=; b=AHk69EWoNov2 scV1fNIrnpckbqTxuDalJtmztXXHOK4YDnUu6GyE1VUtrUBpiTRj9qh3tbKS3mw8FFKpDGzKHsSwW GHXyXetPkmyawgWGa8sDFvVVMzcSwKK16SJXK8bwdiyBSnlb7zlbQoVmCKRbwGe3I/ISP6iiG684B Ug5vSrID7rfF0CInO2S7++hIXzw93M0hvPeCoazVqPnpUhzxV0IzWq9wdnWpVyhc+HL6im8kN1DwR Zpqsj8ZrSAcbg2viQCkJlZjWqb2NVwZ89KA0QOhmZ2sOTibRNWtDQiYEAvX1+LqEBqhYr210DGwIN 6/vZulAyybfU6jEoeedJGw==; Date: Thu, 22 Aug 2024 06:25:55 +0300 Message-Id: <86ttfdtf0c.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87wmk9acmm.fsf@posteo.net> (message from Philip Kaludercic on Wed, 21 Aug 2024 19:40:01 +0000) Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer References: <87wmxrwe6h.fsf@posteo.net> <83r0nyyhlz.fsf@gnu.org> <86o7j2qgmc.fsf@mail.linkov.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> <87ttffupsi.fsf@posteo.net> <86v7zvujbf.fsf@gnu.org> <87plq2vpx1.fsf@posteo.net> <86bk1muh4f.fsf@gnu.org> <87wmk9acmm.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Wed, 21 Aug 2024 19:40:01 +0000 > > Ugh, I forgot to amend by last patch, this is the current version: > > This command copies to the 'kill-ring' a region of text modified > according to diffs in the current buffer, but without applying the > diffs to the original text. If the selected range extends a hunk, the > commands attempts to look up and copy the text in-between the > hunks. > > I am thinking about splitting the first sentence up into > > This command copies text out of a diff to the 'kill-ring'. By default > it will use the text the diff would modify, without having to apply a > hunk. If the selected range extends a hunk, the commands attempts to > look up and copy the text in-between the hunks. > > WDYT? Two comments: . "copies text out of a diff" is hard to understand. My understanding is that it takes the original text, modifies it using the diff hunks in the region, and copies the result to kill-ring. That's what I tried to describe in the first sentence that you now want to split. If that interpretation is correct, then "copies text out of a diff" makes it much less clear. . The split version says "by default", but doesn't clearly say what will happen "not by default". If the next sentence is that "non-default" case, then it is better to join these two sentences: "By default, ..., but if the selected text extends a hunk, ...". And in that latter case, I'm not sure I understand the significance of "by default", to tell the truth. Or maybe I simply misunderstand what the patch does, as I'm not an expert on diff-mode and don't know well enough what the various functions you call do. But then neither will the prospective reader of this NEWS entry. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 22 02:42:24 2024 Received: (at 65380) by debbugs.gnu.org; 22 Aug 2024 06:42:24 +0000 Received: from localhost ([127.0.0.1]:36597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sh1WZ-0007hP-K0 for submit@debbugs.gnu.org; Thu, 22 Aug 2024 02:42:23 -0400 Received: from mout02.posteo.de ([185.67.36.66]:48461) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sh1WT-0007gr-5g for 65380@debbugs.gnu.org; Thu, 22 Aug 2024 02:42:21 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id AD903240103 for <65380@debbugs.gnu.org>; Thu, 22 Aug 2024 08:41:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1724308884; bh=B0zbsU0Adqk9y/sXtCRCE7rgIerRiL/X2scLYFWmA3Y=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=GEO0NfwzWyIwcPxbNPvXSxAObqyJMIjkuuKSD8wFNdUEOWb72vj2YsDwuHn4iYj9t LmlCGhdvCsIP+2YBvb9UKTFDsrNmkmAluqtmj4FZfamlv04Npmi9OnkkvOfKiU69KG n0n8Y0huQf6XfS87CgtMRMFxVP6FPN5JEczzYLxiURZ9knRUwxkrkdB/YMBJQCm4Ds tV3MLQ+e2XBukTpBIhU62hleZuv/fPwKeRQIqM9J/zacbn5bWluG7Qu1NselIYXAIE xHBXcB1aiG2LpulqmU5ezbNadM9KAouoz8tmCIS4pIqhn5p9Y5yqCK4v+IiHbrpiAd baXJvcPABxaPg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WqDBC6Ntqz9rxF; Thu, 22 Aug 2024 08:41:23 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <86ttfdtf0c.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 22 Aug 2024 06:25:55 +0300") References: <87wmxrwe6h.fsf@posteo.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> <87ttffupsi.fsf@posteo.net> <86v7zvujbf.fsf@gnu.org> <87plq2vpx1.fsf@posteo.net> <86bk1muh4f.fsf@gnu.org> <87wmk9acmm.fsf@posteo.net> <86ttfdtf0c.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Thu, 22 Aug 2024 06:41:22 +0000 Message-ID: <87o75l9i0d.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Wed, 21 Aug 2024 19:40:01 +0000 >> >> Ugh, I forgot to amend by last patch, this is the current version: >> >> This command copies to the 'kill-ring' a region of text modified >> according to diffs in the current buffer, but without applying the >> diffs to the original text. If the selected range extends a hunk, the >> commands attempts to look up and copy the text in-between the >> hunks. >> >> I am thinking about splitting the first sentence up into >> >> This command copies text out of a diff to the 'kill-ring'. By default >> it will use the text the diff would modify, without having to apply a >> hunk. If the selected range extends a hunk, the commands attempts to >> look up and copy the text in-between the hunks. >> >> WDYT? > > Two comments: > > . "copies text out of a diff" is hard to understand. My > understanding is that it takes the original text, modifies it using > the diff hunks in the region, and copies the result to kill-ring. > That's what I tried to describe in the first sentence that you now > want to split. If that interpretation is correct, then "copies > text out of a diff" makes it much less clear. > . The split version says "by default", but doesn't clearly say what > will happen "not by default". If the next sentence is that > "non-default" case, then it is better to join these two sentences: > "By default, ..., but if the selected text extends a hunk, ...". > And in that latter case, I'm not sure I understand the significance > of "by default", to tell the truth. > > Or maybe I simply misunderstand what the patch does, as I'm not an > expert on diff-mode and don't know well enough what the various > functions you call do. But then neither will the prospective reader > of this NEWS entry. No, your understanding was ring. I'll go ahead and use your suggestion then. Is there anything else left to discuss? > Thanks. -- Philip Kaludercic on peregrine From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 22 06:23:26 2024 Received: (at 65380) by debbugs.gnu.org; 22 Aug 2024 10:23:26 +0000 Received: from localhost ([127.0.0.1]:36805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sh4yT-0005Cx-Lq for submit@debbugs.gnu.org; Thu, 22 Aug 2024 06:23:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sh4yS-0005Cl-2A for 65380@debbugs.gnu.org; Thu, 22 Aug 2024 06:23: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 ) id 1sh4xa-00068t-SF; Thu, 22 Aug 2024 06:22:30 -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=5SUgihfEutUH23A5X0d4eWQ96INefN/3rTpCmd148ss=; b=YIhRf8NP+lE6 u9dM7Tlk8OTiuwJ/dtnj15h7nG6EHKu8F0rE3ldoWRer75ESk/yvIE72T+VKPNc5QZZD9Ox6tV1Oz NsgQuRsYZKW2lLsEVEkeL026sgDqg7qM6tqQ7htQrKV1Zjsbf5BOv/QIyCGMDGrd726TH5ZzTOMWb NhicLceUOplHxGPfvUxLS54Jb/KbkWj66a58nzDdsDnKgLEm7vLY3WW3a5gVCH9Q8xgfbdDKoTOn8 hl5jCC0WUneE+Vj8ZmpbvapjfzxrE5B8YuZFkqsAoggG5UN1IQz5lngnkDuDxAOgcDZCJBftwAw0s +GUuv+/dlH8apNMk6vm6KA==; Date: Thu, 22 Aug 2024 13:22:26 +0300 Message-Id: <86a5h4uaal.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87o75l9i0d.fsf@posteo.net> (message from Philip Kaludercic on Thu, 22 Aug 2024 06:41:22 +0000) Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer References: <87wmxrwe6h.fsf@posteo.net> <83cyzhwpcj.fsf@gnu.org> <87a5ultvuy.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> <87ttffupsi.fsf@posteo.net> <86v7zvujbf.fsf@gnu.org> <87plq2vpx1.fsf@posteo.net> <86bk1muh4f.fsf@gnu.org> <87wmk9acmm.fsf@posteo.net> <86ttfdtf0c.fsf@gnu.org> <87o75l9i0d.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380 Cc: 65380@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: juri@linkov.net, 65380@debbugs.gnu.org > Date: Thu, 22 Aug 2024 06:41:22 +0000 > > Eli Zaretskii writes: > > > Or maybe I simply misunderstand what the patch does, as I'm not an > > expert on diff-mode and don't know well enough what the various > > functions you call do. But then neither will the prospective reader > > of this NEWS entry. > > No, your understanding was ring. I'll go ahead and use your suggestion > then. > > Is there anything else left to discuss? Not from me, no. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 22 15:00:30 2024 Received: (at 65380-close) by debbugs.gnu.org; 22 Aug 2024 19:00:30 +0000 Received: from localhost ([127.0.0.1]:38392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shD2r-0003Nw-Rl for submit@debbugs.gnu.org; Thu, 22 Aug 2024 15:00:30 -0400 Received: from mout01.posteo.de ([185.67.36.65]:43545) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shD2n-0003Nd-SK for 65380-close@debbugs.gnu.org; Thu, 22 Aug 2024 15:00:27 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 25CD4240028 for <65380-close@debbugs.gnu.org>; Thu, 22 Aug 2024 20:59:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1724353173; bh=TrB3RJhJBXYhL7VLE+PtuBfes5dXSW5Xac4ucV2FH3k=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=GdcfP08TWvKbf4KF6cteH5UCYak7jSk+17Plcl3UZAHcn39OhLWvQfncZxfbpmlIA J8MFqHA5ka7QxjA0YZEuqysqnaNfDlqf72aQeXGrVz6DvjEyTPNXYVbQzvg69OuWh5 qOIGQO4RNpFmh6YEcsCh2BCSsp9IJYqq3fSEkAazfPAFOEgBtazrruIrfo0W1A+wqb O5PZxw5sXvLB3FG2GEDRn3zW6RC0DJJP/TZ3aPoJvWKH8DHVi1lI/bKGd8yOWX5gbg H+SeG/ESMEA4VcRvIcl4kxpEANXZwRx2GXCz4777v4CPbCs+nl1aPpSainGBuoJB5P gOkO0CqmO6Y9A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WqXYv5pZ3z9rxG; Thu, 22 Aug 2024 20:59:31 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer In-Reply-To: <86a5h4uaal.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 22 Aug 2024 13:22:26 +0300") References: <87wmxrwe6h.fsf@posteo.net> <83a5ulwos6.fsf@gnu.org> <87fs4bgwuj.fsf@posteo.net> <83fs4btiw1.fsf@gnu.org> <871q2n152u.fsf@posteo.net> <87frr1zw6i.fsf@posteo.net> <864j7hzviv.fsf@gnu.org> <87bk1pztsr.fsf@posteo.net> <861q2lzp70.fsf@gnu.org> <87ed6kxq5j.fsf@posteo.net> <86le0rwhlx.fsf@gnu.org> <87y14rv1ie.fsf@posteo.net> <86bk1nwdcj.fsf@gnu.org> <87ttffupsi.fsf@posteo.net> <86v7zvujbf.fsf@gnu.org> <87plq2vpx1.fsf@posteo.net> <86bk1muh4f.fsf@gnu.org> <87wmk9acmm.fsf@posteo.net> <86ttfdtf0c.fsf@gnu.org> <87o75l9i0d.fsf@posteo.net> <86a5h4uaal.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Thu, 22 Aug 2024 18:59:31 +0000 Message-ID: <87frqw9yek.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65380-close Cc: 65380-close@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: juri@linkov.net, 65380@debbugs.gnu.org >> Date: Thu, 22 Aug 2024 06:41:22 +0000 >> >> Eli Zaretskii writes: >> >> > Or maybe I simply misunderstand what the patch does, as I'm not an >> > expert on diff-mode and don't know well enough what the various >> > functions you call do. But then neither will the prospective reader >> > of this NEWS entry. >> >> No, your understanding was ring. I'll go ahead and use your suggestion >> then. >> >> Is there anything else left to discuss? > > Not from me, no. OK, I have pushed the patch to master and am closing this report. -- Philip Kaludercic on peregrine From unknown Sat Jun 21 05:14:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 20 Sep 2024 11:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator