File: nrepl-client.el.html
Provides an Emacs Lisp client to connect to Clojure nREPL servers.
A connection is an abstract idea of the communication between Emacs (client) and nREPL server. On the Emacs side connections are represented by two running processes. The two processes are the server process and client process (the connection to the server). Each of these is represented by its own process buffer, filter and sentinel.
The nREPL communication process can be broadly represented as follows:
1) The server process is started as an Emacs subprocess (usually by
cider-jack-in, which in turn fires up an nREPL server). Note that
if a connection was established using cider-connect there won't be
a server process.
2) The server's process filter (nrepl-server-filter) detects the
connection port from the first plain text response from the server and
starts a communication process (socket connection) as another Emacs
subprocess. This is the nREPL client process (nrepl-client-filter).
All requests and responses handling happens through this client
connection.
3) Requests are sent by nrepl-send-request and
nrepl-send-sync-request. A request is simply a list containing a
requested operation name and the parameters required by the
operation. Each request has an associated callback that is called once
the response for the request has arrived. Besides the above functions
there are specialized request senders for each type of common
operations. Examples are nrepl-request:eval, nrepl-request:clone,
nrepl-sync-request:describe.
4) Responses from the server are decoded in nrepl-client-filter and are
physically represented by alists whose structure depends on the type of
the response. After having been decoded, the data from the response is
passed over to the callback that was registered by the original
request.
Please see the comments in dedicated sections of this file for more detailed description.
Defined variables (28)
cider-enlighten-mode | Non-nil if Cider-Enlighten mode is enabled. |
cider-enlighten-mode-hook | Hook run after entering or leaving ‘cider-enlighten-mode’. |
nrepl-aux | Auxiliary information received from the describe op. |
nrepl-connected-hook | List of functions to call when connecting to the nREPL server. |
nrepl-disconnected-hook | List of functions to call when disconnected from the nREPL server. |
nrepl-err-handler | Evaluation error handler. |
nrepl-force-ssh-for-remote-hosts | If non-nil, do not attempt a direct connection for remote hosts. |
nrepl-hide-special-buffers | Control the display of some special buffers in buffer switching commands. |
nrepl-last-sync-request-timestamp | The time when the last sync request was initiated. |
nrepl-last-sync-response | Result of the last sync request. |
nrepl-listening-inet-address-regexp | A regexp to search an nREPL’s stdout for the address it is listening on. |
nrepl-log-messages | If non-nil, log protocol messages to an nREPL messages buffer. |
nrepl-message-buffer-max-size | Maximum size for the nREPL message buffer. |
nrepl-message-buffer-reduce-denominator | Divisor by which to reduce message buffer size. |
nrepl-message-colors | Colors used in the messages buffer. |
nrepl-messages-mode-abbrev-table | Abbrev table for ‘nrepl-messages-mode’. |
nrepl-messages-mode-hook | Hook run after entering nREPL Messages mode. |
nrepl-messages-mode-map | Keymap for ‘nrepl-messages-mode’. |
nrepl-messages-mode-syntax-table | Syntax table for ‘nrepl-messages-mode’. |
nrepl-ongoing-sync-request | Dynamically bound to t while a sync request is ongoing. |
nrepl-ops | Available nREPL server ops (from describe). |
nrepl-request-counter | Continuation serial number counter. |
nrepl-response-handler-functions | List of functions to call on each nREPL message. |
nrepl-session | Current nREPL session id. |
nrepl-sync-request-timeout | The number of seconds to wait for a sync response. |
nrepl-tooling-session | Current nREPL tooling session id. |
nrepl-use-ssh-fallback-for-remote-hosts | If non-nil, Use ssh as a fallback to connect to remote hosts. |
nrepl-versions | Version information received from the describe op. |