From 1cf6f09318860a8232f5850c0d1ca497d8c621f9 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 11 Jun 2023 23:30:03 +0200 Subject: [PATCH 2/2] Add command to apply an entire diff at once * lisp/vc/diff-mode.el (diff-mode-map): Bind 'diff-apply-everything'. (diff-apply-everything): Add new command. --- lisp/vc/diff-mode.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index d776375d681..d81f0af365e 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -216,6 +216,7 @@ diff-mode-map "C-x 4 A" #'diff-add-change-log-entries-other-window ;; Misc operations. "C-c C-a" #'diff-apply-hunk + "C-c C-x" #'diff-apply-everything "C-c C-e" #'diff-ediff-patch "C-c C-n" #'diff-restrict-view "C-c C-s" #'diff-split-hunk @@ -2033,6 +2034,16 @@ diff-apply-hunk (when diff-advance-after-apply-hunk (diff-hunk-next)))))) +(defun diff-apply-everything () + "Apply the entire diff." + (interactive) + (save-excursion + (goto-char (point-min)) + (while (let ((inhibit-message t) + (start (point))) + (diff-hunk-next) + (/= start (point))) + (diff-apply-hunk)))) (defun diff-test-hunk (&optional reverse) "See whether it's possible to apply the current hunk. -- 2.39.2