Kungsgeten / org-brain

Org-mode wiki + concept-mapping
MIT License
1.73k stars 103 forks source link

Use of Brain-Friend results in a Lisp Nesting Error #313

Closed FayeAlephNil closed 4 years ago

FayeAlephNil commented 4 years ago

Hi! I was trying to add a brain-friend link in my org-brain file and ran into the following error. The file I was trying to add a friend to has the following relationships

:PROPERTIES:
:ID:       7e54bb0f-4b6e-4734-913b-7a79e3123380
:BRAIN_CHILDREN: 24fcf147-d7df-40bd-939d-e1af7ae5dc1f
:BRAIN_FRIENDS: ac5ef28f-ef4d-4842-8f92-687d0f0d8e63 0764ec4a-1e8a-405e-9415-0cfb15fdf86a
:END:

And its children / friends have no further relationships. The debugger outputted this when I used org-insert-link. It looks like there's some kind of looping / recursion that spins out of control

FayeAlephNil commented 4 years ago

I discovered that the issue was I was trying to add a friend under a subheading of an entry although that subheading was not an entry itself. I'm not sure if that's the intended behavior but if so a better error message might be helpful, which I would consider adding in a pull request if you think that trying to add links in a subheading can be detected.

Kungsgeten commented 4 years ago

Thanks for reporting! The loop seems to be because somewhere the code thinks you have an entry, but it turns out to be nil. I'll investigate more later.

Kungsgeten commented 4 years ago

I think it should be fixed in the latest commit. It will now ask if you want to create an ID (making the subheading into an entry), and if you do not want to do that it will go up the tree until it finds a valid entry.