Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor install docset functions #176

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

canatella
Copy link

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.

  1. 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".

  2. 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.

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.
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.

1 participant