Kungsgeten / org-brain

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

org-brain-remove-child function paren imbalance #364

Open vigilancetech-com opened 3 years ago

vigilancetech-com commented 3 years ago

the last 4 (or 5) lines of the function don't appear to be part of the function [possibly due to the two parens at the end of the line that goes "(org-brain-remove-relationship entry child))"]

I'd fix it but I'm not exactly sure what the logic was supposed to be and am too jammed up right now to look at it.

Kungsgeten commented 3 years ago

Hi! I don't see any imbalance:

(defun org-brain-remove-child (entry child &optional verbose)
  "Remove CHILD from ENTRY.
If called interactively use `org-brain-entry-at-point' and prompt for CHILD.
Using `\\[universal-argument]' will use `org-brain-button-at-point' as ENTRY.
If VERBOSE is non-nil then display a message."
  (interactive (let ((e (if current-prefix-arg
                            (car (org-brain-button-at-point))
                          (org-brain-entry-at-pt))))
                 (list e (org-brain-choose-entry "Remove child: "
                                                 (org-brain-children e)
                                                 nil t)
                       t)))
  (if (member child (org-brain-local-children entry))
      (if (and (> (length (org-brain-parents child)) 1)
               (y-or-n-p
                (format "%s is %s's local parent. Would you like to change the local parent of %s? "
                        (org-brain-title entry) (org-brain-title child) (org-brain-title child))))
          (let* ((linked-parents (org-brain--linked-property-entries child org-brain-parents-property-name))
                 (new-parent (if (equal 1 (length linked-parents))
                                 (car-safe linked-parents)
                               (org-brain-choose-entry "Refile to parent: " linked-parents))))
            (org-brain-remove-relationship entry (org-brain-change-local-parent child new-parent)))
        (org-brain-delete-entry child))
    (org-brain-remove-relationship entry child))
  (if verbose (message "'%s' is no longer a child of '%s'."
                       (org-brain-entry-name child)
                       (org-brain-entry-name entry)))
  (org-brain--revert-if-visualizing))

Are you sure you haven't made changes to your local branch?