diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-11-25 00:29:35 +0000 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-11-25 00:29:35 +0000 |
commit | b9988e7ae3df4503d30da36f749b8537eaa6465b (patch) | |
tree | 057bab026910680dda89c9224de8d31fdabe5b2e /sx.el | |
parent | fb1058921f841f92e99dce56206b79b22684b9a6 (diff) |
Refactor visit from question-list to sx
Diffstat (limited to 'sx.el')
-rw-r--r-- | sx.el | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -27,6 +27,7 @@ ;; StackMode. ;;; Code: +(require 'tabulated-list) (defconst sx-version "0.1" "Version of the `sx' package.") @@ -165,15 +166,22 @@ Return the result of BODY." ;;; Using data in buffer (defun sx--data-here () "Get the text property `sx--data-here'." - (get-text-property (point) 'sx--data-here)) + (or (get-text-property (point) 'sx--data-here) + (and (derived-mode-p 'sx-question-list-mode) + (tabulated-list-get-id)))) (defun sx-visit () "Visit in a web browser the object under point. Object can be a question, answer, or comment." (interactive) - (sx-assoc-let (sx--data-here) - (when (stringp .link) - (browse-url .link)))) + (let ((data (sx--data-here))) + (sx-assoc-let data + (when (stringp .link) + (browse-url .link)) + (when .title + (sx-question--mark-read data) + (when (derived-mode-p 'sx-question-list-mode) + (sx-question-list-refresh 'redisplay 'no-update)))))) ;;; Assoc-let |