helm-bibtex icon indicating copy to clipboard operation
helm-bibtex copied to clipboard

[Feature request/Question] A reverse bibtex-completion-find-pdf function?

Open c1-g opened this issue 2 years ago • 2 comments

Is there any function that takes a filepath, then return an entry key for it as a string? We could generalize this further by say, bibtex-completion-find-key-with-field (string &optional field), this function takes STRING then match it against all fields of every bibtex entry in bibtex-completion-bibliography then return a list of keys with STRING in their fields, or to be even more specific, match STRING against FIELD of every bibtex entry, return a list of keys that matches. I can work on a pull request as this feature will make my note-taking even more convenient and open a lot of possibilities for writing some extensions in the future but, I have no clue how to do this since the relavant bibtex-completion functions seem to take a key as their argument.

c1-g avatar Jul 15 '21 10:07 c1-g

Is there any function that takes a filepath, then return an entry key for it as a string?

Well, you can add the file field to bibtex-completion-additional-search-fields and then search for file paths using the usual UI.

We could generalize this further by say, bibtex-completion-find-key-with-field (string &optional field), this function takes STRING then match it against all fields of every bibtex entry in bibtex-completion-bibliography then return a list of keys with STRING in their fields, or to be even more specific, match STRING against FIELD of every bibtex entry, return a list of keys that matches.

That’s the usecase for which I designed helm/ivy-bibtex :) What’s wrong with the current approach?

I can work on a pull request as this feature will make my note-taking even more convenient and open a lot of possibilities for writing some extensions in the future but

Interesting. Could you please describe your use case in more detail? How exactly would the function that you’re proposing make note-taking more efficient? Perhaps there already are facilities to solve your specific problem.

I have no clue how to do this since the relavant bibtex-completion functions seem to take a key as their argument.

You can access a list of all entries via bibtex-completion-candidates. It’s then relatively easy to filter them and to extract the keys.

tmalsburg avatar Jul 17 '21 10:07 tmalsburg

I will have a closer look at your PR when I have a better understanding of what you're trying to achieve.

tmalsburg avatar Jul 17 '21 10:07 tmalsburg