org-roam / org-roam-bibtex

Org Roam integration with bibliography management software
GNU General Public License v3.0
568 stars 47 forks source link

Add optional entry arg for `orb-edit-note` #211

Closed bdarcus closed 2 years ago

bdarcus commented 2 years ago

In bibtex-actions I'm currently refactoring to decouple interactive functions, including for editing notes, from caching.

https://github.com/bdarcus/bibtex-actions/pull/281

So on that branch, bibtex-actions-select-refs now returns more structured data, rather than a simple list of keys.

ELISP> (bibtex-actions-select-refs)
(("agnew2003"
  ("title" . "From Megalopolis to Global City-Region?")
  ("date" . "2003")
  ("author" . "Agnew, John")
  ("=type=" . "article")
  ("=key=" . "agnew2003"))
 ("huck1972"
  ("title" . "The Orders")
  ("date" . "1972")
  ("author" . "Huck, Susan L.M.")
  ("=type=" . "article")
  ("=key=" . "huck1972")))

But I earlier added bibtex-actions-file-open-note-function with the idea one could specify orb-edit-note there.

That function only takes a key as input, and so has to get that data from somewhere else; notably I guess the bibtex-completion cache (here I had a lookup function that was causing this problem that looked in the bibtex-actions caches via bibtex-actions--get-candidates).

I guess I'm wondering: do you think it's feasible to add an optional entry parameter on orb-edit-note for such structured data, so a user could still use that function here without getting an error? Or, if you like, you could actually use that data there as well.

E.g.:

(defun orb-edit-note (citekey &optional entry)