Closed theottm closed 4 years ago
sorry, you are asking too many question at one time?
What is the most essential one?
Hi! org-brain-add-children/parent/friendship
should add an ID to the newly created entry. If it doesn't its a bug. There's a hook named org-brain-new-entry-hook
, but there's no hook when adding a relationship.
Could you describe what you're trying to do. For the most part org-brain
should create IDs for you, but maybe you're editing a lot from org-mode
?
Yes I am mainly editing from the org-mode
and run the commands org-brain-add-children/parent/friendship
from there. And when there is no ID I get an error. So for now I just run (org-map-entries 'org-id-get-create)
before. My question is : is there a simple way to make these commands add an ID before adding relationships ?
I don't know if this is what you had in mind, but I have a case for you.
Adding a friend link works very well and it's a wonderful feature to make associations of ideas (that's how I use it). However, I also need to link notes for the information (or additional information) they contain. For this, I recently used the "backlink" function which is very useful and I think complementary to org-brain-friend.
My problem is the following. When I want to link a word or a sentence to another note I use org-insert-link
then :brain
then i select the note. It works very well. If I do the same thing but with a link to a note that doesn't exist yet, it creates an .org file of the following form.
There is no headline, no ID. Would it be possible to automate this process?
@bepolymathe It is not really the same problem, since all the headings I want to connect together are already existing. The only problem is that they don't have an ID.
In your case I would suggest you create the entry/heading you want to link to before you run org-insert-link
.
@Kungsgeten I think a workaround for my case would be to just rewrite org-brain-entry-at-pt
so that instead of throwing an error when there is not ID, it just adds it with org-id-get-create
. Do you think this would do or will it break things ?
Yeah, but that's what's inconvenient... having to add headlines by hand.
I understand the problem better now. The ID should be created in the entry you're editing. It should be easy to fix and should indeed be so by default.
@bepolymathe By default org-brain
creates a file entry if you try to create a new entry, like you describe. So there's nothing wrong? If you have org-brain-include-file-entries
set to nil
then there's probably a bug.
Hi @Kungsgeten
Yes it's true that org-brain-include-file-entries
can create the expected behavior for brain:
links to files that don't exist... but these have a backlink but no parent. Can we consider a way to make that new files created either have the index (general) as a parent?
This issue should be fixed with the latest commit.
@bepolymathe You may create another issue describing your idea of a default parent for orphan entries.
Hello,
is there a hook the runs before adding a relationship ? I don't want IDs to get generated each time I create a headline, but I would like org-id-get-create to be run each time I run org-brain-add-children/parent/friendschip. I was thinking of using an add-advice but maybe there is a better way ? I could write a hook an push it if that makes sense. Would it make sense to just add this behavior in the default definition of these functions ?
And by the way another question : For now I use (org-map-entries 'org-id-get-create) a lot to just make sure everything has an ID, and its fast enough. Is there such a function in org-brain ?
Thanks!