Refactor install docset functions#176
Open
canatella wants to merge 4 commits intodash-docs-el:masterfrom
Open
Conversation
Use macros for docset installation helper so that they can be used in the `async-start' calls. Modify the asynchronous methods to use those helper. Modify the synchronous methods to call the asynchronous ones and wait for them to finish.
In some newer docsets (Ruby_2 for example), the top directory of the docset archive (Ruby.docset) does not match the docset name. It breaks the docset detection has helm-dash is looking for Ruby_2.docset instead of Ruby.docest. It also prevents having docsets with different names but with the same top folders (Ruby and Ruby_2 for example) to coexists. Install docset in their matching directory by stripping the top level directory from the archive when extracting to the docset content directory.
Using async install avoids blocking the Emacs initialization in case the ensure function is called.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As of today, they are docsets named for example Ruby_on_Rails_4 or Ruby_on_Rails_5 that contains a top level directory in their archived named "Ruby on Rails". This causes multiple problems.
When using helm-dash-ensure-package-installed, helm-dash checks for Ruby_on_Rails_4 in the docsets path but it does not find it as it is named after the top directory in the archive, "Ruby on Rails".
It's not possible to install both Ruby_on_Rails_4 and Ruby_on_Rails_5 docsets.
To fix this, this pull requests refactors the code for helm-dash-install-docset and helm-dash-async-install-docset to share more codes by making the synchronous function call the asynchronous function. To simplify the asynchronous function, macros are used as they are expanded at compile time and so can be used in the async-start lambda. With this in place, the install function is made to strip the top level directory of a docset tarball and install in a directory named after the original docset name. The helm-dash-docset-installedp function is updated to check for the right name.
The helm-dash-ensure-docset-installed function is also changed to use the asynchronous install method to avoid blocking the Emacs initialization process.