diff options
author | Sean Allred <code@seanallred.com> | 2014-12-02 00:09:09 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2014-12-02 00:09:09 -0500 |
commit | 219c571241c6e12110d13b22153fc4dbf163a6a0 (patch) | |
tree | 279f5d0ef64ea0d45368c1c9b8952d4510aab48b /sx-interaction.el | |
parent | 550fbb3297600fc68101d61ddd3f7226a2e9a156 (diff) | |
parent | 5cfd9b840e3835ed373a8c6e67291c69f336a3b6 (diff) |
Merge pull request #124 from vermiculus/buttons-everywhere
Buttons everywhere
Diffstat (limited to 'sx-interaction.el')
-rw-r--r-- | sx-interaction.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sx-interaction.el b/sx-interaction.el index 5f3ece6..305e61c 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -31,11 +31,11 @@ ;;; Using data in buffer (defun sx--data-here () "Get the text property `sx--data-here'." - (or (get-text-property (point) 'sx--data-here) + (or (get-char-property (point) 'sx--data-here) (and (derived-mode-p 'sx-question-list-mode) (tabulated-list-get-id)) - (or (derived-mode-p 'sx-question-mode) - sx-question-mode--data))) + (and (derived-mode-p 'sx-question-mode) + sx-question-mode--data))) (defun sx--maybe-update-display () "Refresh the question list if we're inside it." @@ -117,15 +117,18 @@ changes." ;;; Commenting -(defun sx-comment (data text) +(defun sx-comment (data &optional text) "Post a comment on DATA given by TEXT. DATA can be a question, an answer, or a comment. Interactively, it is guessed from context at point. If DATA is a comment, the comment is posted as a reply to it. TEXT is a string. Interactively, it is read from the minibufer." - (interactive - (list (sx--data-here) 'query)) + (interactive (list (sx--data-here) 'query)) + ;; When clicking the "Add a Comment" button, first arg is a marker. + (when (markerp data) + (setq data (sx--data-here)) + (setq text 'query)) (sx-assoc-let data ;; Get the comment text (when (eq text 'query) |