Skip to content

Commit

Permalink
custom option to confirm before peforming _undo_ operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Linh Dang committed Feb 7, 2009
1 parent 5ea5e11 commit fa802da
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions egg.el
Expand Up @@ -354,6 +354,11 @@ Many Egg faces inherit from this one by default."
:group 'egg
:type 'boolean)

(defcustom egg-confirm-undo t
"Always prompt for confirmation before removing delta from workdir."
:group 'egg
:type 'boolean)

(defcustom egg-status-buffer-sections '(repo unstaged staged untracked)
"Sections to be listed in the status buffer and their order."
:group 'egg
Expand Down Expand Up @@ -2870,6 +2875,9 @@ If INIT was not nil, then perform 1st-time initializations as well."

(defun egg-hunk-section-cmd-undo (pos)
(interactive (list (point)))
(unless (or (not egg-confirm-undo)
(y-or-n-p "irreversibly remove the hunk under cursor? "))
(error "Too chicken to proceed with undo operation!"))
(let ((file (egg-hunk-section-patch-cmd pos egg-patch-command
"-p1" "--quiet" "--reverse")))
(if (consp file) (setq file (car file)))
Expand Down Expand Up @@ -2902,6 +2910,10 @@ If INIT was not nil, then perform 1st-time initializations as well."

(defun egg-diff-section-cmd-undo (pos)
(interactive (list (point)))
(unless (or (not egg-confirm-undo)
(y-or-n-p "irreversibly remove the delta under cursor? "))
(error "Too chicken to proceed with undo operation!"))

(let ((file (car (or (get-text-property pos :diff)
(error "No diff with file-name here!"))))
(src-rev (get-text-property pos :src-revision))
Expand Down

0 comments on commit fa802da

Please sign in to comment.