diff options
author | Sean Allred <code@seanallred.com> | 2015-01-04 14:37:16 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2015-01-04 14:37:16 -0500 |
commit | a5c3bf4a367622ed509bdf84e46d50b0315c4ea7 (patch) | |
tree | 4ae7eb6f4d75bcd43ccd7baf7253687f59f2cec4 /sx-interaction.el | |
parent | 917e70936ef82cfd2a34b541348ebd485049f46a (diff) | |
parent | 2f35ff59ca5c28129d9a3ca3546a8b41cdf1ec1d (diff) |
Merge pull request #193 from vermiculus/issue-14-access-starred-questions
Access starred questions
Diffstat (limited to 'sx-interaction.el')
-rw-r--r-- | sx-interaction.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sx-interaction.el b/sx-interaction.el index 3877035..80c8e5a 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -189,6 +189,24 @@ If WINDOW nil, the window is decided by (switch-to-buffer sx-question-mode--buffer)))) +;;; Favoriting +(defun sx-favorite (data &optional undo) + "Favorite question given by DATA. +Interactively, it is guessed from context at point. +With the UNDO prefix argument, unfavorite the question instead." + (interactive (list (sx--error-if-unread (sx--data-here 'question)) + current-prefix-arg)) + (sx-assoc-let data + (sx-method-call 'questions + :id .question_id + :submethod (if undo 'favorite/undo 'favorite) + :auth 'warn + :site .site_par + :url-method "POST" + :filter sx-browse-filter))) +(defalias 'sx-star #'sx-favorite) + + ;;; Voting (defun sx-toggle-upvote (data) "Apply or remove upvote from DATA. |