Closed ouboub closed 1 year ago
When I need to do what you're doing I usually find the hunk I want via i-search
or just M-n
and M-p
and then I C-space
(mark) at the beginning of the hunk and use M-< M-n
to zip to the beginning of the first hunk and then C-w
to delete everything. Then I move to the start of the following hunk, mark, M->
and C-w
again. It's sometimes quicker that way than mashing on M-k
.
When I need to do what you're doing I usually find the hunk I want via
i-search
or justM-n
andM-p
and then IC-space
(mark) at the beginning of the hunk and useM-< M-n
to zip to the beginning of the first hunk and thenC-w
to delete everything. Then I move to the start of the following hunk, mark,M->
andC-w
again. It's sometimes quicker that way than mashing onM-k
.
You are doing these operations in the diff buffer, right? What you describe where my first thoughts, however I am using GNU emacs master, and while M-n M-p C-space M-< work C-w does not work, this is why I asked
Oh I forgot, diff-mode
starts with the buffer in read-only mode, so I always have to hit C-x C-q
to switch it to read-write mode before using C-w
(or C-y
, or any other hand editing). It's kind of weird because all the diff-mode functions that modify the buffer work in read-only mode for some reason (like M-k
(diff-kill-hunk
) and C-c C-s
(diff-split-hunk
)). Maybe it's for safety, since if you do things wrong you can mess up the diff.
But I often do too many edits and need to split up and only commit parts of a hunk or even parts of a line.
Ah, Ok, I thought read-only was essential, thanks.
BTW, Dmitry Gutov is currently implementing the functionality of commit-patch directly in lisp It still has some issues for HG, (Git and Bazzarr seem fine) It is in the latest master, in case you are interested
First of all thanks very much for this very nice and useful package. I am a mercurial user and magit does not support
(that is interactive commits where one only wants to commit certain hunks) So, commit-patch-buffer.el solves this very nicely. However there is one issue, that is a bit inconvenient but I presume the culprit is emacs diff mode. Suppose there are 20 hunks but I only want to commit one, then I have to delete each hunk separately by diff-hunk-kill. So it would be very convenient to have the opposite, to select the hunk I need and ignore the others. Any idea how to achieve this?
regards
Uwe Brauer