Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Pipe content between your terminal and Emacs buffers - seamlessly bridge your co
- *Buffer matching*: Use exact names or regex patterns to find buffers
- *Auto-generation*: Creates ~*Piper 1*~, ~*Piper 2*~, etc. when no name specified
- *Conflict handling*: Avoids overwriting buffers unless forced
- *Persistent socket*: Auto-boots a TCP eval server inside Emacs for fast, ordered communication (falls back to ~emacsclient~ transparently)

The script works with both bash and zsh, handles special characters properly, and includes comprehensive error handling.

Expand Down Expand Up @@ -88,6 +89,30 @@ Download and put it somewhere in the $PATH

Make sure [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html][Emacs daemon]] is running and emacsclient works!

** Socket transport

On first use, ~mxp~ boots a lightweight TCP eval server inside your running Emacs and connects to it directly via bash's ~/dev/tcp~. All subsequent calls reuse this persistent connection, which means:

- No process spawning per eval (previously each chunk launched a new ~emacsclient~ process)
- Guaranteed ordering for streamed content (no more background job races)
- No "Connection refused" errors under heavy streaming load

The server starts automatically - no manual ~M-x~ step required. If the socket is unavailable (e.g., bash built without ~/dev/tcp~ support), ~mxp~ falls back to ~emacsclient~ transparently.

#+attr_html: :width 50%
| Variable | Default | Description |
|---------------+---------+-----------------------------------------------|
| ~MXP_PORT~ | ~17394~ | TCP port for the eval server (localhost only) |
| ~MXP_NO_SOCKET~ | (unset) | Set to ~1~ to force ~emacsclient~-only mode |

To stop the server manually:

#+begin_src emacs-lisp
(when (and (boundp 'mxp-server-process) (process-live-p mxp-server-process))
(delete-process mxp-server-process)
(setq mxp-server-process nil))
#+end_src

** Use

*** Open files and directories in Emacs
Expand Down
21 changes: 21 additions & 0 deletions changelog.org
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
#+DATE: 2025

All notable changes to this project will be documented in this file.

* [0.6.0] - 2026-04-06

** Added
- Persistent TCP socket transport between ~mxp~ and Emacs
- Auto-bootstrapping: ~mxp~ starts a lightweight eval server inside Emacs on first use (no manual ~M-x~ required)
- All communication goes over a single persistent connection per invocation via bash's ~/dev/tcp~
- Transparent fallback to ~emacsclient~ when socket is unavailable
- ~MXP_PORT~ env var for custom server port (default: 17394)
- ~MXP_NO_SOCKET~ env var to force ~emacsclient~-only mode
- Socket transport test suite

** Changed
- Streaming now sends all chunks sequentially over one socket - guaranteed ordering, no race conditions
- ~open_mode~ uses ~emacsclient -n~ directly (avoids interactive prompts from process filter context)

** Removed
- Background job concurrency limiter (~jobs -r~ / ~sleep 0.01~ spin-wait) - no longer needed with persistent connection
- Sync/async flush split - all flushes are now uniform
- ~wait~ at end of ~write_mode~ - no background jobs to collect

* [0.5.3] - 2025-10-29
- Correctly handles emojis and other utf-8 chars

Expand Down
Loading
Loading