Skip to content

Fix the most urgent bugs#81

Open
grothesque wants to merge 6 commits into
alpha22jp:masterfrom
grothesque:master
Open

Fix the most urgent bugs#81
grothesque wants to merge 6 commits into
alpha22jp:masterfrom
grothesque:master

Conversation

@grothesque

@grothesque grothesque commented Jun 1, 2026

Copy link
Copy Markdown

In 6 commits, this PR resolves the following problems

@alpha22jp, feel free to take over the whole branch or cherry pick commits at will.


My intention is to continue cleaning up / fixing aspects of this extension, while keeping it simple and compliant with the GhostText protocol. (@KarimAziev’s vision for their fork seems to differ.)

I have a working prototype for syncing of point/region between Emacs and a browser.

But before adding this, I would like to fix another problem first: The current approach of sending the whole buffer (UTF-16 encoded) after each command is not workable for longer buffers, but it is also not necessary. I think that a better approach is to only send the buffer after a short moment of idleness (like 0.3 s).

@alpha22jp, are you interested in evolving this project in such a direction?

By the way, is the Atomic Chrome protocol still relevant? The GhostText “ecosystem” seems much bigger, covering many browsers and editors. If this is indeed the case, perhaps removing support for the Atomic Chrome protocol is a good idea? Since the original Chrome extensions is no longer around, there’s no way to verify that it still works anyway.

@fregante, what do you think?

KarimAziev and others added 6 commits March 12, 2024 22:53
This commit introduces handling for fragmented websocket frames in
the atomic-chrome Emacs extension.

A new hash table, `atomic-chrome-frame-socket-incomplete-buffers-hash`, maps websocket
sockets to buffers that accumulate payload fragments from incomplete
websocket frames.

This allows for efficient handling and concatenation of large and/or
fragented messages. The `atomic-chrome-on-message` function has been
updated to accumulate payload fragments in a dedicated buffer when
frames are marked as incomplete or a previous incomplete frame exists
for the socket. Upon receiving the final fragment, the full payload is
reconstructed, decoded, and processed as a JSON object to either
create or update associated Emacs buffers for editing.

Additionally, the `atomic-chrome-on-close` function now
removes the associated buffer from the hash table when a websocket
socket is closed.
- Remove unrelated lexical-binding change
- Avoid two-argument generate-new-buffer for older Emacs compatibility
- Clean up incomplete WebSocket fragments on close
- Add copyright notices
Remove an unused HTTP request binding so byte-compilation stays clean with lexical binding enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants