anchor.diff:              (setf (id (data native-node)) (id most-recent-child)))
             (htree:delete-data (htree:data root) history :test #'equals)))))
   
  +(defmethod buffer-local-history-clean-ids ((buffer buffer))
  +  "Clean the `id's of all the nodes belonging to the buffer."
  +  (with-data-access (history (history-path buffer))
  +    (htree:do-tree (node history)
  +      (when (string= (id buffer) (id (htree:data node)))
  +        (setf (id (htree:data node)) "")))))
  +
   (declaim (ftype (function (buffer)) add-to-recent-buffers))
   (defun add-to-recent-buffers (buffer)
     "Create a recent-buffer from given buffer and add it to `recent-buffers'."
  
positive.code:     buffers))
  
  (defmethod buffer-local-history-clean ((buffer buffer))
    "Deletes the BUFFER-local history in case it has no children in other buffers.
  Rebinds the history to the oldest child otherwise."
    (with-data-access (history (history-path buffer))
      (let* ((root (gethash (id buffer) (buffer-local-histories-table history)))
  
negative.code:         (window-set-active-buffer parent-window
                                    replacement-buffer)))
      (ffi-buffer-delete buffer)
      (if (clean-dead-history-p buffer)
          (buffer-local-history-clean buffer)
          (buffer-local-history-clean-ids buffer))
      (buffers-delete (id buffer))
      (add-to-recent-buffers buffer)
      (store (data-profile buffer) (history-path buffer))))
  