From c151212966039601193f99698536e9284c98073c Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Mon, 2 Mar 2015 21:31:09 -0300 Subject: Set json-array-type to 'list and perform many simplifications due to usage of lists instead of vectors --- sx-interaction.el | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'sx-interaction.el') diff --git a/sx-interaction.el b/sx-interaction.el index 368da09..cd8b5a0 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -264,7 +264,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)))) @@ -326,7 +326,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)) @@ -372,11 +372,8 @@ 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])))) @@ -478,8 +475,7 @@ 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]))) -- cgit v1.2.3