Comments (6)
I second. It is very annoying to have a frozen emacs while fetching a very large docset.
from helm-dash.
I had an attempt at fixing this thinking it would be a nice easy exercise to help me learn how async-start
works. Let's just say I still have no idea how to correctly use async-start
but I now understand why almost all of emacs is synchronous.
from helm-dash.
lol! Feel free to enlighten us :)
from helm-dash.
So async-start
works by spawning a new instance of emacs -Q
and passing it an sexp to run. If you need any variables from the main emacs you need to make sure they are captured in a closure and pass the closure as the sexp (I think I got this part working). I don't know how to capture global varaibles (e.g. defun
s) in a closure. I tried to create local variables using let
but it just captured the symbol, and of course that symbol isn't defined in the async emacs. So I tried to work around this by writing all the code inline, which isn't too bad for what we need to do. Again I think this part worked...
Then I started getting mysterious errors, so I tried to debug them. Of course you can't use the debugger because the code is running in a separate instance of emacs. Then I tried to use print statement debugging but couldn't get it to print anything. In hindsight this is probably because it prints to the messages buffer in the other instance of emacs...
So then I rage quit :).
Take all of the above with a grain of salt, I still don't really understand what was going on so I'm likely to be wrong about how some it works! Also don't take this as criticism of emacs-async
, it's obviously impossible for a library to add good concurrency support to a language that doesn't have any concept of concurrency and I think emacs-async
does a good job in the circumstances.
Maybe I'll try again now I have some spare time.
from helm-dash.
The trick seems to be to only do the absolute minimum asynchronously. No filename formatting, no result parsing, only a single url-get per async call.
from helm-dash.
Thanks for the explanations. I tried async-start, doing a few experiments and here are my findings:
It seems that the trick is to manually require all needed libraries that are not in the core and will be needed in the child process. The only values that get captured are the ones in the function environment.
soo... (async-start (lambda () "executed in child") (lambda () "executed in parent")))
The lambda that is "executed in child" should require the modules it needs to do its work (remember the children is started by 'emacs -Q' so nothing is loaded by default).
I made it work in this way:
(async-start
(lambda ()
(add-to-list 'load-path "~/programmingStuff/helm-dash/")
(add-to-list 'load-path "~/.emacs.d/elpa/helm-20160525.1417/")
(add-to-list 'load-path "~/.emacs.d/elpa/helm-core-20160524.820/")
(require 'helm-dash)
(url-copy-file feed-url feed-tmp-path t)
(url-copy-file (helm-dash-get-docset-url feed-tmp-path) docset-tmp-path t)
(helm-dash-install-docset-from-file docset-tmp-path))
(lambda (x)
(message "DONE!!")))
But I think I like your way more, as it really detaches the costly functions, and makes the whole remote execution much more simple. It's a bit hard to follow nested lambdas, but having to require packages that are in potentially unknown directories makes it a no-no (unless we find a solution to this).
For extra fun, take a look at async.el async-inject-variables function :). I'm going to merge your code, and if we find nicer ways to do it in the future, we can always refactor it.
Thanks!
from helm-dash.
Related Issues (20)
- `helm-dash-docset-installed-p` sometimes confuses underscores and version numbers. HOT 1
- helm-dash keeps connecting to remote servers
- Split dash-docs specific logic into separate library HOT 31
- Invalidly quoted urls in docset HOT 4
- Cannot retrieve list of official docsets HOT 19
- Error when install docset `M-x helm-dash-install-docset` HOT 1
- How to narrow down to one specific docset? HOT 1
- Java docsets on linux are encrypted HOT 1
- helm-dash-installed-docsets is gone HOT 1
- Install [official/user] docset contacting error HOT 7
- Strange error "too long" when installing docsets HOT 1
- setq-local dash-docs-docsets does not work HOT 1
- Narrowing down to one specific docset does not work? HOT 5
- dash-docs-docsets does not exist: how to set mode specific docsets? HOT 2
- gnutls.el error while trying to install a docset HOT 3
- Bad comment header in dash-docs.el. HOT 1
- Wrong type argument: stringp
- Opens wrong url/Installs docset in wrong location ? (macos) HOT 1
- When using helm from terminal emacs, typing too quickly may result in helm unexpectedly closing
- (Read before posting) Project unmaintained? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helm-dash.