aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-04-18 08:14:50 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-04-18 08:14:50 +0100
commite453cf88c4f721686f54ebd257eaffa2179653b0 (patch)
tree632299cdf3dfb57fcb3a354c5107400296ed2432
parentfeebfb04224e014e47c0fec975723cd04d6f5484 (diff)
Define sx-accept
-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)