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 (e.g. via
nrepl-start-server-process). Note that if a connection was
established directly 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 (41)
nrepl--completed-requests-order | FIFO of ids in ‘nrepl-completed-requests’, used for bounded eviction. |
nrepl-aux | Auxiliary information received from the describe op. |
nrepl-client-disconnected-handler-function | Function to call when a client connection is closed. |
nrepl-client-name | Name of the nREPL client, sent in clone requests. |
nrepl-client-version | Version of the nREPL client, sent in clone requests. |
nrepl-close-connection-handler-function | Function to call to close a client connection buffer. |
nrepl-completed-requests-max-size | Maximum number of completed-request handlers retained per connection. |
nrepl-connect-params | Connection parameters plist, used for buffer naming. |
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 | Function to call on evaluation errors. |
nrepl-err-handler-function | Function to call on evaluation errors. |
nrepl-extra-eval-params-function | Function returning extra params to append to eval requests. |
nrepl-force-ssh-for-remote-hosts | If non-nil, do not attempt a direct connection for remote hosts. |
nrepl-format-buffer-name-function | Function to format buffer names from a template and params. |
nrepl-hide-special-buffers | Control the display of some special buffers in buffer switching commands. |
nrepl-listening-inet-address-regexp | A regexp to search an nREPL’s stdout for the address it is listening on. |
nrepl-log--special-keys | Keys that are displayed first, in this order, in ‘nrepl-log--pp-listlike’. |
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-message-faces | Faces cycled through when coloring 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-namespace-handler-function | Function to call when the server reports a namespace change. |
nrepl-need-input-handler-function | Function to call when the server requests stdin input. |
nrepl-ongoing-sync-request | Dynamically bound to t while a sync request is ongoing. |
nrepl-ops | Available nREPL server ops (from describe). |
nrepl-orphaned-output-function | Function called with a RESPONSE whose id has no registered handler. |
nrepl-repl-buffer-name-template | Template for naming REPL buffers. |
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-ssh-tunnel-timeout | Maximum number of seconds to wait for an SSH tunnel’s forwarding to come up. |
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. |
Defined functions (78)
Defined faces (8)
nrepl-message-1-face | Face 1 of the palette cycled through when coloring nREPL messages. |
nrepl-message-2-face | Face 2 of the palette cycled through when coloring nREPL messages. |
nrepl-message-3-face | Face 3 of the palette cycled through when coloring nREPL messages. |
nrepl-message-4-face | Face 4 of the palette cycled through when coloring nREPL messages. |
nrepl-message-5-face | Face 5 of the palette cycled through when coloring nREPL messages. |
nrepl-message-6-face | Face 6 of the palette cycled through when coloring nREPL messages. |
nrepl-message-7-face | Face 7 of the palette cycled through when coloring nREPL messages. |
nrepl-message-8-face | Face 8 of the palette cycled through when coloring nREPL messages. |