Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is more of a WIP than a completed feature; it needs a bit (a lot) more documentation/testing (any testing)/refactoring. Basically, it adds a defcustom
markdown-export-async
, which, if non-nil, performs the export operation in an asynchronous subprocess. This is nice because it pauses a lot less when the user saves while working, especially for larger files.This is done without duplicating all the export code for sync and async by replacing all calls to
markdown
(and all functions that call those functions which callmarkdown
, etc) with use of themarkdown-do-sync-or-async
macro, which performs the normal synchronous operation ifasyncp
is nil, but creates a lambda which attaches to the process sentinel otherwise (which is the reason for thelexical-binding: t;
, or sets its result tomarkdown-async-result
if the process finished.Once the
lexical-binding: t;
was added, I worked to fix some of the byte compiler errors. I would recommend taking a look at b5eb8cb closely; I did my best to fix what was obvious but I may have done something silly due to lack of familiarity with the code.The default callback for the async export (set in
markdown-make-process-sentinel
) is to message the user saying it completed; I'm considering making that a defcustom as well, or just a boolean for whether or not to message the user at all.I'll be working on this more, and I know I already have a pr up, so don't worry about getting to this super fast.