diff options
Diffstat (limited to 'sx-interaction.el')
-rw-r--r-- | sx-interaction.el | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sx-interaction.el b/sx-interaction.el index 8754c54..939183d 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -276,7 +276,7 @@ changes." (sx-method-post-from-data data (concat type (unless status "/undo"))))) ;; The api returns the new DATA. - (when (> (length result) 0) + (when result (sx--copy-data (elt result 0) data) ;; Display the changes in `data'. (sx--maybe-update-display)))) @@ -339,7 +339,7 @@ TEXT is a string. Interactively, it is read from the minibufer." :site .site_par :keywords `((body . ,text))))) ;; The api returns the new DATA. - (when (> (length result) 0) + (when result (sx--add-comment-to-object (sx--ensure-owner-in-object (list (cons 'display_name "(You)")) (elt result 0)) (if .post_id (sx--get-post .post_type .site_par .post_id) data)) @@ -385,14 +385,11 @@ OBJECT can be a question or an answer." (progn (setcdr com-cell - (apply #'vector - (append - (cl-map 'list #'identity - (cdr com-cell)) - (list comment))))) + (append (cdr com-cell) + (list comment)))) ;; No previous comments, add it manually. (setcdr object (cons (car object) (cdr object))) - (setcar object `(comments . [,comment])))) + (setcar object `(comments . (,comment))))) object) (defun sx--ensure-owner-in-object (owner object) @@ -494,11 +491,10 @@ context at point. " "Add alist ANSWER to alist QUESTION in the right place." (let ((cell (assoc 'answers question))) (if cell - (setcdr cell (apply #'vector - (append (cdr cell) (list answer)))) + (setcdr cell (append (cdr cell) (list answer))) ;; No previous comments, add it manually. (setcdr question (cons (car question) (cdr question))) - (setcar question `(answers . [,answer]))) + (setcar question `(answers . (,answer)))) question)) (provide 'sx-interaction) |