aboutsummaryrefslogtreecommitdiff
path: root/sx-interaction.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-03-02 21:31:09 -0300
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-03-02 21:53:56 -0300
commitc151212966039601193f99698536e9284c98073c (patch)
tree6d4b7428c49acc9f736689f71f5bec2bcd8ebb9b /sx-interaction.el
parent2de52c27e4a3fdc370039f8afacd8b212bcc37d4 (diff)
Set json-array-type to 'list and perform many simplifications
due to usage of lists instead of vectors
Diffstat (limited to 'sx-interaction.el')
-rw-r--r--sx-interaction.el14
1 files changed, 5 insertions, 9 deletions
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])))