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

Batch Note Insertion in Citar #837

Open
yuchen-lea opened this issue Jul 27, 2024 · 5 comments
Open

Batch Note Insertion in Citar #837

yuchen-lea opened this issue Jul 27, 2024 · 5 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@yuchen-lea
Copy link

yuchen-lea commented Jul 27, 2024

Background:
I previously used helm-bibtex and customized an action where I could pass in keys. If a key had a corresponding note, it would skip it; if not, it would add a new one. This allowed me to batch add notes when selecting multiple items, which was particularly useful for managing lists of books or movies.

I implemented a notes-source where notes were added as outlines to an existing file rather than creating new files.

Issue:
In citar, while selecting multiple entries and inserting citations works perfectly, attempting to open notes for multiple entries results in an error: embark PCH: (wrong-type-argument stringp nil). I initially assumed this would batch insert notes, but it seems there is a limitation or bug.

Feature Request:
I would like to request a feature in citar that allows for batch note insertion for multiple selected entries, similar to my previous setup with helm-bibtex. This feature should:

  1. Check for Existing Notes: When selecting multiple entries, the function should check if a note already exists for each entry.
  2. Handle Notes Accordingly:
    • For Entries with Existing Notes: Skip or provide an option to update the existing notes.
    • For Entries without Notes: Add new notes as per the defined notes-source setup (e.g., as outlines in an existing file).
  3. Error Handling: Ensure that the function does not throw errors when dealing with multiple entries, even if some entries have no existing notes.

Questions:
I'm not sure if modifying the existing function to implement this feature is appropriate...

The situation is indeed quite complex, simply looping the :create function may be not enough.

If I want to add a new function to embark to achieve this feature, which keymap should I hack? how should I get the selected keys from citar?

@yuchen-lea yuchen-lea added the enhancement New feature or request label Jul 27, 2024
@bdarcus
Copy link
Contributor

bdarcus commented Jul 27, 2024

In citar, while selecting multiple entries and inserting citations works perfectly, attempting to open notes for multiple entries results in an error: embark PCH: (wrong-type-argument stringp nil). I initially assumed this would batch insert notes, but it seems there is a limitation or bug.

Can you clarify this part a bit more?

@yuchen-lea yuchen-lea changed the title Batch Note Insertion in Citarntrys, Batch Note Insertion in Citar Jul 28, 2024
@yuchen-lea
Copy link
Author

yuchen-lea commented Jul 28, 2024

Sure! When I selected multiple entries, insert work, open note failed:
图片

If I edebug on citar-get-notes, it seems that, when curosr at minibuffer when there're two selected, the citekey-or-citekeys is nil, then raised embark PCH: (wrong-type-argument stringp nil). When I move the cursor on one entry, citekey-or-citekeys is a list of one citekey, the one where my cursor on, not my selected two. But I want to batch add notes for the two selected.

I'm a little confused with batch selection...

@bdarcus bdarcus added the bug Something isn't working label Jul 28, 2024
@bdarcus
Copy link
Contributor

bdarcus commented Jul 28, 2024

is this perhaps related to #835?

@yuchen-lea
Copy link
Author

It seems to be the reason.

Additionally, the behavior of using tab to add to selected multiple choices is different from using the select function in embark-act to select multiple choices. The former inserts multiple citations, while the latter inserts citations at the cursor location. I'm not sure if this is intentional design, but it confuses me.

图片 using the select function in embark-act

@bdarcus
Copy link
Contributor

bdarcus commented Jul 28, 2024

So hopefully we can fix that sometime soon, though no promises on when that might be. Perhaps when that is fixed, it may be more straightforward to do what you want to do functionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants