ebib
ebib copied to clipboard
Center on new entry in `ebib-biblio-import-doi`
Fixes issue #232.
My apologies for the very late reply. I'm a little hesitant to add this to Ebib, because of the change that is being made to ebib--bib-find-bibtex-entries. I currently don't have a better idea, so I may change my mind, but I would like to first consider whether an alternative method can be found.
Sure, if there's a nicer and cleaner way to achieve the same effect, then I'm all for it.
My apologies for the host of commits that suddenly appeared in this PR... I pulled your PR but merged it onto a different commit than you had based it on, and then I pushed a commit onto your PR, so all the intermediate commits got pulled in...
You may be able to fix things by rebasing your PR on commit https://github.com/joostkremers/ebib/commit/600b5e3d3dd98ba4017ad257470424b4507b4e59 but if not, I can simply merge my local branch into master and push that to Github.
Anyway, getting to the point: I modified your PR so that ebib--bib-find-bibtex-entries only returns a list of keys if you explicitly ask for it (and similar with ebib-import-entries). This should make ebib-biblio-import-doi work the way you intended without having to create a long list of entry keys when Ebib opens a large .bib file.
Could you please test this and see if it works? The centring doesn't seem to work reliably for me, but there may be some specific settings that interfere.
I pulled the pull request with forge and it works the same way my original pull request did. There is one issue that you probably noticed. After adding the entry, ebib seems to center on it internally but doesn't refresh the view. When I press arrow up or down, the entry above or below the new entry becomes focused. I looked into source code of ebib--goto-entry-in-index, ebib-search and several related functions and I can't figure out why it behaves that way.
I had noticed it doesn't always work, but I hadn't noticed that pressing arrow up or down moves to the entry above/below the newly added one. I'll try and take a look at it today and see if I can figure out what's going on.