Skip to content

Commit

Permalink
Don't use list where backquoting would be clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianxiang Xiong authored and bbatsov committed Feb 28, 2017
1 parent 82e544b commit 386a7c4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
37 changes: 17 additions & 20 deletions nrepl-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,7 @@ Return the ID of the sent message.
Optional argument TOOLING Set to t if desiring the tooling session rather than the standard session."
(with-current-buffer connection
(when-let ((session (if tooling nrepl-tooling-session nrepl-session)))
(setq request (append request
(list "session" session))))
(setq request (append request `("session" ,session))))
(let* ((id (nrepl-next-request-id connection))
(request (cons 'dict (lax-plist-put request "id" id)))
(message (nrepl-bencode request)))
Expand Down Expand Up @@ -868,17 +867,17 @@ If TOOLING, use the tooling session rather than the standard session."
(defun nrepl-request:stdin (input callback connection)
"Send a :stdin request with INPUT using CONNECTION.
Register CALLBACK as the response handler."
(nrepl-send-request (list "op" "stdin"
"stdin" input)
(nrepl-send-request `("op" "stdin"
"stdin" ,input)
callback
connection))

(defun nrepl-request:interrupt (pending-request-id callback connection)
"Send an :interrupt request for PENDING-REQUEST-ID.
The request is dispatched using CONNECTION.
Register CALLBACK as the response handler."
(nrepl-send-request (list "op" "interrupt"
"interrupt-id" pending-request-id)
(nrepl-send-request `("op" "interrupt"
"interrupt-id" ,pending-request-id)
callback
connection))

Expand All @@ -890,16 +889,16 @@ Register CALLBACK as the response handler."
NS provides context for the request.
If LINE and COLUMN are non-nil and current buffer is a file buffer, \"line\",
\"column\" and \"file\" are added to the message."
(append (and ns (list "ns" ns))
(list "op" "eval"
"code" input)
(when cider-enlighten-mode
(list "enlighten" "true"))
(let ((file (or (buffer-file-name) (buffer-name))))
(when (and line column file)
(list "file" file
"line" line
"column" column)))))
(nconc (and ns `("ns" ,ns))
`("op" "eval"
"code" ,input)
(when cider-enlighten-mode
'("enlighten" "true"))
(let ((file (or (buffer-file-name) (buffer-name))))
(when (and line column file)
`("file" ,file
"line" ,line
"column" ,column)))))

(defun nrepl-request:eval (input callback connection &optional ns line column additional-params tooling)
"Send the request INPUT and register the CALLBACK as the response handler.
Expand All @@ -924,10 +923,8 @@ Optional argument TOOLING Tooling is set to t if wanting the tooling session fro

(defun nrepl-sync-request:close (connection)
"Sent a :close request to close CONNECTION's SESSION."
(nrepl-send-sync-request (list "op" "close")
connection)
(nrepl-send-sync-request (list "op" "close")
connection nil t)) ;; close tooling session
(nrepl-send-sync-request '("op" "close") connection)
(nrepl-send-sync-request '("op" "close") connection nil t)) ;; close tooling session

(defun nrepl-sync-request:describe (connection)
"Perform :describe request for CONNECTION and SESSION."
Expand Down
4 changes: 2 additions & 2 deletions nrepl-dict.el
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ return nil. If DICT is not an nREPL dict object, an error is thrown."
"Associate in DICT, KEY to VALUE.
Return new dict. Dict is modified by side effects."
(if (null dict)
(list 'dict key value)
`(dict ,key ,value)
(if (not (nrepl-dict-p dict))
(error "Not an nREPL dict object: %s" dict)
(setcdr dict (lax-plist-put (cdr dict) key value))
Expand Down Expand Up @@ -169,7 +169,7 @@ If NO-JOIN is given, return the first non nil dict."
dict1)
((and (listp dict2) (listp dict1)) (append dict1 dict2))
((listp dict1) (append dict1 (list dict2)))
(t (list dict1 dict2)))))
(t `(,dict1 ,dict2)))))


;;; Dbind
Expand Down

0 comments on commit 386a7c4

Please sign in to comment.