org-roam / org-roam-bibtex

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

Keeping bibtex citekey and org-roam handle in sync when changing one or the other #266

Closed AxelBohm closed 1 year ago

AxelBohm commented 1 year ago

Is your feature request related to a problem? Please describe. Whenever I want to change the cite handle / bibtex handle of a paper/reference, I have to open the relevant bibtex file to change it there, then go to the corresponding org-roam note to make the same change there (under :ROAM_REFS:) and lastly - although afaik optional - change the name of the org-roam note file.

Describe the solution you'd like I would be great if changing the the bibtex handle or the org cite handle changes the other two mentioned names.

If there is already a feature like this or a more efficient way of renaming instead of changing it in multiple places manually I would be glad if somebody could point this out! Thanks!

myshevchuk commented 1 year ago

@AxelBohm Hi, thank you for your request. I don't think I am personally interested in this feature, therefore I won't spend my time on it any time soon. This is because I have never had to change my BibTeX keys since I've devised a robust scheme for stable keys. My friendly advice to you is to try looking in this direction. I guess, your BibTeX keys appear not only in Org-roam notes but in other documents as well. Keeping all such documents in sync may be quite tedious and, if this is really desired, would be much better a task for a dedicated Emacs package that would cover any documents where BibTeX keys appear, not just only Org-roam notes.

The second objection is that there are libraries such as rgrep, wgrep, multi-occur, and numerous completion frameworks interfacing with them, which greatly simplify the process of simultaneous editing of multiple files. One does not need to open a relevant BibTeX file, change the key there, go to the Org-roam note and so forth. Instead, one runs rgrep to find recursively all occurrences of a string in question, the relevant lines from multiple files are automatically put into a dedicated buffer, where they can be edited in the wgrep mode (using all standard Emacs tools such as query-replace) with all the changes saved to the original files afterwards. This means some manual labor, of course, a few keystrokes, but the process is fun and I personally always look forward to wgrep-ing. I mean it's not something that you need to do on a regular basis to your BibTeX files, and if yes then see the previous paragraph.

All that being said, I would not object if someone contributed the requested syncing functionality to ORB. I would happily merge it. The only caveat, in this case, would be that such a syncing should only happen in the direction BibTeX file -> Org file. ORB will never write to BibTeX files.

Regarding renaming Org-roam files, such functionality was present in Org-roam v1. It worked only for titles though as far as I remember. And I think it was dropped in v2. At least I could not find it when I needed it recently. To my opinion, this functionality should be better implemented in Org-roam rather than ORB, on a more general level. The problem here is that the Org-roam filename can use arbitrary patterns. Moreover, different templates may use different patterns. How to figure out what the user actually means in each particular case? It's definitely doable and most probably not too hard, but not trivial either. Again, it's not that hard to rename a file in wdired (writable dired) mode once in a while. And if this must be done regularly, then the problem probably lies somewhere else. I don't see how this functionality would fit into ORB rather than Org-roam, but I'm not totally against it in ORB either. You may want to ask in Org-roam Discourse if people came up with something for automatically renaming files in Org-roam v2.

I am sorry I could not help you. I will keep this request open hoping that someone will be willing to provide a solution.

AxelBohm commented 1 year ago

@myshevchuk, thank you so much for the enormously valuable input! thb I was expecting that I am somewhat alone with this issue, but that's fine. You have given me multiple new ways to think about the problem, which is already more than I could have asked for. Thanks a lot!