From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#65380: [PATCH] Add command to copy contents in a diff-mode buffer Date: Sun, 20 Aug 2023 23:39:09 +0000 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 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23407"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65380@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 21 01:40:36 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qXs27-0005sV-W4 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Aug 2023 01:40:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXs1j-0004fB-Cf; Sun, 20 Aug 2023 19:40:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXs1f-0004ew-Cv for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 19:40:08 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qXs1Y-0007Yf-CT for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 19:40:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qXs1a-0005Xq-02 for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 19:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Aug 2023 23:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65380 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65380-submit@debbugs.gnu.org id=B65380.169257475721254 (code B ref 65380); Sun, 20 Aug 2023 23:40:01 +0000 Original-Received: (at 65380) by debbugs.gnu.org; 20 Aug 2023 23:39:17 +0000 Original-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 Original-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== In-Reply-To: <22de08b62b10f30b4d4c@heytings.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268043 Archived-At: >> 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?