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:                    (loop
                       for evaluation in (evaluations repl-mode)
                       for order from 0
                       collect (:div :class "input"
                                     (:span :class "prompt"
                                            (:button
                                             :onclick (ps:ps (nyxt/ps:lisp-eval
                                                              (:title "move-cell-up")
                                                              (move-cell-up :id order)))
                                             :title "Move this cell up."
                                             "↑")
                                            (:button
                                             :onclick (ps:ps (nyxt/ps:lisp-eval
                                                              (:title "move-cell-down")
                                                              (move-cell-down :id order)))
                                             :title "Move this cell down."
                                             "↓"))
                                     (:textarea :class "input-buffer" :data-repl-id order
                                                :onfocus
                                                (ps:ps (nyxt/ps:lisp-eval
                                                        (:title "set-current-evaluation")
                                                        (setf (slot-value (nyxt:current-mode :repl)
                                                                          'current-evaluation)
                                                              order)))
                                                (input evaluation)))
                       collect (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" order))
                                                    (intern (format nil "V~d.~d" order sub-order)))
                                     do (setf (symbol-value name) result)
                                     collect (:span (format nil "~(~a~) = " name)
                                                    (:raw (value->html result (or (typep result 'standard-object)
                                                                                  (typep result 'structure-object)))))
                                     collect (:br))
                                   (:span "Calculating...")))
                     (:div :class "input"
                           (:span :class "prompt" ">")
                           (:textarea :class "input-buffer"
  
negative.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)
      (peval (setf (ps:chain (nyxt/ps:qs document (ps:lisp (format nil "#evaluation-result-~a" (id evaluation))))
                             |innerHTML|)
                   (ps:lisp (html-result evaluation))))))
  
  (define-mode repl-mode ()
    "Mode for interacting with the REPL."
  