aboutsummaryrefslogtreecommitdiff
path: root/sx-question.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-12-27 15:28:59 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-12-27 15:28:59 -0200
commit30e86cfce4bf8829e55beda91c1630f76b3338a9 (patch)
treecb972c7ab57c8ad4d711326efd29927a5ceda310 /sx-question.el
parent6fe85d66a7a519b9fc19db49b6404cbaa804ca5d (diff)
parent57976619d5bf17b6b822a4e0159dee4aab673b33 (diff)
Merge pull request #173 from vermiculus/visit-question-from-link
Visit question from link
Diffstat (limited to 'sx-question.el')
-rw-r--r--sx-question.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/sx-question.el b/sx-question.el
index 9fb31fc..801384a 100644
--- a/sx-question.el
+++ b/sx-question.el
@@ -54,6 +54,20 @@ If QUESTION-ID doesn't exist on SITE, raise an error."
(error "Couldn't find question %S in %S"
question-id site))))
+(defun sx-question-get-from-answer (site answer-id)
+ "Get question from SITE to which ANSWER-ID belongs.
+If ANSWER-ID doesn't exist on SITE, raise an error."
+ (let ((res (sx-method-call 'answers
+ :id answer-id
+ :site site
+ :submethod 'questions
+ :auth t
+ :filter sx-browse-filter)))
+ (if (vectorp res)
+ (elt res 0)
+ (error "Couldn't find answer %S in %S"
+ answer-id site))))
+
;;; Question Properties