anchor.diff:  ;;; search-buffer.lisp --- functions to enable searching within a buffer
  -
  -;;; NOTE: Consider using string.split instead of looping through the
  -;;; string to collect the matches. In using string split you can also
  -;;; save the information about preceding and succeeding characters
  -;;; within the string for assembling the final replacement node.
   
   (in-package :next)
   
  
positive.code:   (defvar *identifier* 0)
    (defvar *matches* (array))
    
    (defun qsa (context selector)
      "Alias of document.querySelectorAll"
      (ps:chain context (query-selector-all selector)))
    
    (defun create-match-object (body identifier index)
      "identifier: unique identifier for match, body: the text around the match,
  index: the index of the match within the text node"
      (ps:create "type" "match" "identifier" identifier "body" body))
    
    (defun create-match-span (body identifier)
  
negative.code:       (setf (ps:@ el id) identifier)
        el))
    
    (defun get-substring (string-before string-after query)
      "Return the substring and preceding/trailing text for a given index."
      (let ((character-preview-count 40))
        (+ (ps:chain string-before (substring (- (length string-before) character-preview-count)))
           query
           (ps:chain string-after (substring 0 character-preview-count)))))
    
    (defun get-substring-matches (query node)
      "Return all of substrings that match the search-string."
      (let ((substrings (ps:chain (ps:@ node text-content) (split query))))
        (when (> (length substrings) 1)
          (loop for i from 0 to (- (length substrings) 1) by 2
                collect (create-match-object 
                         (get-substring (elt substrings i)
                                        (elt substrings (+ i 1))
                                        query)
                         (incf *identifier*))))))
    
    (defun create-substring-highlights (node matches query)
      "Modify the nodes in the document to highlight the matches"
  