From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Prabath Liyanage Newsgroups: gmane.emacs.help Subject: Re: editing a VC diff to modify the current version Date: Wed, 23 Feb 2022 23:29:26 -0500 Message-ID: <878ru0hopl.fsf@byteecho.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16266"; mail-complaints-to="usenet@ciao.gmane.io" To: emacsq , emacsq via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 24 05:33:45 2022 Return-path: Envelope-to: geh-help-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 1nN5p2-000463-GE for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 24 Feb 2022 05:33:44 +0100 Original-Received: from localhost ([::1]:48998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nN5oz-00029f-Vh for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 23 Feb 2022 23:33:42 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN5oQ-00028C-4y for help-gnu-emacs@gnu.org; Wed, 23 Feb 2022 23:33:08 -0500 Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:46751) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN5oL-0003lr-9U for help-gnu-emacs@gnu.org; Wed, 23 Feb 2022 23:33:04 -0500 Original-Received: (Authenticated sender: pliyanag@byteecho.net) by mail.gandi.net (Postfix) with ESMTPSA id 571B9200002; Thu, 24 Feb 2022 04:32:54 +0000 (UTC) In-Reply-To: Received-SPF: pass client-ip=217.70.178.232; envelope-from=pliyanag@byteecho.net; helo=relay12.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136177 Archived-At: emacsq via Users list for the GNU Emacs text editor writes: > When I tried vscode I found an interesting feature: > > When I modify a file under VC then I always make a diff before checkin to see everything is right. Sometimes the changes have a typo or a simple modification occurs to me which could be done right in the diff. With vscode you can actually edit the diff and the changes are reflected back to the current version, so you don't have to go back to the file, do the modifications, make a diff again to see everything is right, etc. > > Emacs' manual mentions this about editing diffs: > > You can edit a Diff mode buffer like any other buffer. (If it is read-only, you need to make it writable first; see[Misc Buffer](https://www.gnu.org/software/emacs/manual/html_node/emacs/Misc-Buffer.html).) Whenever you edit a hunk, Diff mode attempts to automatically correct the line numbers in the hunk headers, to ensure that the patch remains correct, and could still be applied bypatch. To disable automatic line number correction, change the variablediff-update-on-the-flytonil. > > So it seems like emacs supports the other direction, treating the diff as a patch file which can be applied to the original to get the current version. > > These days comparing the current file to the last version under VC seems more usual, people more often make diffs before commit to see if their current changes are right, than doing it to make sure the patch file they create is correct. > > Can emacs support the workflow described above? That is applying edits in the diff buffer automatically to the file on disk. If not then it could be a useful improvement. Maybe I am off the mark here, does vc-ediff/vc-diff or magit-ediff (assuming you're using git) meet your requirements?