mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
* lisp/vc/diff-mode.el (diff-revert-and-kill-hunk): Fix killing.
This commit is contained in:
parent
21f9295aa9
commit
d63ed68684
1 changed files with 12 additions and 14 deletions
|
|
@ -2307,20 +2307,18 @@ BEG and END."
|
|||
(setq end (cadr (diff-bounds-of-hunk))))
|
||||
(pcase-setq `(,beg ,end) (diff-bounds-of-hunk)))
|
||||
(when (null (diff-apply-buffer beg end t))
|
||||
;; Use `diff-hunk-kill' because it properly handles file headers,
|
||||
;; except if we are killing the last hunk we need not be concerned
|
||||
;; with that. If we are not deleting the very last hunk then
|
||||
;; exploit how `diff-hunk-kill' will always leave us at the
|
||||
;; beginning of a hunk (except when killing the very last hunk!).
|
||||
(if (eql end (point-max))
|
||||
(let ((inhibit-read-only t))
|
||||
(kill-region beg end))
|
||||
(setq end (copy-marker end))
|
||||
(unwind-protect
|
||||
(cl-loop initially (goto-char beg)
|
||||
do (diff-hunk-kill)
|
||||
until (eql (point) (marker-position end)))
|
||||
(set-marker end nil))))))
|
||||
;; Use `diff-hunk-kill' because it properly handles file headers.
|
||||
(goto-char end)
|
||||
(when-let* ((pos (diff--at-diff-header-p)))
|
||||
(goto-char pos))
|
||||
(setq beg (copy-marker beg) end (point-marker))
|
||||
(unwind-protect
|
||||
(cl-loop initially (goto-char beg)
|
||||
do (diff-hunk-kill)
|
||||
until (or (< (point) (marker-position beg))
|
||||
(eql (point) (marker-position end))))
|
||||
(set-marker beg nil)
|
||||
(set-marker end nil)))))
|
||||
|
||||
(defun diff-apply-buffer (&optional beg end reverse test-or-no-save)
|
||||
"Apply the diff in the entire diff buffer.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue