unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* feature proposal diff-mode: kill various hunks or mark then and invert the mark
@ 2022-08-16 14:41 Uwe Brauer
  2022-08-16 15:03 ` Stefan Monnier
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Uwe Brauer @ 2022-08-16 14:41 UTC (permalink / raw)
  To: emacs-devel


Hi

When using diff mode, I sometimes have say 10 hunks but only want to
select one[1] and ignore the other. In the current implementation I have
to kill all 9 I don't want, and that is a bit cumbersome.

If I could select them all, un-select one and then kill the marked one,
that would be great.

Is such a functionality planned?


regards

Uwe Brauer 





Footnotes:
[1]  the reason is that I use  commit-patch-buffer.el, that allows me to
     commit via the external commit-patch command only certains hunks of
     a diff buffer (hg commit -i is not supported by magit or vc-hg.el)

-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature proposal diff-mode: kill various hunks or mark then and invert the mark
  2022-08-16 14:41 feature proposal diff-mode: kill various hunks or mark then and invert the mark Uwe Brauer
@ 2022-08-16 15:03 ` Stefan Monnier
  2022-08-24 17:49 ` Juri Linkov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2022-08-16 15:03 UTC (permalink / raw)
  To: emacs-devel

Uwe Brauer [2022-08-16 16:41:14] wrote:
> When using diff mode, I sometimes have say 10 hunks but only want to
> select one[1] and ignore the other. In the current implementation I have
> to kill all 9 I don't want, and that is a bit cumbersome.
>
> If I could select them all, un-select one and then kill the marked one,
> that would be great.
>
> Is such a functionality planned?

No, but patches welcome.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature proposal diff-mode: kill various hunks or mark then and invert the mark
  2022-08-16 14:41 feature proposal diff-mode: kill various hunks or mark then and invert the mark Uwe Brauer
  2022-08-16 15:03 ` Stefan Monnier
@ 2022-08-24 17:49 ` Juri Linkov
  2022-08-25 14:50 ` Sean Whitton
  2022-08-29  1:15 ` Dmitry Gutov
  3 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2022-08-24 17:49 UTC (permalink / raw)
  To: emacs-devel

> When using diff mode, I sometimes have say 10 hunks but only want to
> select one[1] and ignore the other. In the current implementation I have
> to kill all 9 I don't want, and that is a bit cumbersome.
>
> If I could select them all, un-select one and then kill the marked one,
> that would be great.

In such cases it's possible to resort to ordinary editing by disabling
the read-only state with `C-x C-q', then selecting the whole buffer `C-x h'
except the needed hunk, and then kill the remaining region.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature proposal diff-mode: kill various hunks or mark then and invert the mark
  2022-08-16 14:41 feature proposal diff-mode: kill various hunks or mark then and invert the mark Uwe Brauer
  2022-08-16 15:03 ` Stefan Monnier
  2022-08-24 17:49 ` Juri Linkov
@ 2022-08-25 14:50 ` Sean Whitton
  2022-08-29  1:15 ` Dmitry Gutov
  3 siblings, 0 replies; 6+ messages in thread
From: Sean Whitton @ 2022-08-25 14:50 UTC (permalink / raw)
  To: emacs-devel

Hello,

On Tue 16 Aug 2022 at 04:41PM +02, Uwe Brauer wrote:

>
>
> Hi
>
> When using diff mode, I sometimes have say 10 hunks but only want to
> select one[1] and ignore the other. In the current implementation I have
> to kill all 9 I don't want, and that is a bit cumbersome.
>
> If I could select them all, un-select one and then kill the marked one,
> that would be great.

Indeed this is what the magit status buffer does so well.

-- 
Sean Whitton



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature proposal diff-mode: kill various hunks or mark then and invert the mark
  2022-08-16 14:41 feature proposal diff-mode: kill various hunks or mark then and invert the mark Uwe Brauer
                   ` (2 preceding siblings ...)
  2022-08-25 14:50 ` Sean Whitton
@ 2022-08-29  1:15 ` Dmitry Gutov
  2022-08-29  2:14   ` Stefan Monnier
  3 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2022-08-29  1:15 UTC (permalink / raw)
  To: emacs-devel

On 16.08.2022 17:41, Uwe Brauer wrote:
> 
> Hi
> 
> When using diff mode, I sometimes have say 10 hunks but only want to
> select one[1] and ignore the other. In the current implementation I have
> to kill all 9 I don't want, and that is a bit cumbersome.
> 
> If I could select them all, un-select one and then kill the marked one,
> that would be great.

Note that the difficulty depends on how complex you want the behavior to 
be. If it's always to keep one or several adjacent hunks - it's one 
thing. To be able to mark multiple disjoint hunks, however, that would 
require a different marking UI.

> Footnotes:
> [1]  the reason is that I use  commit-patch-buffer.el, that allows me to
>       commit via the external commit-patch command only certains hunks of
>       a diff buffer (hg commit -i is not supported by magit or vc-hg.el)

JFYI, Juri just pushed an implementation of this for the Git VC backend 
to master (a commit-patch replacement).

Hopefully someone will add Hg support as well, but the implementation 
seems less trivial, given that it doesn't have staging area.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature proposal diff-mode: kill various hunks or mark then and invert the mark
  2022-08-29  1:15 ` Dmitry Gutov
@ 2022-08-29  2:14   ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2022-08-29  2:14 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> Note that the difficulty depends on how complex you want the behavior to
> be. If it's always to keep one or several adjacent hunks - it's one
> thing. To be able to mark multiple disjoint hunks, however, that would
> require a different marking UI.

Indeed, it would require support for disjoint regions.
I'd welcome such a thing, and some of the infrastructure is ready for it.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-29  2:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16 14:41 feature proposal diff-mode: kill various hunks or mark then and invert the mark Uwe Brauer
2022-08-16 15:03 ` Stefan Monnier
2022-08-24 17:49 ` Juri Linkov
2022-08-25 14:50 ` Sean Whitton
2022-08-29  1:15 ` Dmitry Gutov
2022-08-29  2:14   ` Stefan Monnier

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