]> git.eshelyaron.com Git - emacs.git/commit
diff-hunk-kill independent of point inside headers
authorTino Calancha <tino.calancha@gmail.com>
Sat, 21 Jan 2017 02:54:55 +0000 (11:54 +0900)
committerTino Calancha <tino.calancha@gmail.com>
Sat, 21 Jan 2017 02:54:55 +0000 (11:54 +0900)
commite5e42cefd7f2eb47d2c8660a7a317e8b08d36a82
treedd7bfb464bba6f0a0bf3cef6e96d7813b8f776b8
parent1508b538fd8f8c2e00aadcea42ac36013fad02e3
diff-hunk-kill independent of point inside headers

Make diff-apply-hunk and diff-hunk-kill independent of the point
position in a diff header (Bug#17544).
This change allows to apply hunks in order.  It also makes possible to
press M-k repeatedly to kill hunks in the order they appear in the buffer.
See discussion on #Bug25105.
* lisp/vc/diff-mode.el (diff-file-junk-re):
Move definition before it's used.
(diff--at-diff-header-p): New predicate; return non-nil when point
is inside a hunk header, a file header, or within a line
matching diff-file-junk-re.
(diff-beginning-of-hunk): Use it.
Check if the point is inside a diff header, in the middle of a hunk,
or before the first hunk.
(diff-apply-hunk): Call diff-beginning-of-hunk with non-nil arg
before apply the hunk.
(diff-hunk-kill, diff-file-kill):
Call diff-beginning-of-hunk with non-nil arg after kill the hunks.
(diff-post-command-hook): Call diff-beginning-of-hunk with non-nil argument.
lisp/vc/diff-mode.el