emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/diff-hl bc02c99 08/25: Add variable to ask for confirma


From: Dmitry Gutov
Subject: [elpa] externals/diff-hl bc02c99 08/25: Add variable to ask for confirmation when reverting a hunk
Date: Sun, 20 Dec 2020 05:07:00 -0500 (EST)

branch: externals/diff-hl
commit bc02c991e973eaa4f851a057cedf0b193381fb0c
Author: Erick Navarro <erick@navarro.io>
Commit: Erick Navarro <erick@navarro.io>

    Add variable to ask for confirmation when reverting a hunk
---
 diff-hl.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 9cfb2e5..d30c0a9 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -97,6 +97,11 @@
   :group 'diff-hl
   :type 'boolean)
 
+(defcustom diff-hl-ask-before-revert-hunk t
+  "Non-nil to ask for confirmation before revert a hunk."
+  :group 'diff-hl
+  :type 'boolean)
+
 (defcustom diff-hl-highlight-function 'diff-hl-highlight-on-fringe
   "Function to highlight the current line. Its arguments are
   overlay, change type and position within a hunk."
@@ -458,9 +463,10 @@ in the source file, or the last line of the hunk above it."
                     (recenter 1)))
                 (when diff-auto-refine-mode
                   (diff-refine-hunk))
-                (unless (yes-or-no-p (format "Revert current hunk in %s? "
-                                             ,(cl-caadr fileset)))
-                  (user-error "Revert canceled"))
+                (if diff-hl-ask-before-revert-hunk
+                    (unless (yes-or-no-p (format "Revert current hunk in %s? "
+                                                 ,(cl-caadr fileset)))
+                      (user-error "Revert canceled")))
                 (let ((diff-advance-after-apply-hunk nil))
                   (save-window-excursion
                     (diff-apply-hunk t)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]