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

bibtex-find-key-from-file function #382

Closed
wants to merge 6 commits into from
Closed

bibtex-find-key-from-file function #382

wants to merge 6 commits into from

Conversation

c1-g
Copy link

@c1-g c1-g commented Jul 16, 2021

The initial idea is from #381. Their docstrings are quite extensive.
I've written four functions and one variable,
the function find-key-from-file delegates finding key to every function in the new variable find-key-functions each takes one argument called FILENAME.

The find-key-functions includes

  1. find-key-from-note, a function that returns a list of key associated with FILENAME and bibtex-completion-notes-path depending on its value.

  2. find-key-from-pdf, thats use another new function get-entry-with-string (See description in [Feature request/Question] A reverse bibtex-completion-find-pdf function? #381. TLDR; list every entry with STRING in its fields.) to return a list of entries with FILENAME in its fields then extract the "=key=" field from each entry in the list or just return the BibTex part of FILENAME in a list.

Added bibtex-completion-find-key-from-file,
bibtex-completion-find-key-functions and
bibtex-completion-find-key-from-note.

The find-key-from-file runs bibtex-completion-find-key-functions to
return a key associated with the file name passed to it.

bibtex-completion-find-key-from-note is one of the
bibtex-completion-find-key-functions functions.

It uses a file name then strip it to its base. For example
"/path/to/author99.org" will be stripped to "author99" then—assuming
that "author99" is a key—it double-checks by passing "author99" to
bibtex-completion-find-note-functions, which returns a note file path
associated with it, only returning the key if the file are the same.

Will add find-key-from-pdf soon.
It takes the file name, search for the file name in bibliography files
if it can’t find anything, then search the base file name in library paths.
@c1-g
Copy link
Author

c1-g commented Aug 21, 2021

#381 Answers has solve my problem! Thanks!

@c1-g c1-g closed this Aug 21, 2021
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

Successfully merging this pull request may close these issues.

2 participants