anchor.diff:                                            all-history-entries)))
         all-history-entries)))
   
  -(defun history-disowned-suggestion-filter ()
  -  "All disowned history entries (without nodes)."
  -  (with-data-unsafe (hist (history-path (current-buffer)))
  -    (let ((owner-less-history-entries
  -           (when hist
  -             (mapcar #'htree:data
  -                     (sort
  -                      (delete-if (lambda (entry) (htree:nodes entry))
  -                                 (alex:hash-table-keys (htree:entries hist)))
  -                      (lambda (x y)
  -                        (> (score-history-entry x)
  -                           (score-history-entry y))))))))
  -      (lambda (minibuffer)
  -        (fuzzy-match (input-buffer minibuffer) owner-less-history-entries)))))
  +(define-class history-disowned-source (prompter:source)
  +  ((prompter:name "Disowned History")
  +   (buffer :accessor buffer :initarg :buffer)
  +   (prompter:must-match-p t)
  +   (prompter:multi-selection-p t)
  +   (prompter:constructor
  +    (lambda (source)
  +      (with-data-unsafe (hist (history-path (buffer source)))
  +        (let ((owner-less-history-entries
  +                (when hist
  +                  (mapcar #'htree:data
  +                          (sort
  +                           (delete-if (lambda (entry) (htree:nodes entry))
  +                                      (alex:hash-table-keys (htree:entries hist)))
  +                           (lambda (x y)
  +                             (> (score-history-entry x)
  +                                (score-history-entry y))))))))
  +          owner-less-history-entries))))))
   
   (defun history-html-list (&key (limit 100) ; Export?
                               (separator " → "))
  
positive.code:                         (* 60 60)))))
             0))))
  
  (defun history-suggestion-filter (&key prefix-urls)
    "Include prefix-urls in front of the history.
  This can be useful to, say, prefix the history with the current URL.  At the
  moment the PREFIX-URLS are inserted as is, not a `history-entry' objects since
  it would not be very useful."
    (with-data-unsafe (hist (history-path (current-buffer)))
      (let* ((all-history-entries (when hist
                                    (mapcar #'htree:data
                                            (sort (alex:hash-table-keys (htree:entries hist))
                                                  (lambda (x y)
                                                    (> (score-history-entry x)
                                                       (score-history-entry y)))))))
             (prefix-urls (delete-if #'uiop:emptyp prefix-urls)))
        (when prefix-urls
          (setf all-history-entries (append (mapcar #'quri:url-decode prefix-urls)
                                            all-history-entries)))
        (lambda (minibuffer)
          (fuzzy-match (input-buffer minibuffer) all-history-entries)))))
  
  (defun history-initial-suggestions (&key prefix-urls) ; TODO: Rename?  Make this a preprocessor so that it runs in the background?
    "TODO: Complete me!"
    (with-data-unsafe (hist (history-path (current-buffer)))
  
negative.code:       (let* ((entry (htree:data (htree:current (htree:owner history (id buffer))))))
          (incf (implicit-visits entry))))))
  
  (define-command delete-history-entry (&key (buffer (current-buffer)))
    "Delete queried history entries."
    (with-data-access (history (history-path buffer))
      (let ((entries (prompt
                      :prompt "Delete entries"
                      :sources (list (make-instance 'history-disowned-source
                                                    :buffer buffer)))))
        (dolist (entry entries)
          (htree:delete-data history entry)))))
  
  