Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

run nopaste asynchronously #1

Closed
wants to merge 6 commits into from
Closed

run nopaste asynchronously #1

wants to merge 6 commits into from

Conversation

anarcat
Copy link
Contributor

@anarcat 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 WIP: run nopaste asynchronously run nopaste asynchronously Jun 28, 2018
This keeps Emacs interactive while the paste is in progress. Output is
shown through a filter handler.
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.
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.
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
use -- seperator for private functions and variables, and name filter function correctly
@anarcat
Copy link
Contributor Author

anarcat commented Jul 5, 2018

will not be merged, see #2 and #3

@anarcat anarcat closed this Jul 5, 2018
@anarcat anarcat deleted the async branch July 5, 2018 16:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant