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-orderFIFO of ids in ‘nrepl-completed-requests’, used for bounded eviction.
nrepl-auxAuxiliary information received from the describe op.
nrepl-client-disconnected-handler-functionFunction to call when a client connection is closed.
nrepl-client-nameName of the nREPL client, sent in clone requests.
nrepl-client-versionVersion of the nREPL client, sent in clone requests.
nrepl-close-connection-handler-functionFunction to call to close a client connection buffer.
nrepl-completed-requests-max-sizeMaximum number of completed-request handlers retained per connection.
nrepl-connect-paramsConnection parameters plist, used for buffer naming.
nrepl-connected-hookList of functions to call when connecting to the nREPL server.
nrepl-disconnected-hookList of functions to call when disconnected from the nREPL server.
nrepl-err-handlerFunction to call on evaluation errors.
nrepl-err-handler-functionFunction to call on evaluation errors.
nrepl-extra-eval-params-functionFunction returning extra params to append to eval requests.
nrepl-force-ssh-for-remote-hostsIf non-nil, do not attempt a direct connection for remote hosts.
nrepl-format-buffer-name-functionFunction to format buffer names from a template and params.
nrepl-hide-special-buffersControl the display of some special buffers in buffer switching commands.
nrepl-listening-inet-address-regexpA regexp to search an nREPL’s stdout for the address it is listening on.
nrepl-log--special-keysKeys that are displayed first, in this order, in ‘nrepl-log--pp-listlike’.
nrepl-log-messagesIf non-nil, log protocol messages to an nREPL messages buffer.
nrepl-message-buffer-max-sizeMaximum size for the nREPL message buffer.
nrepl-message-buffer-reduce-denominatorDivisor by which to reduce message buffer size.
nrepl-message-colorsColors used in the messages buffer.
nrepl-message-facesFaces cycled through when coloring the messages buffer.
nrepl-messages-mode-abbrev-tableAbbrev table for ‘nrepl-messages-mode’.
nrepl-messages-mode-hookHook run after entering ‘nrepl-messages-mode’.
nrepl-messages-mode-mapKeymap for ‘nrepl-messages-mode’.
nrepl-messages-mode-syntax-tableSyntax table for ‘nrepl-messages-mode’.
nrepl-namespace-handler-functionFunction to call when the server reports a namespace change.
nrepl-need-input-handler-functionFunction to call when the server requests stdin input.
nrepl-ongoing-sync-requestDynamically bound to t while a sync request is ongoing.
nrepl-opsAvailable nREPL server ops (from describe).
nrepl-orphaned-output-functionFunction called with a RESPONSE whose id has no registered handler.
nrepl-repl-buffer-name-templateTemplate for naming REPL buffers.
nrepl-request-counterContinuation serial number counter.
nrepl-response-handler-functionsList of functions to call on each nREPL message.
nrepl-sessionCurrent nREPL session id.
nrepl-ssh-tunnel-timeoutMaximum number of seconds to wait for an SSH tunnel’s forwarding to come up.
nrepl-sync-request-timeoutThe number of seconds to wait for a sync response.
nrepl-tooling-sessionCurrent nREPL tooling session id.
nrepl-use-ssh-fallback-for-remote-hostsIf non-nil, Use ssh as a fallback to connect to remote hosts.
nrepl-versionsVersion information received from the describe op.

Defined functions (78)

nrepl--available-local-port()
nrepl--clear-client-sessions(CONN-BUFFER)
nrepl--clojure-only-error(RESPONSE)
nrepl--connection-eval-params(CONNECTION)
nrepl--container-published-port(METHOD CONTAINER PORT)
nrepl--direct-connect(HOST PORT &optional NO-ERROR)
nrepl--dispatch-response(RESPONSE)
nrepl--eval-request(INPUT &optional NS LINE COLUMN)
nrepl--init-capabilities(CONN-BUFFER)
nrepl--init-client-sessions(CLIENT)
nrepl--kill-process(PROC)
nrepl--make-hidden-name(BUFFER-NAME)
nrepl--mark-id-completed(ID)
nrepl--maybe-kill-server-buffer(SERVER-BUF)
nrepl--port-alive-p(PORT-NUMBER)
nrepl--port-from-file(FILE)
nrepl--port-open-p(HOST PORT)
nrepl--port-string-to-number(S)
nrepl--process-plist-put(PROC PROP VAL)
nrepl--ssh-file-name-matches-host-p(FILE-NAME HOST)
nrepl--ssh-tunnel-args(DIR LOCAL-PORT REMOTE-PORT)
nrepl--ssh-tunnel-connect(HOST PORT)
nrepl--ssh-tunnel-filter(PROC STRING)
nrepl--tramp-container-method(&optional DIR)
nrepl--unix-connect(SOCKET-FILE &optional NO-ERROR)
nrepl-aux-info(KEY CONNECTION)
nrepl-clear-messages()
nrepl-client-filter(PROC STRING)
nrepl-client-sentinel(PROCESS MESSAGE)
nrepl-connect(HOST PORT)
nrepl-decorate-msg(MSG TYPE)
nrepl-error-buffer()
nrepl-extract-ports(DIR)
nrepl-kill-server-buffer(SERVER-BUF)
nrepl-local-host-p(HOST)
nrepl-log--expand-button-mouse(EVENT)
nrepl-log--message-face(ID)
nrepl-log--pp-listlike(OBJECT &optional FACE BUTTON)
nrepl-log-error(MSG)
nrepl-log-expand-all-buttons()
nrepl-log-expand-button(&optional BUTTON)
nrepl-log-insert-button(LABEL OBJECT)
nrepl-log-message(MSG TYPE)
nrepl-log-pp-object(OBJECT &optional FACE BUTTON)
nrepl-make-buffer-name(TEMPLATE PARAMS &optional DUP-OK)
nrepl-make-eval-handler
nrepl-make-response-handler(BUFFER VALUE-HANDLER STDOUT-HANDLER STDERR-HANDLER DONE-HANDLER &optional EVAL-ERROR-HANDLER CONTENT-TYPE-HANDLER TRUNCATED-HANDLER)
nrepl-messages-buffer(CONN)
nrepl-messages-buffer-name(PARAMS)
nrepl-messages-mode()
nrepl-middleware(CONNECTION)
nrepl-next-request-id(CONNECTION)
nrepl-notify(MSG TYPE)
nrepl-op-supported-p(OP CONNECTION)
nrepl-repl-buffer-name(PARAMS &optional DUP-OK)
nrepl-request:eval(INPUT CALLBACK CONNECTION &optional NS LINE COLUMN ADDITIONAL-PARAMS TOOLING)
nrepl-request:interrupt(PENDING-REQUEST-ID CALLBACK CONNECTION)
nrepl-request:stdin(INPUT CALLBACK CONNECTION)
nrepl-send-eval-request
nrepl-send-request(REQUEST CALLBACK CONNECTION &optional TOOLING)
nrepl-send-sync-request(REQUEST CONNECTION &optional ABORT-ON-INPUT TOOLING CALLBACK)
nrepl-server-buffer-name(PARAMS)
nrepl-server-filter(PROCESS OUTPUT)
nrepl-server-p(BUFFER-OR-PROCESS)
nrepl-server-sentinel(PROCESS EVENT)
nrepl-sessions(CONNECTION)
nrepl-show-messages()
nrepl-start-client-process(&optional HOST PORT SERVER-PROC BUFFER-BUILDER SOCKET-FILE)
nrepl-start-server-process(DIRECTORY CMD ON-PORT-CALLBACK)
nrepl-sync-request
nrepl-sync-request:clone(CONNECTION &optional TOOLING)
nrepl-sync-request:close(CONNECTION)
nrepl-sync-request:describe(CONNECTION)
nrepl-sync-request:eval(INPUT CONNECTION &optional NS TOOLING)
nrepl-sync-request:ls-middleware(CONNECTION)
nrepl-sync-request:ls-sessions(CONNECTION)
nrepl-toggle-message-logging()
nrepl-tunnel-buffer-name(PARAMS)

Defined faces (8)

nrepl-message-1-faceFace 1 of the palette cycled through when coloring nREPL messages.
nrepl-message-2-faceFace 2 of the palette cycled through when coloring nREPL messages.
nrepl-message-3-faceFace 3 of the palette cycled through when coloring nREPL messages.
nrepl-message-4-faceFace 4 of the palette cycled through when coloring nREPL messages.
nrepl-message-5-faceFace 5 of the palette cycled through when coloring nREPL messages.
nrepl-message-6-faceFace 6 of the palette cycled through when coloring nREPL messages.
nrepl-message-7-faceFace 7 of the palette cycled through when coloring nREPL messages.
nrepl-message-8-faceFace 8 of the palette cycled through when coloring nREPL messages.