bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Jim Porter
Subject: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer
Date: Sun, 20 Aug 2023 12:47:53 -0700

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]