From d8968604c6d2e11e5365031759069fb5a671f688 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 21 Feb 2015 18:25:21 -0200 Subject: Confirm before deletion --- sx-interaction.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sx-interaction.el b/sx-interaction.el index d2129f8..368da09 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -278,11 +278,16 @@ guessed from context at point. With UNDO prefix argument, undelete instead." (interactive (list (sx--error-if-unread (sx--data-here)) current-prefix-arg)) - (sx-method-post-from-data data (if undo 'delete/undo 'delete)) - ;; Indicate to ourselves this has been deleted. - (setcdr data (cons (car data) (cdr data))) - (setcar data 'deleted) - (sx--maybe-update-display)) + (when (y-or-n-p (format "DELETE this %s? " + (let-alist data + (cond (.comment_id "comment") + (.answer_id "answer") + (.question_id "question"))))) + (sx-method-post-from-data data (if undo 'delete/undo 'delete)) + ;; Indicate to ourselves this has been deleted. + (setcdr data (cons (car data) (cdr data))) + (setcar data 'deleted) + (sx--maybe-update-display))) ;;; Commenting -- cgit v1.2.3