This repository has been archived by the owner. It is now read-only.

run nopaste asynchronously #1

Closed
wants to merge 6 commits into
base: master
from

Conversation

Projects
None yet
1 participant
@anarcat
Contributor

anarcat commented Jun 27, 2018

This keeps Emacs interactive while the paste is in progress. URL information is shown through a filter handler instead of synchronously, which means Emacs won't hang when sending content to the paste server. This matters because some pastebin can get busy or slow, especially on slower connexions, which currently makes Emacs completely unresponsive when pasting.

By default, the standard output of the command is discard but the "chomped" URL is shown to the user and copied to the kill ring, as before. Standard error is kept in a *nopaste-errors* buffer for perusal on errors, and a sentinel function handles such errors and defer the user to that buffer in case of problems. That was tested by disabling the network on my workstation and seems to behave well enough.

The last commit also includes some style changes to the code to comply with common conventions.

@anarcat anarcat changed the title from WIP: run nopaste asynchronously to run nopaste asynchronously Jun 28, 2018

anarcat added some commits Jun 27, 2018

run nopaste asynchronously
This keeps Emacs interactive while the paste is in progress. Output is
shown through a filter handler.
allow users to keep logs of nopaste output
This is useful for debugging purposes: by setting this variable to a
string, users can keep the output of the nopaste command in a buffer
to inspect why things fail when they do.
split out errors in a different buffer
By specifying `:stderr` in the `make-process` call, we ensure that
standard error output is not sent to the filter directly, and instead
stored in the buffer. We still notify the user when we fail so it is
useless to process errors as if they were URLs.
handle errors with a sentinel instead of filter
This is the proper way of handling errors at the end of a process. Doing so in the filter is error-prone is it might run before the process finishes
follow naming conventions
use -- seperator for private functions and variables, and name filter function correctly
@anarcat

This comment has been minimized.

Contributor

anarcat commented Jul 5, 2018

will not be merged, see #2 and #3

@anarcat anarcat closed this Jul 5, 2018

@anarcat anarcat deleted the anarcat:async branch Jul 5, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.