unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: emacsq via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: emacsq via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: editing a VC diff to modify the current version
Date: Thu, 24 Feb 2022 02:22:42 +0000	[thread overview]
Message-ID: <LAbyoVNVIvBhIG9719Ay1kXiXj1KXRwWwUPuNLXN1UMSfcf06ZUjnSnBBm9a6Cj04nHftMNaiZhQGUX8jmozQ5LeWqZ2IqQbXmQi6dw1hdA=@protonmail.com> (raw)

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.

             reply	other threads:[~2022-02-24  2:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  2:22 emacsq via Users list for the GNU Emacs text editor [this message]
2022-02-24  2:37 ` editing a VC diff to modify the current version Stefan Monnier via Users list for the GNU Emacs text editor
2022-02-24  4:19 ` emacsq via Users list for the GNU Emacs text editor
2022-02-24  4:29 ` Prabath Liyanage
2022-02-25 16:19 ` emacsq

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='LAbyoVNVIvBhIG9719Ay1kXiXj1KXRwWwUPuNLXN1UMSfcf06ZUjnSnBBm9a6Cj04nHftMNaiZhQGUX8jmozQ5LeWqZ2IqQbXmQi6dw1hdA=@protonmail.com' \
    --to=help-gnu-emacs@gnu.org \
    --cc=laszlomail@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).