aboutsummaryrefslogtreecommitdiff
path: root/sx-interaction.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-12-22 11:53:38 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-12-22 11:53:38 -0200
commit293aa1850a00dfe42549b7f4b7373057aaaa21d9 (patch)
treefbc54171ebf8f817ca177c19a94d5fcbdec664b6 /sx-interaction.el
parent5493c6f7d1105810e5133e26c838e6d2cfe50055 (diff)
Generalize sx-display-question to sx-display
Diffstat (limited to 'sx-interaction.el')
-rw-r--r--sx-interaction.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/sx-interaction.el b/sx-interaction.el
index 965a996..181632e 100644
--- a/sx-interaction.el
+++ b/sx-interaction.el
@@ -149,9 +149,27 @@ Element can be a question, answer, or comment."
;;; Displaying
+(defun sx-display (&optional data)
+ "Display object given by DATA.
+Interactively, display object under point. Object can be a
+question, an answer, or an inbox_item.
+
+This is meant for interactive use. In lisp code, use
+object-specific functions such as `sx-display-question' and the
+likes."
+ (interactive (list (sx--data-here) t))
+ (sx-assoc-let data
+ (cond
+ (.item_type (sx-open-link .link))
+ (.answer_id
+ (sx-display-question
+ (sx-question-get-from-answer .site_par .id) 'focus))
+ (.title
+ (sx-display-question data 'focus)))))
+
(defun sx-display-question (&optional data focus window)
"Display question given by DATA, on WINDOW.
-When DATA is nil, display question under point. When FOCUS is
+Interactively, display question under point. When FOCUS is
non-nil (the default when called interactively), also focus the
relevant window.