tmalsburg / helm-bibtex

Search and manage bibliographies in Emacs
GNU General Public License v2.0
464 stars 74 forks source link

Isolate find-note-file lambda in prepare-entry #311

Closed zaeph closed 4 years ago

zaeph commented 4 years ago

Allows other packages to patch note-file-finding function without changing the default behaviour of helm-bibtex.

This was prompted by #309.

tmalsburg commented 4 years ago

Great! But I think we should allow bibtex-completion-find-note-file-fn to be a list of functions in case the user has notes in multiple places. This approach would also mirror what I'm intending to implement for finding PDFs. There, it will be useful as well to collect PDFs using multiple methods, e.g., by using the info from the entry's file field and by checking for CITKEY.pdf.

zaeph commented 4 years ago

But I think we should allow bibtex-completion-find-note-file-fn to be a list of functions in case the user has notes in multiple places.

I'm on it.

zaeph commented 4 years ago

But I think we should allow bibtex-completion-find-note-file-fn to be a list of functions in case the user has notes in multiple places.

I'm on it.

I've implemented it in 1083278.

zaeph commented 4 years ago

Note that we're only handling the detection of files here, not their creation. To do that, the best way would be to implement fully-fledged org-capture templates, as discussed in #263.

zaeph commented 4 years ago

Note that we're only handling the detection of files here, not their creation. To do that, the best way would be to implement fully-fledged org-capture templates, as discussed in #263.

As it stands, the code could be modified here, but I really don't think it'd be a good idea to play with it until we've refactored the templating with org-capture.

tmalsburg commented 4 years ago

Merged into a feature branch because I'd like to handle one-file notes also via this infrastructure.

zaeph commented 4 years ago

Merged into a feature branch because I'd like to handle one-file notes also via this infrastructure.

Sure, let me know if you need a hand!

tmalsburg commented 4 years ago

Thanks, see here: 285f5189d36cccc0abafec9047fb203ee707c98c

I've made bibtex-completion-find-note-functions (formerly bibtex-completion-find-note-file-fns) a defvar instead of a defcustom because this is only the first step toward real modularity. There are multiple places that need to be changed before we can flexibly replace notes styles/plugins, first and foremost bibtex-completion-edit-notes.

zaeph commented 4 years ago

Thanks, see here: 285f518

I've made bibtex-completion-find-note-functions (formerly bibtex-completion-find-note-file-fns) a defvar instead of a defcustom because this is only the first step toward real modularity.

That looks pretty good to me. Sorry that I didn't modularise bibtex-completion-find-note-one-file whilst I was at it yesterday, it would have saved you some time.

There are multiple places that need to be changed before we can flexibly replace notes styles/plugins, first and foremost bibtex-completion-edit-notes.

Yup, but we've made a good start here. Good work! 🎉

tmalsburg commented 4 years ago

Sorry that I didn't modularise bibtex-completion-find-note-one-file whilst I was at it yesterday, it would have saved you some time.

No worries. Your PR was a good start!