1 Introduction

swank-protocol

Overview

swank-protocol is a small, low-level client for Swank. It handles connections
and reading/writing messages.

This is not a full client for Swank, it's a permissively-licensed library for
building Swank clients. It doesn't match requests to responses, it doesn't
asynchronously read responses and events from Swank. It just takes care of the
low level details: Connecting, sending messages down the socket, reading and
parsing incoming events and responses, and optionally logging.

Input/Output

After connecting, you can do two things: Send messages or read them.

To write messages, you can use emacs-rex, which takes a connection and an
S-expression to send to Swank. Implicit in this request, and stored in the
connection object, are two bits of information: The current package and the
request ID.

To read messages, you use read-message, which takes a connection and reads the
next message coming from Swank. The result is an S-expression.

High-level Functions

There are higher-level convenience functions that call emacs-rex, to minimize
repetition and error:

connection-info

Requests connection information. The matching response is a plist with
connection information.

swank-protocol is a small, low-level client for Swank. It handles connections
and reading/writing messages.

This is not a full client for Swank, it’s a permissively-licensed library for
building Swank clients. It doesn’t match requests to responses, it doesn’t
asynchronously read responses and events from Swank. It just takes care of the
low level details: Connecting, sending messages down the socket, reading and
parsing incoming events and responses, and optionally logging.

* ‘connection-request-count‘: The integer ID of the last request sent to the
Swank server. Starts at zero.
* ‘connection-package‘: The package where things are evaluated. This should be
changed when you send a request to Swank to change the current package.
* ‘connection-thread‘: This is the keyword ID of the thread to execute things
in. ‘t‘ is used by default to tell Swank to pick the default thread.
* ‘connection-log-p‘: Whether to log messages as they are read/written.
* ‘connection-logging-stream‘: The stream to log things to, by default,
‘*error-output*‘.

To write messages, you can use ‘emacs-rex‘, which takes a connection and an
S-expression to send to Swank. Implicit in this request, and stored in the
‘connection‘ object, are two bits of information: The current package and the
request ID.

To read messages, you use ‘read-message‘, which takes a connection and reads the
next message coming from Swank. The result is an S-expression.

## High-level Functions

There are higher-level convenience functions that call ‘emacs-rex‘, to minimize
repetition and error:

### ‘connection-info‘

Requests connection information. The matching response is a plist with
connection information.