From e453cf88c4f721686f54ebd257eaffa2179653b0 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 18 Apr 2015 08:14:50 +0100 Subject: Define sx-accept --- sx-interaction.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sx-interaction.el b/sx-interaction.el index 3ef38f8..f58c897 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -249,7 +249,7 @@ If WINDOW nil, the window is decided by (switch-to-buffer sx-question-mode--buffer)))) -;;; Favoriting +;;; Simple interactions (defun sx-favorite (data &optional undo) "Favorite question given by DATA. Interactively, it is guessed from context at point. @@ -259,6 +259,15 @@ With the UNDO prefix argument, unfavorite the question instead." (sx-method-post-from-data data (if undo 'favorite/undo 'favorite))) (defalias 'sx-star #'sx-favorite) +(defun sx-accept (data &optional undo) + "Accept answer given by DATA. +Interactively, it is guessed from context at point. +With the UNDO prefix argument, unaccept the question instead." + (interactive (list (sx--data-here 'answer) + current-prefix-arg)) + (sx-method-post-from-data data (if undo 'accept/undo 'accept)) + (sx--maybe-update-display)) + ;;; Voting (defun sx-upvote (data &optional undo) -- cgit v1.2.3