-
Notifications
You must be signed in to change notification settings - Fork 54
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
How to get a list of keys for references that have notes? #594
Comments
When creating candidates, add cons cells for files or notes, to facilitate programmatic access. Close #594
This function seems to do the trick: (defun citar-get-keys-with-note (&optional force-rebuild-cache)
(let ((candidates (citar--get-candidates force-rebuild-cache))
(hasnotep (citar-has-note)))
(seq-map #'cadr (seq-filter (pcase-lambda (`(_ ,citekey . ,entry))
(funcall hasnotep citekey entry))
candidates)))) The |
Also, I didn't fully read the context of this request, but one thing to beware of if you're adding the "has-note" key to citation entries: the candidates are usually only refreshed when the bib file is updated on disk. If notes are created/deleted without the bib file being changed, the has-note information will get out of date. That is avoided if you call |
What is that Edit: https://www.reddit.com/r/emacs/comments/53z616/no_examples_of_pcaselambda_online_so_heres_one
Yes; good point. Hmm; need to think on that a bit. |
I think |
Yes, it can. But the downside I can imagine is that's a more user-facing option, that a programmer wouldn't have any control of. I suppose we could have both options? |
I don't understand what are the two options you are referring to. But it should be user option although I think default can be changed to |
The linked PR (add cons cells to the candidate entries) and the suggestion from Roshan. Or, as a more general solution, I was thinking maybe (seq-map #'cadr
(citar--get-candidates t (citar-has-note))) That would allow a developer to filter the candidates however they want, and control the cache rebuilding too. Edit: added to the PR 728e810.
Now that I think about it, I'm not actually sure, TBH. Maybe @Vidianos-Giannitsis can weigh in. Edit: here replied in general Vidianos-Giannitsis/zetteldesk.el#5 (comment) |
When creating candidates, add cons cells for files or notes, to facilitate programmatic access. Close #594
I thought this would be straightforward, and it's possible I'm missing something, but I can't figure it out.
From a discussion on a related project.
Thoughts on this @roshanshariff @aikrahguzar?
EDIT: I linked a simple PR to make this easier.
So you need a list keys for all entries that have associated notes?
E.g.:
That's all?
If so, could you not just take the code you reference above to filter the candidates, and from there extract the keys?
EDIT: maybe not. I'll dig a little.
Originally posted by @bdarcus in Vidianos-Giannitsis/zetteldesk.el#5 (comment)
The text was updated successfully, but these errors were encountered: