-
Notifications
You must be signed in to change notification settings - Fork 54
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: add candidates cache #71
Conversation
Thanks, @bdarcus ! I tried this PR and I found that it worked great. There is no more pause after the first run due to the added candidate cache. |
Great! Can you review the code for the basic logic and confirm that it makes sense to you; that it shouldn't cause any problem when I merge it? It's very simple, but I think should work. |
How will the cache get invalidated? I removed a few BibTeX entries and I still got the cached results. |
The idea is one would have to run But that would need to include the bib files, since while bibtex-completion already handles this, this PR does not. I omitted it because I'm thinking it's too complicated (see this recent still open thread), and this approach gives users more flexibility. WDYT? Also, maybe you can test the config I list on the wiki for your bib file to confirm it works for you? |
Updated the wiki section to address here: I will probably add that section to the README before merging. I wonder if there's a way to do this asychronously, so we never experience a pause when it's reloading? |
Latest commit:
|
Change the 'bibtex-actions--reload-candidates-cache' to 'bibtex-actions-refresh' and make it an interactive command. Also, adds section on this to the README.
I followed the README and added |
Merged; thanks much! Let me know of course if you have other ideas, etc. |
PS - I'm glad I did this. It's nice to have the instant loading! |
Refactor so that
bibtex-actions-read
pulls candidates from acache:
bibtex-actions--candidates-cache
.Add:
bibtex-actions--candidates-cache
variablebibtex-actions-refresh
interactive command, to update cacheRefactor:
bibtex-actions--get-candidates
renamed tobibtex-actions--format-candidates
bibtex-actions--get-candidates
now grabs the candidates from the cachefixes #69
@wenjie2wang - I do think it would also be good to add the hook to bibtex-completion, but you want to give this a try and let me know?
Turns out it was easier than I thought to add this.
But I haven't fully tested it and seen if it has any unintended consequences.
It does cache the candidates, however, so should address #69.
So if you could test it further and let me know, that'd be great.