Skip to content
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

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

Open
c1-g opened this issue Jul 15, 2021 · 2 comments
Open

Comments

@c1-g
Copy link

c1-g commented Jul 15, 2021

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 c1-g changed the title [Feature request/Question] A possibly reverse bibtex-completion-find-pdf? [Feature request/Question] A reverse bibtex-completion-find-pdf function? Jul 15, 2021
@tmalsburg
Copy link
Owner

tmalsburg commented Jul 17, 2021

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants