unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 73407@debbugs.gnu.org, juri@linkov.net
Subject: bug#73407: 31.0.50; Add diff-discard-hunk
Date: Tue, 24 Sep 2024 08:53:10 +0100	[thread overview]
Message-ID: <877cb1o5cp.fsf@zephyr.silentflame.com> (raw)
In-Reply-To: <98752a7f-d4cd-4397-ad43-0807e29f7803@yandex.ru> (Dmitry Gutov's message of "Tue, 24 Sep 2024 01:52:13 +0300")

Hello,

On Tue 24 Sep 2024 at 01:52am +03, Dmitry Gutov wrote:

> Hi!
>
> On 21/09/2024 13:19, Sean Whitton wrote:
>> X-debbugs-cc: dgutov@yandex.ru, juri@linkov.net
>> These patches add a new command, diff-discard-hunk, inspired by some
>> functionality from Magit.  It nicely complements a workflow based around
>> committing with C-x v v from C-x v D.  I have been using it every day
>> for a year or so, and I think others will find it useful, too.
>
> I'd like to clarify one thing first: for 'C-x v v' to work correctly in a diff
> buffer (such as one produced by 'C-x v D') you don't have to synchronize any
> changes in that buffer back to disk before making the commit. In fact, we went
> to some effort to make this a non-requirement.

Right.  I believe I was responsible for some of that effort!

> So when you just want to edit the patch before the commit, you can do so
> already, for example using 'M-k' (diff-hunk-kill) - or just 'k' if the buffer
> is read-only.
>
> But of course if the idea is to really "discard" some changes, that works.

Yeah, this is about really discarding the changes.

It's like using C-x v D as a kind of review view.  You use it for
committing what you want to keep and getting rid of temporary changes
you made just for development purposes, such as additional debug prints.

When I used Magit I used its magit-discard for this a lot (the docstring
for that function talks about conflicts but it's also useful without those).

One question I have is whether this should offer a y/n prompt to confirm
discarding the change.  Do you have an opinion on that?

-- 
Sean Whitton





  reply	other threads:[~2024-09-24  7:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-21 10:19 bug#73407: 31.0.50; Add diff-discard-hunk Sean Whitton
2024-09-23 22:52 ` Dmitry Gutov
2024-09-24  7:53   ` Sean Whitton [this message]
2024-09-24 12:27     ` Dmitry Gutov
2024-09-24 15:48       ` Sean Whitton
2024-09-24  6:36 ` Juri Linkov
2024-09-24  8:07   ` Sean Whitton
2024-09-24  8:40   ` Sean Whitton
2024-09-24  8:42     ` Sean Whitton
2024-09-24 12:22       ` Dmitry Gutov
2024-09-24 12:21     ` Eli Zaretskii
2024-09-24 12:23       ` Dmitry Gutov
2024-09-24 14:33         ` Óscar Fuentes
2024-09-24 15:43       ` bug#73407: [PATCH v4] " Sean Whitton
2024-09-24 16:59         ` Juri Linkov
2024-09-24 17:56           ` Sean Whitton
2024-09-24 18:07           ` Eli Zaretskii
2024-09-25  6:36             ` Sean Whitton
2024-09-25 12:17               ` Eli Zaretskii
2024-09-25 19:33                 ` Sean Whitton
2024-09-24 12:20   ` Dmitry Gutov
2024-09-26 10:52 ` bug#73407: 31.0.50; Add diff-revert-and-kill-hunk Sean Whitton

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=877cb1o5cp.fsf@zephyr.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=73407@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=juri@linkov.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).