diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-11-25 00:44:49 +0000 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-11-25 00:44:49 +0000 |
commit | 8a46c6f7d6c862eaac43cc3b9d70c5c25d575f2c (patch) | |
tree | bc1c48e7e421add848555cde2f11665ddc62341f | |
parent | b586f599d588836cc6b9e1a42b0d51f6e4086c6c (diff) |
visit takes an argument
-rw-r--r-- | sx.el | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -170,18 +170,19 @@ Return the result of BODY." (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) - (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)))))) +(defun sx-visit (data) + "Visit DATA in a web browser. +DATA can be a question, answer, or comment. Interactively, it is +derived from point position. +If DATA is a question, also mark it as read." + (interactive (list (sx--data-here))) + (sx-assoc-let data + (when (stringp .link) + (browse-url .link)) + (when (and .title (fboundp 'sx-question--mark-read)) + (sx-question--mark-read data) + (when ((derived-mode-p 'sx-question-list-mode)) + (sx-question-list-refresh 'redisplay 'no-update))))) ;;; Assoc-let |