org-brain
org-brain copied to clipboard
[Suggest] proper deal with when a nickname is an exist entry.
For example:
(defun eh-org-brain-add-nickname (entry nickname)
(interactive (list (org-brain-entry-at-pt)
(read-string "Nickname: ")))
(let* ((targets (org-brain--all-targets))
(nickname-entry (org-brain-entry-from-id
(cdr (assoc nickname targets)))))
(if (not nickname-entry)
(org-brain-add-nickname entry nickname)
(when (yes-or-no-p (format "Entry '%s' already exists, merge it to '%s' then delete it? " nickname (nth 1 entry)))
(org-brain-add-parent entry (org-brain-parents nickname-entry))
(org-brain-add-child entry (org-brain-children nickname-entry))
(org-brain-add-friendship entry (org-brain-friends nickname-entry))
(org-brain-delete-entry nickname-entry t)
(org-brain-add-nickname entry nickname)))))
I think it makes sense to have some kind of warning if a user tries to add a nickname which clashes with another entry. I'm not quite sure it makes sense to suggest merging the entries though. I guess that depends on how the user normally uses org-brain
.
The featuer mergeing two entries to one is useful, we shoud provide a command.
Yes, I agree that it seems useful. However it should probably also consider text, resources, attachments, etc since an entry doesn't only consist of its title and relationships.
However it should probably also consider text, resources, attachments, etc since an entry doesn't only consist of its title and relationships.
I agree :-)
I will create a new issue about merge.