ebib icon indicating copy to clipboard operation
ebib copied to clipboard

Center on new entry in `ebib-biblio-import-doi`

Open gkowzan opened this issue 3 years ago • 5 comments

Fixes issue #232.

gkowzan avatar Jan 21 '22 04:01 gkowzan

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.

joostkremers avatar Mar 12 '22 21:03 joostkremers

Sure, if there's a nicer and cleaner way to achieve the same effect, then I'm all for it.

gkowzan avatar Mar 14 '22 15:03 gkowzan

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.

joostkremers avatar Mar 17 '22 23:03 joostkremers

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.

gkowzan avatar Mar 22 '22 23:03 gkowzan

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.

joostkremers avatar Mar 23 '22 07:03 joostkremers