aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sx-interaction.el11
1 files changed, 10 insertions, 1 deletions
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)