anchor.diff:  (in-package :nyxt/repl-mode)
   
   (define-class evaluation ()
  -  ((input
  +  ((id
  +    (nyxt::new-id)
  +    :type alex:non-negative-integer
  +    :documentation "Unique evaluation identifier.")
  +   (input
       nil
       :type (maybe string)
       :documentation "User input.")
  
positive.code: (defmethod initialize-instance :after ((evaluation evaluation) &key)
    (run-thread "repl cell evaluation"
      (setf (results evaluation) (nyxt::evaluate (input evaluation)))
      (setf (ready-p evaluation) t)))
  
  (define-mode repl-mode ()
    "Mode for interacting with the REPL."
  
negative.code:                                        completion (subseq input cursor))
                (cursor repl) (+ cursor (- (length completion) (- cursor previous-delimiter))))))))
  
  (defun html-result (evaluation)
    (spinneret:with-html-string
      (if (ready-p evaluation)
          (loop
            for result in (results evaluation)
            for sub-order from 0
            for name = (if (serapeum:single (results evaluation))
                           (intern (format nil "V~d" (id evaluation)))
                           (intern (format nil "V~d.~d" (id evaluation) sub-order)))
            do (setf (symbol-value name) result)
            collect (:div
                     (format nil "~(~a~) = " name)
                     (:raw
                      (value->html result (or (typep result 'standard-object)
                                              (typep result 'structure-object))))))
          (:span "Calculating..."))))
  
  (define-internal-page-command-global lisp-repl ()
      (repl-buffer "*Lisp REPL*" 'repl-mode)
    "Show Lisp REPL."
  